Changeset 429


Ignore:
Timestamp:
Jul 3, 2020, 7:19:17 PM (4 years ago)
Author:
coas-nagasima
Message:

ASP3, TINET, mbed を更新

Location:
EcnlProtoTool/trunk
Files:
251 added
8 deleted
353 edited
2 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/.cproject

    r426 r429  
    4949                                                        <option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1804182567" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash" value="true" valueType="boolean"/>
    5050                                                        <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.74647507" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
    51                                                         <builder buildPath="${workspace_loc:/asp3_dcre}/Debug" id="com.renesas.cdt.managedbuild.gcc.rz.builder.460934776" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GCC for Renesas Builder" superClass="com.renesas.cdt.managedbuild.gcc.rz.builder"/>
     51                                                        <builder buildPath="${workspace_loc:/asp3_dcre}/Debug" id="com.renesas.cdt.managedbuild.gcc.rz.builder.460934776" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="GCC for Renesas Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.renesas.cdt.managedbuild.gcc.rz.builder"/>
    5252                                                        <tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.assembler.1682623852" name="Cross ARM GNU Assembler" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.assembler">
    5353                                                                <option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1607103230" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
     
    9494                                <option id="toolchain.id" value="gcc-arm-embedded"/>
    9595                                <option id="toolchain.version" value="6.3.1.20170620"/>
     96                                <option id="toolchain.enable" value="true"/>
    9697                        </storageModule>
    9798                </cconfiguration>
     
    112113                </configuration>
    113114        </storageModule>
     115        <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
    114116</cproject>
  • EcnlProtoTool/trunk/asp3_dcre/Debug/Makefile

    r424 r429  
    66#  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77#                              Toyohashi Univ. of Technology, JAPAN
    8 #  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     8#  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    99#              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    8181
    8282#
     83#  システムサービスコールライブラリ(libsyssvc.a)のディレクトリ名
     84#  (システムサービスコールライブラリもmake対象にする時は,空に定義する)
     85#
     86SYSSVC_LIB =
     87
     88#
    8389#  カーネルを関数単位でコンパイルするかどうかの定義
    8490#
     
    8995#
    9096OMIT_TECS =
     97
     98#
     99#  TECS関係ファイルのディレクトリの定義
     100#
     101TECSDIR =
    91102
    92103#
     
    119130
    120131#
    121 #  依存関係ファイルを置くディレクトリの定義
    122 #
    123 DEPDIR = deps
     132#  中間オブジェクトファイルと依存関係ファイルを置くディレクトリの定義
     133#
     134OBJDIR = obj
     135DEPDIR = obj
    124136
    125137#
     
    150162endif
    151163
     164TINETDIR = tinet
     165
    152166#
    153167#  mbedサービスの定義
     
    159173#  共通コンパイルオプションの定義
    160174#
    161 COPTS := -g -std=gnu99 $(COPTS)
     175COPTS := -g -std=gnu99 -ffunction-sections -fdata-sections $(COPTS)
    162176ifndef OMIT_WARNING_ALL
    163177        COPTS := -Wall $(COPTS)
     
    171185CDEFS := $(CDEFS)
    172186INCLUDES := -I. -I$(SRCDIR)/include $(INCLUDES) -I$(SRCDIR)
    173 LDFLAGS := $(LDFLAGS) -Wl,-Map=$(OBJNAME).map,--cref
     187LDFLAGS := $(LDFLAGS) -L.
    174188LIBS := $(LIBS) $(CXXLIBS)
    175189CFLAGS = $(COPTS) $(CDEFS) $(INCLUDES)
     
    191205        APPL_COBJS := sample1n.o sample1.o
    192206endif
    193 APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o
     207APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o mbed_stub.o
    194208APPL_CFLAGS := $(APPL_CFLAGS)
    195209ifdef APPLDIRS
     
    197211endif
    198212
    199 TINETDIR = tinet
    200213ifdef TINETDIR
    201214        #
     
    221234        SUPPORT_UDP = true
    222235
     236        # IGMPを有効に設定
     237        #SUPPORT_IGMP = true
     238
    223239        #
    224240        #  ネットワークサービスの Makefile のインクルード
     
    230246#  システムサービスに関する定義
    231247#
     248ifdef TCINSTALL
     249GCC_PATH = $(TCINSTALL)
     250else
     251GCC_PATH = $(shell which $(CC))/../../
     252endif
     253MALLOC_LIB = "${GCC_PATH}arm-none-eabi/lib/thumb/v7-ar/fpv3/hard/libc.a"
     254MALLOC_OBJS = lib_a-reent.o lib_a-impure.o lib_a-malloc.o lib_a-mallocr.o lib_a-calloc.o lib_a-callocr.o lib_a-realloc.o lib_a-reallocr.o lib_a-sbrkr.o lib_a-freer.o
     255
    232256SYSSVC_DIRS := $(TECSGENDIR) $(SRCDIR)/tecs_kernel \
    233257                                $(SYSSVC_DIRS) $(SRCDIR)/syssvc
    234258SYSSVC_ASMOBJS := $(SYSSVC_ASMOBJS)
    235 SYSSVC_COBJS := $(INIT_TECS_COBJ) $(TECS_COBJS) $(SYSSVC_COBJS) \
    236                                 $(CXXRTS)
     259SYSSVC_COBJS := $(SYSSVC_COBJS) $(TECS_COBJS) \
     260                                $(INIT_TECS_COBJ) $(CXXRTS)
    237261SYSSVC_CFLAGS := $(SYSSVC_CFLAGS)
    238262INCLUDES := $(INCLUDES) -I$(TECSGENDIR) -I$(SRCDIR)/tecs_kernel -I../../musl-1.1.18/include
    239263
    240264#
     265#  トレースログ記録のサンプルコードに関する定義
     266#
     267ifdef ENABLE_TRACE
     268        COPTS := $(COPTS) -DTOPPERS_ENABLE_TRACE
     269        SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/arch/tracelog
     270endif
     271
     272#
    241273#  ターゲットファイル
    242274#
    243275.PHONY: all
    244276ifndef OMIT_TECS
    245 all: tecs
     277all: tecs | $(DEPDIR)
    246278#       @$(MAKE) check
    247279        @$(MAKE) check $(OBJNAME).bin
     
    258290#  コンフィギュレータに関する定義
    259291#
     292CFG_KERNEL := --kernel asp
    260293ifndef TINETDIR
    261294  CFG_TRB := -T $(TARGETDIR)/target_kernel.trb
     
    266299  CFG_TABS := --api-table $(TINET_ROOT)/tcpip_api.def:tcpip \
    267300                        --api-table $(SRCDIR)/kernel/kernel_api.def:kernel \
    268                         --symval-table $(SRCDIR)/tinet/tcpip_sym.def \
     301                        --symval-table $(TINET_ROOT)/tcpip_sym.def \
    269302                        --symval-table $(SRCDIR)/kernel/kernel_sym.def $(CFG_TABS)
    270303endif
     
    272305CFG_COBJS := kernel_cfg.o $(CFG_COBJS)
    273306CFG_OBJS := $(CFG_ASMOBJS) $(CFG_COBJS)
     307CFG_CFLAGS := -DTOPPERS_CB_TYPE_ONLY $(CFG_CFLAGS)
     308
    274309CFG2_OUT_SRCS := kernel_cfg.h kernel_cfg.c $(CFG2_OUT_SRCS)
    275 CFG_CFLAGS := -DTOPPERS_CB_TYPE_ONLY $(CFG_CFLAGS)
    276310
    277311#
     
    304338                                        $(foreach file,$(KERNEL_FCSRCS),$(file:.c=.o))
    305339endif
    306 ifdef OMIT_OFFSET_H
    307         OFFSET_H =
    308 else
     340ifdef TARGET_OFFSET_TRB
    309341        OFFSET_H = offset.h
    310342endif
     
    322354endif
    323355ifndef TARGET_TCPIP_TRB
    324         TARGET_TCPIP_TRB := $(SRCDIR)/tinet/tinet.trb
     356        TARGET_TCPIP_TRB := $(SRCDIR)/$(TINETDIR)/tinet.trb
    325357endif
    326358
     
    332364vpath %.cfg $(APPL_DIRS)
    333365vpath %.cdl $(APPL_DIRS)
     366vpath %.bin $(APPL_DIRS)
     367
     368#
     369#  中間オブジェクトファイルを置くディレクトリの処理
     370#
     371APPL_ASMOBJS   := $(addprefix $(OBJDIR)/, $(APPL_ASMOBJS))
     372APPL_CXXOBJS   := $(addprefix $(OBJDIR)/, $(APPL_CXXOBJS))
     373APPL_COBJS     := $(addprefix $(OBJDIR)/, $(APPL_COBJS))
     374SYSSVC_ASMOBJS := $(addprefix $(OBJDIR)/, $(SYSSVC_ASMOBJS))
     375SYSSVC_COBJS   := $(addprefix $(OBJDIR)/, $(SYSSVC_COBJS))
     376KERNEL_ASMOBJS := $(addprefix $(OBJDIR)/, $(KERNEL_ASMOBJS))
     377KERNEL_COBJS   := $(addprefix $(OBJDIR)/, $(KERNEL_COBJS))
     378KERNEL_LCOBJS  := $(addprefix $(OBJDIR)/, $(KERNEL_LCOBJS))
     379CFG_ASMOBJS    := $(addprefix $(OBJDIR)/, $(CFG_ASMOBJS))
     380CFG_COBJS      := $(addprefix $(OBJDIR)/, $(CFG_COBJS))
     381CFG_DMY        := $(addprefix $(OBJDIR)/, $(CFG_DMY))
     382MALLOC_OBJS    := $(addprefix $(OBJDIR)/, $(MALLOC_OBJS))
    334383
    335384#
    336385#  コンパイルのための変数の定義
    337386#
    338 KERNEL_LIB_OBJS = $(KERNEL_ASMOBJS) $(KERNEL_COBJS) $(KERNEL_LCOBJS)
     387APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS)
    339388SYSSVC_OBJS = $(SYSSVC_ASMOBJS) $(SYSSVC_COBJS) $(HIDDEN_OBJS)
    340 APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS)
     389KERNEL_LIB_OBJS = $(KERNEL_ASMOBJS) $(KERNEL_COBJS) $(KERNEL_LCOBJS) $(MALLOC_OBJS)
     390CFG_OBJS = $(CFG_ASMOBJS) $(CFG_COBJS)
    341391ALL_OBJS = $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    342392                                                                                        $(END_OBJS) $(HIDDEN_OBJS)
     
    350400        OBJ_LDFLAGS := $(OBJ_LDFLAGS) -L.
    351401endif
     402ifdef SYSSVC_LIB
     403        LIBS_DEP := $(LIBS_DEP) $(SYSSVC_LIB)/libsyssvc.a
     404        OBJ_LDFLAGS := $(OBJ_LDFLAGS) -L$(SYSSVC_LIB)
     405        REALCLEAN_FILES := $(REALCLEAN_FILES) libsyssvc.a
     406else
     407        LIBS_DEP := $(LIBS_DEP) libsyssvc.a
     408        OBJ_LDFLAGS := $(OBJ_LDFLAGS) -L.
     409endif
    352410
    353411ifdef TEXT_START_ADDRESS
     
    372430tecs $(TECSGEN_SRCS) $(TECS_HEADERS): $(TECSGEN_TIMESTAMP) ;
    373431$(TECSGEN_TIMESTAMP): $(APPL_CDL) $(TECS_IMPORTS)
    374         $(TECSGEN) $< -R $(INCLUDES) --cpp "$(TECS_CPP)" -g $(TECSGENDIR)
     432        $(TECSGEN) $< -R $(INCLUDES) --cpp "$(subst ", \", $(TECS_CPP))" -g $(TECSGENDIR)
    375433
    376434#
     
    379437cfg1_out.c cfg1_out.db: cfg1_out.timestamp ;
    380438cfg1_out.timestamp: $(APPL_CFG) $(TECSGEN_TIMESTAMP)
    381         echo $(CFG_TABS)
    382         $(CFG) --pass 1 --kernel asp $(INCLUDES) $(CFG_TABS) \
     439        $(CFG) --pass 1 $(CFG_KERNEL) $(INCLUDES) $(CFG_TABS) \
    383440                                                -M $(DEPDIR)/cfg1_out_c.d $(TARGET_KERNEL_CFG) $<
    384441
    385 $(CFG1_OUT): $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
     442$(CFG1_OUT): $(START_OBJS) $(OBJDIR)/cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
    386443        $(LINK) $(CFLAGS) $(LDFLAGS) $(CFG1_OUT_LDFLAGS) -o $(CFG1_OUT) \
    387                                                 $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS)
     444                                                $(START_OBJS) $(OBJDIR)/cfg1_out.o $(CFG_DMY) $(LIBS) $(END_OBJS) $(HIDDEN_OBJS)
    388445
    389446cfg1_out.syms: $(CFG1_OUT)
     
    395452$(CFG2_OUT_SRCS) cfg2_out.db: kernel_cfg.timestamp ;
    396453kernel_cfg.timestamp: cfg1_out.db cfg1_out.syms cfg1_out.srec
    397         $(CFG) --pass 2 --kernel asp $(INCLUDES) $(CFG_TRB)
     454        $(CFG) --pass 2 $(CFG_KERNEL) $(INCLUDES) $(CFG_TRB)
    398455
    399456#
     
    402459$(OFFSET_H): offset.timestamp ;
    403460offset.timestamp: cfg1_out.db cfg1_out.syms cfg1_out.srec
    404         $(CFG) --pass 2 -O --kernel asp $(INCLUDES) -T $(TARGET_OFFSET_TRB) \
     461        $(CFG) --pass 2 -O $(CFG_KERNEL) $(INCLUDES) -T $(TARGET_OFFSET_TRB) \
    405462                                --rom-symbol cfg1_out.syms --rom-image cfg1_out.srec
    406463
     
    414471
    415472#
     473#  システムサービスコールライブラリファイルの生成
     474#
     475libsyssvc.a: $(filter-out $(OBJDIR)/tBannerMain.o, $(SYSSVC_OBJS))
     476        rm -f libsyssvc.a
     477        $(AR) -rcs libsyssvc.a $(filter-out $(OBJDIR)/tBannerMain.o, $(SYSSVC_OBJS))
     478        $(RANLIB) libsyssvc.a
     479
     480#
     481#  並列makeのための依存関係の定義
     482#
     483$(APPL_OBJS) $(filter-out $(CFG_DMY), $(SYSSVC_OBJS)): | kernel_cfg.timestamp
     484$(APPL_ASMOBJS) $(filter-out $(CFG_DMY), $(SYSSVC_ASMOBJS)) $(KERNEL_ASMOBJS) $(CFG_ASMOBJS): \
     485                                                                                                                | offset.timestamp
     486
     487#
    416488#  特別な依存関係の定義
    417489#
    418 tBannerMain.o: $(filter-out tBannerMain.o,$(ALL_OBJS)) $(LIBS_DEP)
     490$(OBJDIR)/tBannerMain.o: $(filter-out $(OBJDIR)/tBannerMain.o,$(ALL_OBJS)) \
     491                                                                                                                                $(LIBS_DEP)
    419492
    420493#
     
    423496$(OBJFILE): $(ALL_OBJS) $(LIBS_DEP)
    424497        $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) \
     498                        -Wl,-Map=$(OBJNAME).map,--cref -Wl,--gc-sections -Wl,-e_kernel__start,--gc-keep-exported=_kernel_istk \
    425499                        $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    426                         $(ALL_LIBS) $(END_OBJS)
     500                        -Wl,--start-group $(ALL_LIBS) -Wl,--end-group $(END_OBJS)
     501
     502#
     503#  依存関係フォルダの作成
     504#
     505$(DEPDIR):
     506        mkdir $@
    427507
    428508#
     
    452532check: check.timestamp ;
    453533check.timestamp: cfg2_out.db $(OBJNAME).syms $(OBJNAME).srec
    454         $(CFG) --pass 3 --kernel asp -O $(INCLUDES) -T $(TARGET_CHECK_TRB) \
     534        $(CFG) --pass 3 $(CFG_KERNEL) -O $(INCLUDES) -T $(TARGET_CHECK_TRB) \
    455535                                --rom-symbol $(OBJNAME).syms --rom-image $(OBJNAME).srec
    456536        @echo "configuration check passed"
     
    461541.PHONY: clean
    462542clean:
    463         rm -f \#* *~ *.o $(DEPDIR)/*.d $(CLEAN_FILES) check.timestamp
     543        rm -f \#* *~ $(OBJDIR)/*.o $(DEPDIR)/*.d $(CLEAN_FILES) check.timestamp
    464544        rm -f $(OBJFILE) $(OBJNAME).syms $(OBJNAME).srec $(OBJNAME).bin
    465545        rm -f kernel_cfg.timestamp $(CFG2_OUT_SRCS) cfg2_out.db
     
    471551        rm -f libkernel.a
    472552endif
     553ifndef SYSSVC_LIB
     554        rm -f libsyssvc.a
     555endif
     556        rm -f $(MALLOC_OBJS)
    473557
    474558.PHONY: cleankernel
    475559cleankernel:
    476560        rm -f $(OFFSET_H) $(KERNEL_LIB_OBJS)
    477         rm -f $(KERNEL_LIB_OBJS:%.o=$(DEPDIR)/%.d)
     561        rm -f $(KERNEL_LIB_OBJS:$(OBJDIR)/%.o=$(DEPDIR)/%.d)
     562
     563.PHONY: cleansyssvc
     564cleansyssvc:
     565        rm -f $(SYSSVC_OBJS)
     566        rm -f $(SYSSVC_OBJS:$(OBJDIR)/%.o=$(DEPDIR)/%.d)
    478567
    479568.PHONY: realclean
     
    487576#  のみを付けてコンパイルする.
    488577#
    489 ALL_CFG_COBJS = $(CFG_COBJS) cfg1_out.o
     578ALL_CFG_COBJS = $(CFG_COBJS) $(OBJDIR)/cfg1_out.o
    490579ALL_CFG_ASMOBJS = $(CFG_ASMOBJS)
    491580
    492 $(ALL_CFG_COBJS): %.o: %.c
    493         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
    494 
    495 $(ALL_CFG_COBJS:.o=.s): %.s: %.c
    496         $(CC) -S $(CFLAGS) $(CFG_CFLAGS) $<
    497 
    498 $(ALL_CFG_ASMOBJS): %.o: %.S
    499         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
     581$(ALL_CFG_COBJS): $(OBJDIR)/%.o: %.c
     582        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
     583
     584$(ALL_CFG_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     585        $(CC) -S -o $@ $(CFLAGS) $(CFG_CFLAGS) $<
     586
     587$(ALL_CFG_ASMOBJS): $(OBJDIR)/%.o: %.S
     588        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
    500589
    501590#
     
    549638#  コンパイルルールの定義
    550639#
    551 $(KERNEL_COBJS): %.o: %.c
    552         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
    553 
    554 $(KERNEL_COBJS:.o=.s): %.s: %.c
    555         $(CC) -S $(CFLAGS) $(KERNEL_CFLAGS) $<
    556 
    557 $(KERNEL_LCOBJS): %.o:
    558         $(CC) -DTOPPERS_$(*F) -o $@ -c -MD -MP -MF $(DEPDIR)/$*.d \
     640$(KERNEL_COBJS): $(OBJDIR)/%.o: %.c
     641        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
     642
     643$(KERNEL_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     644        $(CC) -S -o $@ $(CFLAGS) $(KERNEL_CFLAGS) $<
     645
     646$(KERNEL_LCOBJS): $(OBJDIR)/%.o:
     647        $(CC) -c -o $@ -DTOPPERS_$(*F) -MD -MP -MF $(DEPDIR)/$*.d \
    559648                                                                        $(CFLAGS) $(KERNEL_CFLAGS) $<
    560649
    561 $(KERNEL_LCOBJS:.o=.s): %.s:
    562         $(CC) -DTOPPERS_$(*F) -o $@ -S $(CFLAGS) $(KERNEL_CFLAGS) $<
    563 
    564 $(KERNEL_ASMOBJS): %.o: %.S
    565         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
    566 
    567 $(SYSSVC_COBJS): %.o: %.c
    568         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
    569 
    570 $(SYSSVC_COBJS:.o=.s): %.s: %.c
    571         $(CC) -S $(CFLAGS) $(SYSSVC_CFLAGS) $<
    572 
    573 $(SYSSVC_ASMOBJS): %.o: %.S
    574         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
    575 
    576 $(APPL_COBJS): %.o: %.c
    577         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    578 
    579 $(APPL_COBJS:.o=.s): %.s: %.c
    580         $(CC) -S $(CFLAGS) $(APPL_CFLAGS) $<
    581 
    582 $(APPL_CXXOBJS): %.o: %.cpp
    583         $(CXX) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    584 
    585 $(APPL_CXXOBJS:.o=.s): %.s: %.cpp
    586         $(CXX) -S $(CFLAGS) $(APPL_CFLAGS) $<
    587 
    588 $(APPL_ASMOBJS): %.o: %.S
    589         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     650$(KERNEL_LCOBJS:$(OBJDIR)/%.o=%.s): %.s:
     651        $(CC) -S -o $@ -DTOPPERS_$(*F) $(CFLAGS) $(KERNEL_CFLAGS) $<
     652
     653$(KERNEL_ASMOBJS): $(OBJDIR)/%.o: %.S
     654        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
     655
     656$(SYSSVC_COBJS): $(OBJDIR)/%.o: %.c
     657        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
     658
     659$(SYSSVC_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     660        $(CC) -S -o $@ $(CFLAGS) $(SYSSVC_CFLAGS) $<
     661
     662$(SYSSVC_ASMOBJS): $(OBJDIR)/%.o: %.S
     663        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
     664
     665$(APPL_COBJS): $(OBJDIR)/%.o: %.c
     666        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     667
     668$(APPL_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     669        $(CC) -S -o $@ $(CFLAGS) $(APPL_CFLAGS) $<
     670
     671$(APPL_CXXOBJS): $(OBJDIR)/%.o: %.cpp
     672        $(CXX) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     673
     674$(APPL_CXXOBJS:$(OBJDIR)/%.o=%.s): %.s: %.cpp
     675        $(CXX) -S -o $@ $(CFLAGS) $(APPL_CFLAGS) $<
     676
     677$(APPL_ASMOBJS): $(OBJDIR)/%.o: %.S
     678        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     679
     680$(MALLOC_OBJS): $(OBJDIR)/%.o:
     681        $(AR) x $(MALLOC_LIB) $(notdir $@)
     682        mv $(notdir $@) $@
    590683
    591684#
    592685#  デフォルトコンパイルルールを上書き
    593686#
    594 %.o: %.c
     687$(OBJDIR)/%.o: %.c
    595688        @echo "*** Default compile rules should not be used."
    596         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     689        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
    597690
    598691%.s: %.c
    599692        @echo "*** Default compile rules should not be used."
    600         $(CC) -S $(CFLAGS) $<
    601 
    602 %.o: %.cpp
     693        $(CC) -S -o $@ $(CFLAGS) $<
     694
     695$(OBJDIR)/%.o: %.cpp
    603696        @echo "*** Default compile rules should not be used."
    604         $(CXX) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     697        $(CXX) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
    605698
    606699%.s: %.cpp
    607700        @echo "*** Default compile rules should not be used."
    608         $(CXX) -S $(CFLAGS) $<
    609 
    610 %.o: %.S
     701        $(CXX) -S -o $@ $(CFLAGS) $<
     702
     703$(OBJDIR)/%.o: %.S
    611704        @echo "*** Default compile rules should not be used."
    612         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     705        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
  • EcnlProtoTool/trunk/asp3_dcre/MANIFEST

    r270 r429  
    11PACKAGE asp3
    2 VERSION 3.1.0
     2VERSION 3.5.0
    33
    44configure.rb
     
    8888tecs_kernel/tAlarmNotifier.c
    8989tecs_kernel/tAlarmNotifier_inline.h
    90 tecs_kernel/tCpuExceptionHandler.c
    9190tecs_kernel/tCyclicNotifier.c
    9291tecs_kernel/tCyclicNotifier_inline.h
     
    9695tecs_kernel/tISR.c
    9796tecs_kernel/tInitializeRoutine.c
    98 tecs_kernel/tInterruptHandler.c
    9997tecs_kernel/tInterruptRequest_inline.h
    10098tecs_kernel/tKernel_inline.h
     
    119117syssvc/tLogTask.cdl
    120118syssvc/tLogTaskMain.c
     119syssvc/tPutLogSIOPort.c
     120syssvc/tPutLogSIOPort.cdl
    121121syssvc/tSerialAdapter.c
    122122syssvc/tSerialAdapter.cdl
     
    129129syssvc/tTestService.c
    130130syssvc/tTestService.cdl
     131syssvc/tTestServiceAdapter.c
     132syssvc/tTestServiceAdapter.cdl
    131133syssvc/test_svc.h
    132134
     
    141143arch/tracelog/tTraceLog.c
    142144arch/tracelog/tTraceLog.cdl
     145
     146arch/simtimer/sim_timer.c
     147arch/simtimer/sim_timer.cfg
     148arch/simtimer/sim_timer.h
     149arch/simtimer/sim_timer_cntl.h
     150arch/simtimer/tSimTimerCntl.c
     151arch/simtimer/tSimTimerCntl.cdl
     152arch/simtimer/tSimTimerCntlAdapter.c
     153arch/simtimer/tSimTimerCntlAdapter.cdl
    143154
    144155utils/applyrename.rb
  • EcnlProtoTool/trunk/asp3_dcre/README.txt

    r321 r429  
    11
    2         TOPPERS/ASP3 Kernel(Release 3.1
     2        TOPPERS/ASP3 Kernel(Release 3.5
    33                Toyohashi Open Platform for Embedded Real-Time Systems/
    44                Advanced Standard Profile Kernel
     
    4040グリスト(users@toppers.jp)宛にお願いします.
    4141
     42これらのメーリングリストに投稿されたメールは,ウェブサイトのメーリング
     43リストアーカイブから読むことができますので,公開すべきでない情報(個人
     44情報など)をメール中に含めないように注意をお願いします.
     45
    4246TOPPERSユーザーズメーリングリストへの登録方法については,以下のページに
    4347説明があります.
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/MANIFEST

    r270 r429  
    11PACKAGE asp3_arch_arm_gcc
    2 VERSION 3.1.0
     2VERSION 3.2.0
    33
    44MANIFEST
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/Makefile.core

    r321 r429  
    22#               Makefileのコア依存部(ARM用)
    33#
    4 #  $Id$
     4#  $Id: Makefile.core 755 2016-06-12 10:08:22Z ertl-hiro $
    55#
    66
     
    5050#  START_OBJSをstart.oに設定し,LDFLAGSに-nostdlibを追加する.
    5151#
    52 START_OBJS = start.o
     52START_OBJS := start.o
     53START_OBJS := $(addprefix $(OBJDIR)/, $(START_OBJS))
    5354
    54 $(START_OBJS): %.o: %.S
    55         $(CC) -c $(CFLAGS) $(KERNEL_CFLAGS) $<
     55$(START_OBJS): $(OBJDIR)/%.o: %.S
     56        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
    5657
    57 LDFLAGS := -nostdlib $(LDFLAGS)
     58LDFLAGS := -nodefaultlibs $(LDFLAGS)
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/arm.c

    r321 r429  
    137137 *  ARMv7におけるデータキャッシュの無効化
    138138 *
    139  *  レベル0のキャッシュのみを無効化する.
     139 *  バリアを2か所に入れているのは,ARMアーキテクチャリファレンスマニュ
     140 *  アルのサンプルコードを踏襲した.
    140141 */
    141142#if __TARGET_ARCH_ARM == 7
     
    144145armv7_invalidate_dcache(void)
    145146{
    146         uint32_t        reg;
     147        uint32_t        clidr, ccsidr;
     148        uint32_t        level, no_levels;
    147149        uint32_t        way, no_ways, shift_way;
    148150        uint32_t        set, no_sets, shift_set;
    149 
    150         CP15_WRITE_CSSELR(0U);
    151         CP15_READ_CCSIDR(reg);
    152         no_sets = ((reg >> 13) & 0x7fffU) + 1;
    153         shift_set = (reg & 0x07U) + 4;
    154         no_ways = ((reg >> 3) & 0x3ffU) + 1;
    155         shift_way = count_leading_zero(no_ways);
    156 
    157         for (way = 0; way < no_ways; way++){
    158                 for (set = 0; set < no_sets; set++) {
    159                         reg = (way << shift_way) | (set << shift_set);
    160                         CP15_WRITE_DCISW(reg);
     151        uint32_t        waylevel, setwaylevel;
     152
     153        CP15_READ_CLIDR(clidr);
     154        no_levels = (clidr >> 24) & 0x07U;
     155        for (level = 0; level < no_levels; level++) {
     156                if (((clidr >> (level * 3)) & 0x07U) >= 0x02U) {
     157                        CP15_WRITE_CSSELR(level << 1);
     158                        inst_sync_barrier();
     159                        CP15_READ_CCSIDR(ccsidr);
     160                        no_sets = ((ccsidr >> 13) & 0x7fffU) + 1;
     161                        shift_set = (ccsidr & 0x07U) + 4;
     162                        no_ways = ((ccsidr >> 3) & 0x3ffU) + 1;
     163                        shift_way = count_leading_zero(no_ways - 1);
     164
     165                        for (way = 0; way < no_ways; way++) {
     166                                waylevel = (way << shift_way) | (level << 1);
     167                                for (set = 0; set < no_sets; set++) {
     168                                        setwaylevel = waylevel | (set << shift_set);
     169                                        CP15_WRITE_DCISW(setwaylevel);
     170                                }
     171                        }
    161172                }
    162173        }
     174        data_sync_barrier();
    163175}
    164176
     
    168180 *  ARMv7におけるデータキャッシュのクリーンと無効化
    169181 *
    170  *  レベル0のキャッシュのみをクリーンと無効化する.
     182 *  バリアを2か所に入れているのは,ARMアーキテクチャリファレンスマニュ
     183 *  アルのサンプルコードを踏襲した.
    171184 */
    172185#if __TARGET_ARCH_ARM == 7
     
    175188armv7_clean_and_invalidate_dcache(void)
    176189{
    177         uint32_t        reg;
     190        uint32_t        clidr, ccsidr;
     191        uint32_t        level, no_levels;
    178192        uint32_t        way, no_ways, shift_way;
    179193        uint32_t        set, no_sets, shift_set;
    180 
    181         CP15_WRITE_CSSELR(0U);
    182         CP15_READ_CCSIDR(reg);
    183         no_sets = ((reg >> 13) & 0x7fffU) + 1;
    184         shift_set = (reg & 0x07U) + 4;
    185         no_ways = ((reg >> 3) & 0x3ffU) + 1;
    186         shift_way = count_leading_zero(no_ways);
    187 
    188         for (way = 0; way < no_ways; way++){
    189                 for (set = 0; set < no_sets; set++) {
    190                         reg = (way << shift_way) | (set << shift_set);
    191                         CP15_WRITE_DCCISW(reg);
     194        uint32_t        waylevel, setwaylevel;
     195
     196        CP15_READ_CLIDR(clidr);
     197        no_levels = (clidr >> 24) & 0x07U;
     198        for (level = 0; level < no_levels; level++) {
     199                if (((clidr >> (level * 3)) & 0x07U) >= 0x02U) {
     200                        CP15_WRITE_CSSELR(level << 1);
     201                        inst_sync_barrier();
     202                        CP15_READ_CCSIDR(ccsidr);
     203                        no_sets = ((ccsidr >> 13) & 0x7fffU) + 1;
     204                        shift_set = (ccsidr & 0x07U) + 4;
     205                        no_ways = ((ccsidr >> 3) & 0x3ffU) + 1;
     206                        shift_way = count_leading_zero(no_ways - 1);
     207
     208                        for (way = 0; way < no_ways; way++) {
     209                                waylevel = (way << shift_way) | (level << 1);
     210                                for (set = 0; set < no_sets; set++) {
     211                                        setwaylevel = waylevel | (set << shift_set);
     212                                        CP15_WRITE_DCCISW(setwaylevel);
     213                                }
     214                        }
    192215                }
    193216        }
     217        data_sync_barrier();
    194218}
    195219
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/arm.h

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    5353 */
    5454#ifndef TOPPERS_MACRO_ONLY
    55 #ifndef TECSGEN
    56 #include "arm_insn.h"                           /* tecsgenが解釈できないためスキップ */
    57 #endif /* TECSGEN */
     55#include "arm_insn.h"
    5856#endif /*  TOPPERS_MACRO_ONLY */
    5957
     
    117115#define CP15_SCTLR_DCACHE               UINT_C(0x00000004)
    118116#define CP15_SCTLR_MMU                  UINT_C(0x00000001)
     117
     118/*
     119 *  CP15のコプロセッサアクセス制御レジスタ(CPACR)の設定値
     120 */
     121#define CP15_CPACR_ASEDIS                       UINT_C(0x80000000)
     122#define CP15_CPACR_D32DIS                       UINT_C(0x40000000)
     123#define CP15_CPACR_CP11_FULLACCESS      UINT_C(0x00c00000)
     124#define CP15_CPACR_CP10_FULLACCESS      UINT_C(0x00300000)
    119125
    120126/*
     
    193199#define ARM_MMU_DSCR1_TEX010            0x02000U        /* TEXビットが010 */
    194200#define ARM_MMU_DSCR1_TEX100            0x04000U        /* TEXビットが100 */
    195 #define ARM_MMU_DSCR1_AP01                      0x00400U        /* APビットが01 */
    196 #define ARM_MMU_DSCR1_AP10                      0x00800U        /* APビットが10 */
    197 #define ARM_MMU_DSCR1_AP11                      0x00c00U        /* APビットが11 */
    198201#define ARM_MMU_DSCR1_CB00                      0x00000U        /* Cビットが0,Bビットが0 */
    199202#define ARM_MMU_DSCR1_CB01                      0x00004U        /* Cビットが0,Bビットが1 */
     
    201204#define ARM_MMU_DSCR1_CB11                      0x0000cU        /* Cビットが1,Bビットが1 */
    202205
    203 #if __TARGET_ARCH_ARM >= 6
     206#if __TARGET_ARCH_ARM < 6
     207
     208#define ARMV5_MMU_DSCR1_AP01            0x00400U        /* APビットが01 */
     209#define ARMV5_MMU_DSCR1_AP10            0x00800U        /* APビットが10 */
     210#define ARMV5_MMU_DSCR1_AP11            0x00c00U        /* APビットが11 */
     211
     212#else /* __TARGET_ARCH_ARM < 6 */
     213
    204214#define ARMV6_MMU_DSCR1_NONGLOBAL       0x20000U        /* グローバルでない */
    205 #define ARMV6_MMU_DSCR1_APX0            0x00000U        /* APXビットが0 */
    206 #define ARMV6_MMU_DSCR1_APX1            0x08000U        /* APXビットが1 */
     215#define ARMV6_MMU_DSCR1_AP001           0x00400         /* APビットが001 */
     216#define ARMV6_MMU_DSCR1_AP010           0x00800         /* APビットが010 */
     217#define ARMV6_MMU_DSCR1_AP011           0x00c00         /* APビットが011 */
     218#define ARMV6_MMU_DSCR1_AP101           0x08400         /* APビットが101 */
     219#define ARMV6_MMU_DSCR1_AP110           0x08800         /* APビットが110 */
     220#define ARMV6_MMU_DSCR1_AP111           0x08c00         /* APビットが111 */
    207221#define ARMV6_MMU_DSCR1_ECC                     0x00200U        /* ECCが有効(MPCore)*/
    208222#define ARMV6_MMU_DSCR1_NOEXEC          0x00010U        /* 実行不可 */
    209 #endif /* __TARGET_ARCH_ARM >= 6 */
     223
     224#endif /* __TARGET_ARCH_ARM < 6 */
    210225
    211226/*
     
    237252#define ARMV6_MMU_DSCR2_NONGLOBAL       0x0800U         /* グローバルでない */
    238253#define ARMV6_MMU_DSCR2_SHARED          0x0400U         /* プロセッサ間で共有 */
    239 #define ARMV6_MMU_DSCR2_APX0            0x0000U         /* APXビットが0 */
    240 #define ARMV6_MMU_DSCR2_APX1            0x0200U         /* APXビットが1 */
    241 #define ARMV6_MMU_DSCR2_AP01            0x0010U         /* APビットが01 */
    242 #define ARMV6_MMU_DSCR2_AP10            0x0020U         /* APビットが10 */
    243 #define ARMV6_MMU_DSCR2_AP11            0x0030U         /* APビットが11 */
     254#define ARMV6_MMU_DSCR2_AP001           0x0010          /* APビットが001 */
     255#define ARMV6_MMU_DSCR2_AP010           0x0020          /* APビットが010 */
     256#define ARMV6_MMU_DSCR2_AP011           0x0030          /* APビットが011 */
     257#define ARMV6_MMU_DSCR2_AP101           0x0210          /* APビットが101 */
     258#define ARMV6_MMU_DSCR2_AP110           0x0220          /* APビットが110 */
     259#define ARMV6_MMU_DSCR2_AP111           0x0230          /* APビットが111 */
    244260
    245261/* ラージページのディスクリプタ用 */
     
    318334
    319335/*
    320  *  プロセッサ番号の取得
     336 *  自プロセッサのインデックス(0オリジン)の取得
    321337 *
    322  *  マルチプロセッサアフィニティレジスタを読んで,その下位8ビットを返す.
    323  *  ARMv6では,マルチプロセッサをサポートしている場合にのみ使用できる.
     338 *  マルチプロセッサアフィニティレジスタを読んで,その下位8ビットを返
     339 *  す.ARMv6では,マルチプロセッサをサポートしている場合にのみ使用で
     340 *  きる.
    324341 */
    325342#if __TARGET_ARCH_ARM >= 6
    326343
    327 Inline uint32_t
    328 arm_prc_index(void)
     344Inline uint_t
     345get_my_prcidx(void)
    329346{
    330347        uint32_t        reg;
    331348
    332349        CP15_READ_MPIDR(reg);
    333         return(reg & 0xffU);
     350        return((uint_t)(reg & 0xffU));
    334351}
    335352
     
    444461
    445462#endif /* TOPPERS_MACRO_ONLY */
     463
     464/*
     465 *  浮動小数点例外制御レジスタ(FPEXC)の設定値
     466 */
     467#define FPEXC_ENABLE            UINT_C(0x40000000)
     468
    446469#endif /* TOPPERS_ARM_H */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/arm_insn.h

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    105105 *  Thumbモードではmrs/msr命令が使用できないため,関数として実現して,
    106106 *  ARMモードに移行して実行する.
     107 *
     108 *  current_cpsrとset_cpsrは,__thumb__が定義されない場合にはヘッダファ
     109 *  イル中で定義されるインライン関数になるため,core_rename.defに登録
     110 *  せず,先頭の_kernel_を手書きしている.
    107111 */
    108112
     
    110114 *  ステータスレジスタ(CPSR)の現在値の読出し
    111115 */
    112 extern uint32_t current_cpsr(void);
     116extern uint32_t _kernel_current_cpsr(void);
     117#define current_cpsr()  _kernel_current_cpsr()
    113118
    114119/*
    115120 *  ステータスレジスタ(CPSR)の現在値の変更
    116121 */
    117 extern void set_cpsr(uint32_t cpsr);
     122extern void _kernel_set_cpsr(uint32_t cpsr);
     123#define set_cpsr(cpsr)  _kernel_set_cpsr(cpsr)
    118124
    119125#endif /* __thumb__ */
     
    220226#define CP15_READ_ACTLR(reg)    Asm("mrc p15, 0, %0, c1, c0, 1":"=r"(reg))
    221227#define CP15_WRITE_ACTLR(reg)   Asm("mcr p15, 0, %0, c1, c0, 1"::"r"(reg))
     228
     229/* コプロセッサアクセス制御レジスタ */
     230#define CP15_READ_CPACR(reg)    Asm("mrc p15, 0, %0, c1, c0, 2":"=r"(reg))
     231#define CP15_WRITE_CPACR(reg)   Asm("mcr p15, 0, %0, c1, c0, 2"::"r"(reg))
    222232
    223233/*
     
    293303
    294304/* ドメインアクセス制御レジスタ */
    295 #define CP15_WRITE_DACR(reg)    Asm("mcr p15, 0, %0, c3, c0, 0":: "r"(reg))
     305#define CP15_WRITE_DACR(reg)    Asm("mcr p15, 0, %0, c3, c0, 0"::"r"(reg))
    296306
    297307/* コンテキストIDレジスタ(ARMv6以降)*/
    298308#if __TARGET_ARCH_ARM >= 6
    299 #define CP15_WRITE_CONTEXTIDR(reg) Asm("mcr p15, 0, %0, c13, c0, 1" ::"r"(reg))
     309#define CP15_WRITE_CONTEXTIDR(reg) Asm("mcr p15, 0, %0, c13, c0, 1"::"r"(reg))
    300310#endif /* __TARGET_ARCH_ARM >= 6 */
    301311
     
    415425
    416426#endif /* __TARGET_ARCH_ARM == 7 */
     427
     428/*
     429 *  浮動小数点例外制御レジスタ(FPEXC)の現在値の読出し
     430 */
     431Inline uint32_t
     432current_fpexc(void)
     433{
     434        uint32_t        fpexc;
     435
     436        Asm("vmrs %0, fpexc" : "=r"(fpexc));
     437        return(fpexc);
     438}
     439
     440/*
     441 *  浮動小数点例外制御レジスタ(FPEXC)の現在値の変更
     442 */
     443Inline void
     444set_fpexc(uint32_t fpexc)
     445{
     446        Asm("vmsr fpexc, %0" : : "r"(fpexc));
     447}
     448
    417449#endif /* TOPPERS_ARM_INSN_H */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_cfg1_out.h

    r321 r429  
    55 */
    66
    7 /*
    8  *  cfg1_out.cのリンクに必要な定義
    9  */
    10 
    117#include <kernel.h>
    128
    13 void sta_ker(void){}
     9void sta_ker(void) { }
    1410STK_T *const    _kernel_istkpt;
    15 
    16 /*
    17  *  offset.hを生成するための定義
    18  */
    19 const uint8_t   MAGIC_1 = 0x12;
    20 const uint16_t  MAGIC_2 = 0x1234;
    21 const uint32_t  MAGIC_4 = 0x12345678;
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_check.trb

    r321 r429  
    33#               パス3の生成スクリプトのコア依存部(ARM用)
    44#
    5 #  $Id$
     5#  $Id: core_check.trb 730 2016-04-03 02:04:52Z ertl-hiro $
    66#
    77
     
    2020inhTable = SYMBOL("_kernel_inh_table")
    2121offset = SYMBOL("__etext") - SYMBOL("__data_start__")
    22 $cfgData[:DEF_INH].each do |key, params|
     22$cfgData[:DEF_INH].each do |_, params|
    2323  inthdr = PEEK(inhTable + offset + params[:inhno] * $sizeof_FP, $sizeof_FP)
    2424
     
    3939#
    4040excTable = SYMBOL("_kernel_exc_table")
    41 $cfgData[:DEF_EXC].each do |key, params|
     41$cfgData[:DEF_EXC].each do |_, params|
    4242  exchdr = PEEK(excTable + params[:excno] * $sizeof_FP, $sizeof_FP)
    4343
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_kernel.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2004-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5353
    5454/*
     55 *  ターゲット定義のタスク属性
     56 */
     57#define TA_FPU          UINT_C(0x08)    /* FPUレジスタをコンテキストに含める */
     58
     59/*
    5560 *  スタックの型
    5661 *
     
    6267 *  CPU例外ハンドラ番号の数
    6368 */ 
    64 #define TNUM_EXCNO              6
     69#define TNUM_EXCNO              7
    6570
    6671/*
    6772 *  CPU例外ハンドラ番号の定義
    6873 */
    69 #define EXCNO_UNDEF             0
    70 #define EXCNO_SVC               1
    71 #define EXCNO_PABORT    2
    72 #define EXCNO_DABORT    3
    73 #define EXCNO_IRQ               4
    74 #define EXCNO_FIQ               5
     74#define EXCNO_UNDEF             UINT_C(0)               /* 未定義命令 */
     75#define EXCNO_SVC               UINT_C(1)               /* スーパバイザコール */
     76#define EXCNO_PABORT    UINT_C(2)               /* プリフェッチアボート */
     77#define EXCNO_DABORT    UINT_C(3)               /* データアボート */
     78#define EXCNO_IRQ               UINT_C(4)               /* IRQ割込み */
     79#define EXCNO_FIQ               UINT_C(5)               /* FIQ割込み */
     80#define EXCNO_FATAL             UINT_C(6)               /* フェイタルデータアボート */
    7581
    7682#ifndef TOPPERS_MACRO_ONLY
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_kernel.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    3838#   の責任を負わない.
    3939#
    40 #   $Id$
     40#   $Id: core_kernel.trb 662 2016-02-27 02:33:51Z ertl-hiro $
    4141#
    4242
     
    4848#  有効なCPU例外ハンドラ番号
    4949#
    50 $EXCNO_VALID = [ 0, 1, 2, 3, 4, 5 ]
     50$EXCNO_VALID = [ 0, 1, 2, 3, 4, 5, 6 ]
    5151
    5252#
    5353#  DEF_EXCで使用できるCPU例外ハンドラ番号
    5454#
    55 $EXCNO_DEFEXC_VALID = [ 0, 1, 2, 3, 5 ]
     55$EXCNO_DEFEXC_VALID = [ 0, 1, 2, 3, 5, 6 ]
    5656
    5757#
     
    6565$kernelCfgC.comment_header("Interrupt Handler Table")
    6666
    67 $kernelCfgC.add("FP _kernel_inh_table[TNUM_INHNO] = {")
     67$kernelCfgC.add("/*const*/FP _kernel_inh_table[TNUM_INHNO] = {")
    6868$INHNO_VALID.each_with_index do |inhnoVal, index|
    6969  $kernelCfgC.add(",") if index > 0
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_kernel_impl.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    7373 */
    7474Inline void
    75 config_section_entry(ARM_MMU_CONFIG *p_ammuc)
     75config_section_entry(const ARM_MMU_CONFIG *p_ammuc)
    7676{
    7777        uint32_t        vaddr = p_ammuc->vaddr;
     
    8080        uint_t          i;
    8181
     82        assert(vaddr % ARM_SECTION_SIZE == 0);
     83        assert(paddr % ARM_SECTION_SIZE == 0);
     84        assert(size % ARM_SECTION_SIZE == 0);
    8285        while (size > 0) {
    8386#ifdef USE_ARM_SSECTION
     
    170173
    171174/*
     175 *  FPUの初期化
     176 */
     177#ifdef USE_ARM_FPU
     178
     179void
     180arm_fpu_initialize(void)
     181{
     182        uint32_t        reg;
     183
     184        /*
     185         *  CP10とCP11をアクセス可能に設定する.
     186         */
     187        CP15_READ_CPACR(reg);
     188        reg |= (CP15_CPACR_CP10_FULLACCESS | CP15_CPACR_CP11_FULLACCESS);
     189        CP15_WRITE_CPACR(reg);
     190
     191        /*
     192         *  FPUをディスエーブルする.
     193         */
     194        set_fpexc(current_fpexc() & ~FPEXC_ENABLE);
     195}
     196
     197#endif /* USE_ARM_FPU */
     198
     199/*
    172200 *  コア依存の初期化
    173201 */
     
    187215        arm_mmu_initialize();
    188216#endif /* USE_ARM_MMU */
     217
     218        /*
     219         *  FPUの初期化
     220         */
     221#ifdef USE_ARM_FPU
     222        arm_fpu_initialize();
     223#endif /* USE_ARM_FPU */
    189224
    190225        /*
     
    306341                syslog_0(LOG_EMERG, "FIQ exception occurs.");
    307342                break;
     343        case EXCNO_FATAL:
     344                syslog_0(LOG_EMERG, "Fatal Data Abort exception occurs.");
     345                break;
    308346        }
    309347        xlog_sys(p_excinf);
    310348
    311         if (excno == EXCNO_PABORT || excno == EXCNO_DABORT) {
     349        if (excno == EXCNO_PABORT || excno == EXCNO_DABORT
     350                                                                                || excno == EXCNO_FATAL) {
    312351                uint32_t        fsr, far;
    313352
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_kernel_impl.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5555
    5656/*
     57 *  ターゲット依存のタスク属性(エラーチェック用)
     58 */
     59/*#ifdef USE_ARM_FPU*/
     60#define TARGET_TSKATR           (TA_FPU)
     61/*#endif /* USE_ARM_FPU */
     62
     63/*
    5764 *  エラーチェック方法の指定
    5865 */
     
    6875#define CHECK_MPF_ALIGN         4               /* 固定長メモリプール領域のアライン単位 */
    6976#define CHECK_MPF_NONNULL                       /* 固定長メモリプール領域の非NULLチェック */
     77#define CHECK_MPK_ALIGN         4               /* カーネルメモリプール領域のアライン単位 */
     78#define CHECK_MPK_NONNULL                       /* カーネルメモリプール領域の非NULL  */
     79                                                                        /*                                                      チェック */
    7080#define CHECK_MB_ALIGN          4               /* 管理領域のアライン単位 */
    7181
     
    269279 *  非タスクコンテキストからのディスパッチ要求
    270280 */
    271 #define request_dispatch()
     281#define request_dispatch_retint()
    272282
    273283/*
     
    324334 *  割込みハンドラテーブル(kernel_cfg.c)
    325335 */
    326 extern FP inh_table[TNUM_INHNO];
     336extern /*const*/FP inh_table[TNUM_INHNO];
    327337
    328338/*
     
    447457 *  MMUの設定情報(メモリエリアの情報)(target_kernel_impl.c)
    448458 */
    449 extern ARM_MMU_CONFIG arm_memory_area[];
     459extern const ARM_MMU_CONFIG arm_memory_area[];
    450460
    451461/*
     
    458468
    459469#ifndef TOPPERS_MACRO_ONLY
     470
     471/*
     472 *  FPUの初期化
     473 */
     474#ifdef USE_ARM_FPU
     475extern void arm_fpu_initialize(void);
     476#endif /* USE_ARM_FPU */
    460477
    461478/*
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_offset.trb

    r321 r429  
    33#               オフセットファイル生成用Rubyテンプレート(ARM用)
    44#
    5 #  $Id$
     5#  $Id: core_offset.trb 572 2016-02-01 14:40:09Z ertl-hiro $
    66#
    77
     
    1414#  フィールドのオフセットの定義の生成
    1515#
    16 GenerateDefine("TCB_p_tinib", $offsetof_TCB_p_tinib)
    17 GenerateDefine("TCB_sp", $offsetof_TCB_sp)
    18 GenerateDefine("TCB_pc", $offsetof_TCB_pc)
    19 GenerateDefine("TINIB_exinf", $offsetof_TINIB_exinf)
    20 GenerateDefine("TINIB_task", $offsetof_TINIB_task)
    21 GenerateDefine("TINIB_stksz", $offsetof_TINIB_stksz)
    22 GenerateDefine("TINIB_stk", $offsetof_TINIB_stk)
    23 GenerateDefine("T_EXCINF_cpsr", $offsetof_T_EXCINF_cpsr)
     16$offsetH.append(<<EOS)
     17#define TCB_p_tinib             #{$offsetof_TCB_p_tinib}
     18#define TCB_sp                  #{$offsetof_TCB_sp}
     19#define TCB_pc                  #{$offsetof_TCB_pc}
     20#define TINIB_tskatr    #{$offsetof_TINIB_tskatr}
     21#define TINIB_exinf             #{$offsetof_TINIB_exinf}
     22#define TINIB_task              #{$offsetof_TINIB_task}
     23#define TINIB_stksz             #{$offsetof_TINIB_stksz}
     24#define TINIB_stk               #{$offsetof_TINIB_stk}
     25#define T_EXCINF_cpsr   #{$offsetof_T_EXCINF_cpsr}
     26EOS
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_rename.def

    r331 r429  
    1616dabort_handler
    1717fiq_handler
    18 current_cpsr
    19 set_cpsr
    2018
    2119# core_kernel_impl.c
    2220excpt_nest_count
    2321arm_mmu_initialize
     22arm_fpu_initialize
    2423core_initialize
    2524core_terminate
     
    2827default_int_handler
    2928default_exc_handler
     29
     30# mpcore_kernel_impl.c
     31mpcore_initialize
     32mpcore_terminate
     33
     34# mpcore_timer.c
     35target_hrt_initialize
     36target_hrt_terminate
     37target_hrt_handler
     38target_ovrtimer_initialize
     39target_ovrtimer_terminate
     40target_ovrtimer_handler
    3041
    3142# gic_kernel_impl.c
     
    4758pl310_invalidate_all
    4859pl310_clean_and_invalidate_all
    49 
    50 # target_kernel_impl.c
    51 arm_tnum_memory_area
    52 arm_memory_area
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_rename.h

    r321 r429  
    2525#define dabort_handler                          _kernel_dabort_handler
    2626#define fiq_handler                                     _kernel_fiq_handler
    27 #define current_cpsr                            _kernel_current_cpsr
    28 #define set_cpsr                                        _kernel_set_cpsr
    2927
    3028/*
     
    3331#define excpt_nest_count                        _kernel_excpt_nest_count
    3432#define arm_mmu_initialize                      _kernel_arm_mmu_initialize
     33#define arm_fpu_initialize                      _kernel_arm_fpu_initialize
    3534#define core_initialize                         _kernel_core_initialize
    3635#define core_terminate                          _kernel_core_terminate
     
    3938#define default_int_handler                     _kernel_default_int_handler
    4039#define default_exc_handler                     _kernel_default_exc_handler
     40
     41/*
     42 *  mpcore_kernel_impl.c
     43 */
     44#define mpcore_initialize                       _kernel_mpcore_initialize
     45#define mpcore_terminate                        _kernel_mpcore_terminate
     46
     47/*
     48 *  mpcore_timer.c
     49 */
     50#define target_hrt_initialize           _kernel_target_hrt_initialize
     51#define target_hrt_terminate            _kernel_target_hrt_terminate
     52#define target_hrt_handler                      _kernel_target_hrt_handler
     53#define target_ovrtimer_initialize      _kernel_target_ovrtimer_initialize
     54#define target_ovrtimer_terminate       _kernel_target_ovrtimer_terminate
     55#define target_ovrtimer_handler         _kernel_target_ovrtimer_handler
    4156
    4257/*
     
    6580#define pl310_clean_and_invalidate_all  _kernel_pl310_clean_and_invalidate_all
    6681
    67 /*
    68  *  target_kernel_impl.c
    69  */
    70 #define arm_tnum_memory_area            _kernel_arm_tnum_memory_area
    71 #define arm_memory_area                         _kernel_arm_memory_area
    72 
    7382
    7483#endif /* TOPPERS_CORE_RENAME_H */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_sil.h

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2004-2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    8686 *  ステータスレジスタ(CPSR)の現在値の読出し
    8787 */
    88 extern uint32_t current_cpsr(void);
    89 #define TOPPERS_current_cpsr()  current_cpsr()
     88extern uint32_t _kernel_current_cpsr(void);
     89#define TOPPERS_current_cpsr()  _kernel_current_cpsr()
    9090
    9191/*
    9292 *  ステータスレジスタ(CPSR)の現在値の変更
    9393 */
    94 extern void set_cpsr(uint32_t cpsr);
    95 #define TOPPERS_set_cpsr(cpsr)  current_cpsr(cpsr)
     94extern void _kernel_set_cpsr(uint32_t cpsr);
     95#define TOPPERS_set_cpsr(cpsr)  _kernel_set_cpsr(cpsr)
    9696
    9797#endif /* __thumb__ */
     
    138138#define SIL_UNL_INT()   (TOPPERS_set_fiq_irq(TOPPERS_fiq_irq_mask))
    139139
     140/*
     141 *  メモリ同期バリア
     142 */
     143#ifdef DATA_SYNC_BARRIER
     144#define TOPPERS_SIL_WRITE_SYNC()        DATA_SYNC_BARRIER()
     145#elif __TARGET_ARCH_ARM <= 6
     146#define TOPPERS_SIL_WRITE_SYNC() \
     147                                                Asm("mcr p15, 0, %0, c7, c10, 4"::"r"(0):"memory")
     148#else /* __TARGET_ARCH_ARM <= 6 */
     149#define TOPPERS_SIL_WRITE_SYNC()        Asm("dsb":::"memory")
     150#endif
     151
    140152#endif /* TOPPERS_MACRO_ONLY */
    141153#endif /* TOPPERS_CORE_SIL_H */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_support.S

    r331 r429  
    66 *  Copyright (C) 2000-2004 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2006-2017 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5555
    5656/*
     57 *  使用する命令セットの定義
     58 */
     59#ifdef USE_ARM_FPU
     60        .fpu    vfpv3
     61#endif /* USE_ARM_FPU */
     62
     63/*
    5764 *  例外ベクタ
    5865 */
     
    101108         *  マスク全解除状態・ディスパッチ許可状態で呼び出される.
    102109         */
    103         push    {r12,lr}                                /* 戻り番地を保存,r12はダミー */
     110        push    {r12,lr}                                /* 戻り番地(lr)を保存 */
     111                                                                        /* r12はアラインメントのため */
    104112#ifdef TOPPERS_SUPPORT_OVRHDR
    105113        bl              ovrtimer_stop
    106114#endif /* TOPPERS_SUPPORT_OVRHDR */
    107         stmfd   sp!, {r4-r11}                   /* 非スクラッチレジスタの保存 */
     115        push    {r4-r11}                                /* 非スクラッチレジスタの保存 */
    108116        ldr             r0, =p_runtsk                   /* p_runtsk → r0 */
    109117        ldr             r0, [r0]
     118#ifdef USE_ARM_FPU
     119        ldr             r2, [r0,#TCB_p_tinib]   /* p_runtsk->p_tinib → r2 */
     120        ldr             r1, [r2,#TINIB_tskatr]  /* p_runtsk->p_tinib->tskatr → r1 */
     121        tst             r1, #TA_FPU
     122        beq             1f
     123        vpush   {d8-d15}                                /* 非スクラッチFPUレジスタの保存 */
     1241:
     125#endif /* USE_ARM_FPU */
    110126        str             sp, [r0,#TCB_sp]                /* スタックポインタを保存 */
    111127        adr             r1, dispatch_r
     
    114130
    115131ALABEL(dispatch_r)
    116         ldmfd   sp!, {r4-r11}                   /* 非スクラッチレジスタの復帰 */
     132        /*
     133         * 【この時点のレジスタ状態】
     134         *  r4:p_runtsk(タスク切換え後)
     135         */
     136#ifdef USE_ARM_FPU
     137        ldr             r2, [r4,#TCB_p_tinib]   /* p_runtsk->p_tinib → r2 */
     138        ldr             r1, [r2,#TINIB_tskatr]  /* p_runtsk->p_tinib->tskatr → r1 */
     139        tst             r1, #TA_FPU
     140        vmrs    r0, fpexc
     141        biceq   r0, r0, #FPEXC_ENABLE
     142        orrne   r0, r0, #FPEXC_ENABLE
     143        vmsr    fpexc, r0                               /* FPEXCを設定 */
     144        beq             1f
     145        vpop    {d8-d15}                                /* 非スクラッチFPUレジスタの復帰 */
     1461:
     147#endif /* USE_ARM_FPU */
     148        pop             {r4-r11}                                /* 非スクラッチレジスタの復帰 */
    117149#ifdef TOPPERS_SUPPORT_OVRHDR
    118150        bl              ovrtimer_start
     
    137169
    138170        /*
     171         *  各種のデバイス(特に割込みコントローラ)の設定が完了するのを待つ.
     172         */
     173        asm_data_sync_barrier r0
     174       
     175        /*
    139176         *      タスクコンテキストに切り換える.
    140177         */
     
    184221        bl              log_dsp_enter
    185222#endif /* LOG_DSP_ENTER */
    186        
     223
    187224ALABEL(dispatcher_0)
    188225        /*
     
    232269ALABEL(call_exit_kernel)
    233270        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_INTLOCK)
    234         ldr             r0, =istkpt                             /* 非タスクコンテキストのスタックへ */
     271        ldr             r0, =istkpt                             /* 非タスクコンテキスト用のスタックに */
    235272        ldr             sp, [r0]
     273        ldr             r0, =excpt_nest_count   /* 例外ネストカウントを1に */
     274        mov             r1, #1
     275        str             r1, [r0]
    236276        b               exit_kernel
    237277
     
    243283        AGLOBAL(start_r)
    244284        /*
    245          *  ディスパッチャ本体から呼び出されるため,p_runtskはr4に入っている.
     285         * 【この時点のレジスタ状態】
     286         *  r4:p_runtsk(タスク切換え後)
    246287         */
    247288ALABEL(start_r)
     
    253294        ldr             lr, =ext_tsk                    /* タスク本体からの戻り番地を設定 */
    254295        ldr             r2, [r4,#TCB_p_tinib]   /* p_runtsk->p_tinib → r2 */
     296#ifdef USE_ARM_FPU
     297        ldr             r1, [r2,#TINIB_tskatr]  /* p_runtsk->p_tinib->tskatr → r1 */
     298        tst             r1, #TA_FPU
     299        vmrs    r0, fpexc
     300        biceq   r0, r0, #FPEXC_ENABLE
     301        orrne   r0, r0, #FPEXC_ENABLE
     302        vmsr    fpexc, r0                               /* FPEXCを設定 */
     303#endif /* USE_ARM_FPU */
    255304        ldr             r0, [r2,#TINIB_exinf]   /* exinfをパラメータに */
    256305        ldr             r1, [r2,#TINIB_task]    /* タスク起動番地にジャンプ */
     
    270319#if __TARGET_ARCH_ARM < 6
    271320        /*
    272          *  スーパバイザモードに切り換え,スクラッチレジスタを保存する.
     321         *  スーパバイザモードに切り換え,スクラッチレジスタ+αを保存する.
    273322         */
    274323        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_IRQ_BIT)
    275         stmfd   sp!, {r0-r5,r12,lr,pc}          /* pcはスペース確保のため */
    276 
    277         /*
    278          *  IRQモードに戻して,戻り番地とspsr(戻り先のcpsr)を取得する.
     324        push    {r0-r5,r12,lr,pc}               /* pcはスペース確保のため */
     325
     326        /*
     327         *  IRQモードに戻して,戻り番地(lr-4)と戻り先のcpsr(spsr)を取
     328         *  得する.
    279329         */
    280330        msr             cpsr_c, #(CPSR_IRQ_MODE AOR CPSR_IRQ_BIT)
     
    283333
    284334        /*
    285          *  スーパバイザモードに切り換え,戻り番地とspsrを保存する.
     335         *  スーパバイザモードに切り換え,戻り番地と戻り先のcpsrを保存する.
    286336         */
    287337        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_IRQ_BIT)
    288         str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存 */
    289         push    {r1}                                    /* spsrをスタックに保存 */
     338        str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存(pcの場所)*/
     339        push    {r1}                                    /* 戻り先のcpsrをスタックに保存 */
    290340#else /* __TARGET_ARCH_ARM < 6 */
    291341        /*
    292          *  戻り先(lr)とspsr(cpsr_svc)をスーパバイザモードのスタックに
    293          *  保存する.
     342         *  戻り番地(lr)と戻り先のcpsr(spsr)をスーパバイザモードのスタッ
     343         *  クに保存する.
    294344         */
    295345        sub             lr, lr, #4                              /* 戻り番地の算出 */
     
    297347
    298348        /*
    299          *  スーパバイザモードに切り換え,スクラッチレジスタを保存する.
     349         *  スーパバイザモードに切り換え,スクラッチレジスタ+αを保存する.
    300350         */
    301351        cps             #CPSR_SVC_MODE
    302         stmfd   sp!, {r0-r5,r12,lr}
     352        push    {r0-r5,r12,lr}
    303353#endif /* __TARGET_ARCH_ARM < 6 */
    304354
     
    308358        and             r1, sp, #4
    309359        sub             sp, sp, r1
    310         push    {r0,r1}                                 /* r0はスペース確保のため */
    311 
     360        push    {r0,r1}                                 /* スタックポインタの調整値を保存 */
     361                                                                        /* r0はスペース確保のため */
    312362        /*
    313363         *  例外ネストカウントをインクリメントする.割込みが非タスクコンテキ
     
    328378#endif /* TOPPERS_SUPPORT_OVRHDR */
    329379
     380#ifdef USE_ARM_FPU
     381        /*
     382         *  FPUをディスエーブルする.
     383         */
     384        vmrs    r0, fpexc
     385        str             r0, [sp]                                /* FPEXCを保存(r0の場所)*/
     386        bic             r0, r0, #FPEXC_ENABLE
     387        vmsr    fpexc, r0                               /* FPEXCを設定 */
     388#endif /* USE_ARM_FPU */
     389       
    330390        /*
    331391         *  非タスクコンテキスト用のスタックに切り換える.
     
    339399        /*
    340400         *  割込みコントローラを操作し,割込み番号を取得する.
     401         *
     402         *  irc_begin_intは,スタックトップ(r0の場所)に,irc_end_intで用
     403         *  いる情報を保存する.
    341404         */
    342405        bl              irc_begin_int
     
    345408#else /* TNUM_INHNO <= 256 || __TARGET_ARCH_ARM <= 6 */
    346409        movw    r3, #TNUM_INHNO
    347         cmp             r4, r3                 
     410        cmp             r4, r3
    348411#endif /* TNUM_INHNO <= 256 || __TARGET_ARCH_ARM <= 6 */
    349412        bhs             irq_handler_2                   /* スプリアス割込みなら */
     
    420483        mov     sp, r3
    421484
     485#ifdef USE_ARM_FPU
     486        /*
     487         *  FPUを元に戻す.
     488         */
     489        ldr             r0, [sp]                                /* FPEXCを復帰 */
     490        vmsr    fpexc, r0
     491#endif /* USE_ARM_FPU */
     492       
    422493        /*
    423494         *  p_runtskがNULLか判定する.
     
    433504        pop             {r0,r1}                                 /* スタックポインタの調整を元に戻す */
    434505        add             sp, sp, r1
    435         add             sp, sp, #40                             /* スクラッチレジスタを捨てる */
     506        add             sp, sp, #40                             /* スクラッチレジスタを捨てる */
    436507        b               dispatcher_0
    437508
     
    440511         */
    441512ALABEL(irq_handler_3)
     513        /*
     514         * 【この時点のレジスタ状態】
     515         *  r0:p_runtsk
     516         */
    442517        ldr             r1, =p_schedtsk                 /* p_schedtsk → r1 */
    443518        ldr             r1, [r1]
     
    448523         *  コンテキストを保存する.
    449524         */
    450         stmfd   sp!, {r6-r11}                   /* 非スクラッチレジスタの保存 */
     525        push    {r6-r11}                                /* 残りのレジスタの保存 */
     526#ifdef USE_ARM_FPU
     527        ldr             r2, [r0,#TCB_p_tinib]   /* p_runtsk->p_tinib → r2 */
     528        ldr             r1, [r2,#TINIB_tskatr]  /* p_runtsk->p_tinib->tskatr → r1 */
     529        tst             r1, #TA_FPU
     530        beq             1f                                              /* TA_FPU属性でない場合は分岐 */
     531#ifdef USE_ARM_FPU_D32
     532        vpush   {d16-d31}
     533#endif /* USE_ARM_FPU_D32 */
     534        vpush   {d0-d15}                                /* 全FPUレジスタの保存 */
     535        vmrs    r1, fpscr
     536        push    {r1,r2}                                 /* FPSCRの保存 */
     5371:                                                                      /* r2はアラインメントのため */
     538#endif /* USE_ARM_FPU */
    451539        str             sp, [r0,#TCB_sp]                /* スタックポインタを保存 */
    452540        adr             r1, ret_int_r                   /* 実行再開番地を保存 */
     
    457545        /*
    458546         *  コンテキストを復帰する.
    459          */
    460         ldmfd   sp!, {r6-r11}                   /* 非スクラッチレジスタの復帰 */
     547         *
     548         * 【この時点のレジスタ状態】
     549         *  r4:p_runtsk(タスク切換え後)
     550         */
     551#ifdef USE_ARM_FPU
     552        ldr             r2, [r4,#TCB_p_tinib]   /* p_runtsk->p_tinib → r2 */
     553        ldr             r1, [r2,#TINIB_tskatr]  /* p_runtsk->p_tinib->tskatr → r1 */
     554        tst             r1, #TA_FPU
     555        vmrs    r0, fpexc
     556        biceq   r0, r0, #FPEXC_ENABLE
     557        orrne   r0, r0, #FPEXC_ENABLE
     558        vmsr    fpexc, r0                               /* FPEXCを設定 */
     559        beq             1f                                              /* TA_FPU属性でない場合は分岐 */
     560        pop             {r1,r2}                                 /* FPSCRの復帰 */
     561        vmsr    fpscr, r1
     562        vpop    {d0-d15}                                /* 全FPUレジスタの復帰 */
     563#ifdef USE_ARM_FPU_D32
     564        vpop    {d16-d31}
     565#endif /* USE_ARM_FPU_D32 */
     5661:
     567#endif /* USE_ARM_FPU */
     568        pop             {r6-r11}                                /* 残りのレジスタの復帰 */
    461569
    462570ALABEL(irq_handler_4)
     
    469577
    470578        /*
    471          *  割込み/CPU例外処理からのリターン
     579         *  割込み処理からのリターン
    472580         *
    473          *  割込み/CPU例外処理からのリターンにより,CPUロック解除状態に遷
    474          *  移するようにする必要があるが,ARMはCPSRのビットによってCPUロッ
    475          *  ク状態を表しているため,CPSRを元に戻してリターンすればよい.
     581         *  割込み処理からのリターンにより,CPUロック解除状態に遷移するよ
     582         *  うにする必要があるが,ARMはCPSRのビットによってCPUロック状態を
     583         *  表しているため,CPSRを元に戻してリターンすればよい.
    476584         */
    477585ALABEL(irq_handler_5)
     
    480588
    481589#if __TARGET_ARCH_ARM < 6
    482         ldmfd   sp!, {r0}                               /* 戻り先のcpsrをspsrに設定 */
     590        pop             {r0}                                    /* 戻り先のcpsrをspsrに設定 */
    483591        msr             spsr_cxsf, r0
    484592        ldmfd   sp!, {r0-r5,r12,lr,pc}^ /* コンテキストの復帰 */
    485593                                                                        /* ^付きなので,spsr → cpsr */
    486594#else /* __TARGET_ARCH_ARM < 6 */
    487         ldmfd   sp!, {r0-r5,r12,lr}
     595        pop             {r0-r5,r12,lr}                  /* スクラッチレジスタ+αの復帰 */
    488596        rfefd   sp!
    489597#endif /* __TARGET_ARCH_ARM < 6 */
     
    509617        /*
    510618         *  IビットとFビットをセットし,スーパバイザモードに切り換え,スク
    511          *  ラッチレジスタを保存する.
     619         *  ラッチレジスタ+αを保存する.
    512620         */
    513621        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    514         stmfd   sp!, {r0-r5,r12,lr,pc}          /* pcはスペース確保のため */
    515 
    516         /*
    517          *  未定義モードに戻して,戻り番地とspsrを取得する.
     622        push    {r0-r5,r12,lr,pc}               /* pcはスペース確保のため */
     623
     624        /*
     625         *  未定義モードに戻して,戻り番地(lr)と戻り先のcpsr(spsr)を取
     626         *  得する.
    518627         */
    519628        msr             cpsr_c, #(CPSR_UND_MODE AOR CPSR_FIQ_IRQ_BIT)
     
    522631
    523632        /*
    524          *  スーパバイザモードに切り換え,戻り番地とspsrを保存する.
     633         *  スーパバイザモードに切り換え,戻り番地と戻り先のcpsrを保存する.
    525634         */
    526635        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    527         str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存 */
    528         push    {r1}                                    /* spsrをスタックに保存 */
     636        str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存(pcの場所)*/
     637        push    {r1}                                    /* 戻り先のcpsrをスタックに保存 */
    529638#else /* __TARGET_ARCH_ARM < 6 */
    530639        /*
    531          *  戻り先(lr)とspsr(cpsr_svc)をスーパバイザモードのスタックに
    532          *  保存する.
     640         *  戻り番地(lr)と戻り先のcpsr(spsr)をスーパバイザモードのスタッ
     641         *  クに保存する.
    533642         */
    534643        srsfd   #CPSR_SVC_MODE!
    535644
    536645        /*
    537          *  スーパバイザモードに切り換え,スクラッチレジスタを保存する.
     646         *  スーパバイザモードに切り換え,スクラッチレジスタ+αを保存する.
    538647         */
    539648        cps             #CPSR_SVC_MODE
    540         stmfd   sp!, {r0-r5,r12,lr}
     649        push    {r0-r5,r12,lr}
    541650#endif /* __TARGET_ARCH_ARM < 6 */
    542651        mov             r4, #EXCNO_UNDEF
     
    558667#if __TARGET_ARCH_ARM < 6
    559668        /*
    560          *  IビットとFビットをセットし,スクラッチレジスタを保存する.
     669         *  IビットとFビットをセットし,戻り番地(lr),スクラッチレジスタ
     670         *  +α,戻り先のcpsr(spsr)を保存する(lrは二重に保存される).
    561671         */
    562672        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    563         stmfd   sp!, {r0-r5,r12,lr,pc}          /* pcはスペース確保のため */
    564 
    565         /*
    566          *  戻り番地とspsrを取得する.
    567          */
    568         mov             r2, lr
     673        push    {lr}
     674        push    {r0-r5,r12,lr}
    569675        mrs             r1, spsr
    570 
    571         /*
    572          *  戻り番地とspsrを保存する.
    573          */
    574         str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存 */
    575         push    {r1}                                    /* spsrをスタックに保存 */
     676        push    {r1}
    576677#else /* __TARGET_ARCH_ARM < 6 */
    577678        /*
    578          *  戻り先(lr)とspsr(cpsr_svc)をスーパバイザモードのスタックに
    579          *  保存する.
     679         *  戻り番地(lr)と戻り先のcpsr(spsr)をスーパバイザモードのスタッ
     680         *  クに保存する.
    580681         */
    581682        srsfd   #CPSR_SVC_MODE!
    582683
    583684        /*
    584          *  スーパバイザモードで,スクラッチレジスタを保存する.
    585          */
    586         cps             #CPSR_SVC_MODE                  /* 不要と思われる */
    587         stmfd   sp!, {r0-r5,r12,lr}
     685         *  スーパバイザモードで,スクラッチレジスタ+αを保存する.
     686         */
     687        push    {r0-r5,r12,lr}
    588688#endif /* __TARGET_ARCH_ARM < 6 */
    589689        mov             r4, #EXCNO_SVC
     
    605705        /*
    606706         *  IビットとFビットをセットし,スーパバイザモードに切り換え,スク
    607          *  ラッチレジスタを保存する.
     707         *  ラッチレジスタ+αを保存する.
    608708         */
    609709        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    610         stmfd   sp!, {r0-r5,r12,lr,pc}          /* pcはスペース確保のため */
    611 
    612         /*
    613          *  アボートモードに戻して,戻り番地とspsrを取得する.
     710        push    {r0-r5,r12,lr,pc}               /* pcはスペース確保のため */
     711
     712        /*
     713         *  アボートモードに戻して,戻り番地(lr)と戻り先のcpsr(spsr)を
     714         *  取得する.
    614715         */
    615716        msr             cpsr_c, #(CPSR_ABT_MODE AOR CPSR_FIQ_IRQ_BIT)
     
    618719
    619720        /*
    620          *  スーパバイザモードに切り換え,戻り番地とspsrを保存する.
     721         *  スーパバイザモードに切り換え,戻り番地と戻り先のcpsrを保存する.
    621722         */
    622723        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    623         str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存 */
    624         push    {r1}                                    /* spsrをスタックに保存 */
     724        str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存(pcの場所)*/
     725        push    {r1}                                    /* 戻り先のcpsrをスタックに保存 */
    625726#else /* __TARGET_ARCH_ARM < 6 */
    626727        /*
    627          *  戻り先(lr)とspsr(cpsr_svc)をスーパバイザモードのスタックに
    628          *  保存する.
     728         *  戻り番地(lr)と戻り先のcpsr(spsr)をスーパバイザモードのスタッ
     729         *  クに保存する.
    629730         */
    630731        srsfd   #CPSR_SVC_MODE!
    631732
    632733        /*
    633          *  スーパバイザモードに切り換え,スクラッチレジスタを保存する.
     734         *  スーパバイザモードに切り換え,スクラッチレジスタ+αを保存する.
    634735         */
    635736        cps             #CPSR_SVC_MODE
    636         stmfd   sp!, {r0-r5,r12,lr}
     737        push    {r0-r5,r12,lr}
    637738#endif /* __TARGET_ARCH_ARM < 6 */
    638739        mov             r4, #EXCNO_PABORT
     
    653754         *  データアボートが,CPU例外の入口(start_exc_entryとend_exc_entry
    654755         *  の間)で発生した場合には,fatal_dabort_handlerに分岐する.アボー
    655          *  トモードのspを汎用レジスタの代わりに使用する
    656          */
    657         ldr             sp, =start_exc_entry+8
    658         cmp             lr, sp
     756         *  トモードのspを汎用レジスタの代わりに使用する(r13と記述している)
     757         */
     758        adr             r13, start_exc_entry+8
     759        cmp             lr, r13
    659760        bcc             dabort_handler_1
    660         ldr             sp, =end_exc_entry+8
    661         cmp             lr, sp
     761        adr             r13, end_exc_entry+8
     762        cmp             lr, r13
    662763        bcc             fatal_dabort_handler
    663764
     
    666767        /*
    667768         *  IビットとFビットをセットし,スーパバイザモードに切り換え,スク
    668          *  ラッチレジスタを保存する.
     769         *  ラッチレジスタ+αを保存する.
    669770         */
    670771        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    671         stmfd   sp!, {r0-r5,r12,lr,pc}          /* pcはスペース確保のため */
    672 
    673         /*
    674          *  アボートモードに戻して,戻り番地とspsrを取得する.
     772        push    {r0-r5,r12,lr,pc}               /* pcはスペース確保のため */
     773
     774        /*
     775         *  アボートモードに戻して,戻り番地(lr)と戻り先のcpsr(spsr)を
     776         *  取得する.
    675777         */
    676778        msr             cpsr_c, #(CPSR_ABT_MODE AOR CPSR_FIQ_IRQ_BIT)
     
    679781
    680782        /*
    681          *  スーパバイザモードに切り換え,戻り番地とspsrを保存する.
     783         *  スーパバイザモードに切り換え,戻り番地と戻り先のcpsrを保存する.
    682784         */
    683785        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    684         str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存 */
    685         push    {r1}                                    /* spsrをスタックに保存 */
     786        str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存(pcの場所)*/
     787        push    {r1}                                    /* 戻り先のcpsrをスタックに保存 */
    686788#else /* __TARGET_ARCH_ARM < 6 */
    687789        /*
    688          *  戻り先(lr)とspsr(cpsr_svc)をスーパバイザモードのスタックに
    689          *  保存する.
     790         *  戻り番地(lr)と戻り先のcpsr(spsr)をスーパバイザモードのスタッ
     791         *  クに保存する.
    690792         */
    691793        srsfd   #CPSR_SVC_MODE!
    692794
    693795        /*
    694          *  スーパバイザモードに切り換え,スクラッチレジスタを保存する.
     796         *  スーパバイザモードに切り換え,スクラッチレジスタ+αを保存する.
    695797         */
    696798        cps             #CPSR_SVC_MODE
    697         stmfd   sp!, {r0-r5,r12,lr}
     799        push    {r0-r5,r12,lr}
    698800#endif /* __TARGET_ARCH_ARM < 6 */
    699801        mov             r4, #EXCNO_DABORT
    700802        b               exc_handler_1
    701 #endif /* OMIT_DABORT_HANDLER */
    702803
    703804/*
     
    708809        /*
    709810         *  IビットとFビットをセットし,スーパバイザモードに切り換え,スタッ
    710          *  クポインタを初期化し,スクラッチレジスタを保存する.
     811         *  クポインタを初期化し,スクラッチレジスタ+αを保存する.
    711812         */
    712813        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    713814        ldr             sp, =istkpt
    714815        ldr             sp, [sp]
    715         stmfd   sp!, {r0-r5,r12,lr,pc}          /* pcはスペース確保のため */
    716 
    717         /*
    718          *  アボートモードに戻して,戻り番地とspsrを取得する.
     816        push    {r0-r5,r12,lr,pc}               /* pcはスペース確保のため */
     817
     818        /*
     819         *  アボートモードに戻して,戻り番地(lr)と戻り先のcpsr(spsr)を
     820         *  取得する.
    719821         */
    720822        msr             cpsr_c, #(CPSR_ABT_MODE AOR CPSR_FIQ_IRQ_BIT)
     
    723825
    724826        /*
    725          *  スーパバイザモードに切り換え,戻り番地とspsrを保存する.
     827         *  スーパバイザモードに切り換え,戻り番地と戻り先のcpsrを保存する.
    726828         */
    727829        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    728         str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存 */
    729         push    {r1}                                    /* spsrをスタックに保存 */
     830        str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存(pcの場所)*/
     831        push    {r1}                                    /* 戻り先のcpsrをスタックに保存 */
    730832#else /* __TARGET_ARCH_ARM < 6 */
    731833        /*
     
    738840
    739841        /*
    740          *  アボートモードに戻して,戻り先(lr)とspsr(cpsr_svc)をスーパ
    741          *  バイザモードのスタックに保存する.
     842         *  アボートモードに戻して,戻り番地(lr)と戻り先のcpsr(spsr)を
     843         *  スーパバイザモードのスタックに保存する.
    742844         */
    743845        cps             #CPSR_ABT_MODE
     
    745847
    746848        /*
    747          *  スーパバイザモードに切り換え,スクラッチレジスタを保存する.
     849         *  スーパバイザモードに切り換え,スクラッチレジスタ+αを保存する.
    748850         */
    749851        cps             #CPSR_SVC_MODE
    750         stmfd   sp!, {r0-r5,r12,lr}
     852        push    {r0-r5,r12,lr}
    751853#endif /* __TARGET_ARCH_ARM < 6 */
    752854
    753855        /*
    754          *  例外ネストカウントの最上位ビットを1にする.
     856         *  例外ネストカウントをインクリメントする.
    755857         */
    756858        ldr             r2, =excpt_nest_count
    757859        ldr             r3, [r2]
    758         orr             r3, r3, #0x80000000
     860        add             r3, r3, #1
    759861        str             r3, [r2]
    760862
    761         mov             r4, #EXCNO_DABORT
     863        mov             r4, #EXCNO_FATAL
    762864        b               exc_handler_1
     865#endif /* OMIT_DABORT_HANDLER */
    763866
    764867/*
     
    776879        /*
    777880         *  IビットとFビットをセットし,スーパバイザモードに切り換え,スク
    778          *  ラッチレジスタを保存する.
     881         *  ラッチレジスタ+αを保存する.
    779882         */
    780883        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    781         stmfd   sp!, {r0-r5,r12,lr,pc}          /* pcはスペース確保のため */
    782 
    783         /*
    784          *  FIQモードに戻して,戻り番地とspsrを取得する.
     884        push    {r0-r5,r12,lr,pc}               /* pcはスペース確保のため */
     885
     886        /*
     887         *  FIQモードに戻して,戻り番地(lr)と戻り先のcpsr(spsr)を取得
     888         *  する.
    785889         */
    786890        msr             cpsr_c, #(CPSR_FIQ_MODE AOR CPSR_FIQ_IRQ_BIT)
     
    789893
    790894        /*
    791          *  スーパバイザモードに切り換え,戻り番地とspsrを保存する.
     895         *  スーパバイザモードに切り換え,戻り番地と戻り先のcpsrを保存する.
    792896         */
    793897        msr             cpsr_c, #(CPSR_SVC_MODE AOR CPSR_FIQ_IRQ_BIT)
    794         str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存 */
    795         push    {r1}                                    /* spsrをスタックに保存 */
     898        str             r2, [sp,#0x20]                  /* 戻り番地をスタックに保存(pcの場所)*/
     899        push    {r1}                                    /* 戻り先のcpsrをスタックに保存 */
    796900#else /* __TARGET_ARCH_ARM < 6 */
    797901        /*
    798          *  戻り先(lr)とspsr(cpsr_svc)をスーパバイザモードのスタックに
    799          *  保存する.
     902         *  戻り番地(lr)と戻り先のcpsr(spsr)をスーパバイザモードのスタッ
     903         *  クに保存する.
    800904         */
    801905        srsfd   #CPSR_SVC_MODE!
    802906
    803907        /*
    804          *  スーパバイザモードに切り換え,スクラッチレジスタを保存する.
     908         *  スーパバイザモードに切り換え,スクラッチレジスタ+αを保存する.
    805909         */
    806910        cps             #CPSR_SVC_MODE
    807         stmfd   sp!, {r0-r5,r12,lr}
     911        push    {r0-r5,r12,lr}
    808912#endif /* __TARGET_ARCH_ARM < 6 */
    809913        mov             r4, #EXCNO_FIQ
    810914        b               exc_handler_1
    811915#endif /* OMIT_FIQ_HANDLER */
    812        
     916
    813917ALABEL(end_exc_entry)
    814918
    815919/*
    816920 *  CPU例外ハンドラ出入口処理の共通部分
    817  *
    818  * 【この時点のレジスタ状態】
    819  *  r4:CPU例外ハンドラ番号
    820921 */
    821922ALABEL(exc_handler_1)
    822923        /*
     924         * 【この時点のレジスタ状態】
     925         *  r4:CPU例外ハンドラ番号
     926         *
    823927         *  CPU例外が発生した状況の判断に用いるために,CPU例外発生前の割
    824928         *  込み優先度マスクと例外ネストカウントをスタックに保存する.
     
    836940        and             r1, sp, #4
    837941        sub             sp, sp, r1
    838         push    {r0,r1}                                 /* r0はスペース確保のため */
    839 
     942        push    {r0,r1}                                 /* スタックポインタの調整値を保存 */
     943                                                                        /* r0はスペース確保のため */
    840944        /*
    841945         *  カーネル管理外のCPU例外か判定する
     
    873977#endif /* TOPPERS_SUPPORT_OVRHDR */
    874978
     979#ifdef USE_ARM_FPU
     980        /*
     981         *  FPUをディスエーブルする.
     982         */
     983        vmrs    r0, fpexc
     984        str             r0, [sp]                                /* FPEXCを保存(r0の場所)*/
     985        bic             r0, r0, #FPEXC_ENABLE
     986        vmsr    fpexc, r0                               /* FPEXCを設定 */
     987#endif /* USE_ARM_FPU */
     988       
    875989        /*
    876990         *  非タスクコンテキスト用のスタックに切り換える.
     
    8901004        /*
    8911005         *  (必要なら)割込みコントローラを操作する.
     1006         *
     1007         *  irc_begin_excは,スタックトップ(r0の場所)に,irc_end_excで用
     1008         *  いる情報を保存する.
    8921009         */
    8931010        bl              irc_begin_exc
     
    9701087        mov             sp, r3
    9711088
     1089#ifdef USE_ARM_FPU
     1090        /*
     1091         *  FPUを元に戻す.
     1092         */
     1093        ldr             r0, [sp]                                /* FPEXCを復帰 */
     1094        vmsr    fpexc, r0
     1095#endif /* USE_ARM_FPU */
     1096       
    9721097        /*
    9731098         *  p_runtskがNULLか判定する.
     
    9901115         */
    9911116ALABEL(exc_handler_3)
     1117        /*
     1118         * 【この時点のレジスタ状態】
     1119         *  r0:p_runtsk
     1120         */
    9921121        ldr             r1, =p_schedtsk                 /* p_schedtsk → r1 */
    9931122        ldr             r1, [r1]
     
    9981127         *  コンテキストを保存する.
    9991128         */
    1000         stmfd   sp!, {r6-r11}                   /* 非スクラッチレジスタの保存 */
     1129        push    {r6-r11}                                /* 残りのレジスタの保存 */
     1130#ifdef USE_ARM_FPU
     1131        ldr             r2, [r0,#TCB_p_tinib]   /* p_runtsk->p_tinib → r2 */
     1132        ldr             r1, [r2,#TINIB_tskatr]  /* p_runtsk->p_tinib->tskatr → r1 */
     1133        tst             r1, #TA_FPU
     1134        beq             1f                                              /* TA_FPU属性でない場合は分岐 */
     1135#ifdef USE_ARM_FPU_D32
     1136        vpush   {d16-d31}
     1137#endif /* USE_ARM_FPU_D32 */
     1138        vpush   {d0-d15}                                /* 全FPUレジスタの保存 */
     1139        vmrs    r1, fpscr
     1140        push    {r1,r2}                                 /* FPSCRの保存 */
     11411:                                                                      /* r2はアラインメントのため */
     1142#endif /* USE_ARM_FPU */
    10011143        str             sp, [r0,#TCB_sp]                /* スタックポインタを保存 */
    10021144        adr             r1, ret_exc_r                   /* 実行再開番地を保存 */
     
    10071149        /*
    10081150         *  コンテキストを復帰する.
    1009          */
    1010         ldmfd   sp!, {r6-r11}                   /* 非スクラッチレジスタの復帰 */
     1151         *
     1152         * 【この時点のレジスタ状態】
     1153         *  r4:p_runtsk(タスク切換え後)
     1154         */
     1155#ifdef USE_ARM_FPU
     1156        ldr             r2, [r4,#TCB_p_tinib]   /* p_runtsk->p_tinib → r2 */
     1157        ldr             r1, [r2,#TINIB_tskatr]  /* p_runtsk->p_tinib->tskatr → r1 */
     1158        tst             r1, #TA_FPU
     1159        vmrs    r0, fpexc
     1160        biceq   r0, r0, #FPEXC_ENABLE
     1161        orrne   r0, r0, #FPEXC_ENABLE
     1162        vmsr    fpexc, r0                               /* FPEXCを設定 */
     1163        beq             1f                                              /* TA_FPU属性でない場合は分岐 */
     1164        pop             {r1,r2}                                 /* FPSCRの復帰 */
     1165        vmsr    fpscr, r1
     1166        vpop    {d0-d15}                                /* 全FPUレジスタの復帰 */
     1167#ifdef USE_ARM_FPU_D32
     1168        vpop    {d16-d31}
     1169#endif /* USE_ARM_FPU_D32 */
     11701:
     1171#endif /* USE_ARM_FPU */
     1172        pop             {r6-r11}                                /* 残りのレジスタの復帰 */
    10111173
    10121174ALABEL(exc_handler_4)
     
    10311193
    10321194#if __TARGET_ARCH_ARM < 6
    1033         ldmfd   sp!, {r0}                               /* 戻り先のcpsrをspsrに設定 */
     1195        pop             {r0}                                    /* 戻り先のcpsrをspsrに設定 */
    10341196        msr             spsr_cxsf, r0
    10351197        ldmfd   sp!, {r0-r5,r12,lr,pc}^ /* コンテキストの復帰 */
    10361198                                                                        /* ^付きなので,spsr → cpsr */
    10371199#else /* __TARGET_ARCH_ARM < 6 */
    1038         ldmfd   sp!, {r0-r5,r12,lr}
     1200        pop             {r0-r5,r12,lr}                  /* スクラッチレジスタ+αの復帰 */
    10391201        rfefd   sp!
    10401202#endif /* __TARGET_ARCH_ARM < 6 */
     
    10611223        bne             nk_exc_handler_2                /*                      ならnk_exc_handler_2に分岐 */
    10621224
     1225#ifdef USE_ARM_FPU
     1226        /*
     1227         *  FPUをディスエーブルする.
     1228         */
     1229        vmrs    r0, fpexc
     1230        str             r0, [sp]                                /* FPEXCを保存(r0の場所)*/
     1231        bic             r0, r0, #FPEXC_ENABLE
     1232        vmsr    fpexc, r0                               /* FPEXCを設定 */
     1233#endif /* USE_ARM_FPU */
     1234       
    10631235        /*
    10641236         *  非タスクコンテキスト用のスタックに切り換える.
     
    10681240        ldr             sp, [r2]
    10691241        push    {r0,r3}                                 /* 切換え前のスタックポインタを保存 */
    1070                                                                         /* r0はスペース確保のため */
     1242                                                                        /* r0はアラインメントのため */
    10711243ALABEL(nk_exc_handler_2)
    10721244        /*
     
    11011273        pop             {r0,r3}
    11021274        mov             sp, r3
     1275
     1276#ifdef USE_ARM_FPU
     1277        /*
     1278         *  FPUを元に戻す.
     1279         */
     1280        ldr             r0, [sp]                                /* FPEXCを復帰 */
     1281        vmsr    fpexc, r0
     1282#endif /* USE_ARM_FPU */
    11031283        b               exc_handler_5
    1104 
     1284       
    11051285/*
    11061286 *  ステータスレジスタの操作関数
     
    11131293        ATEXT
    11141294        AALIGN(2)
    1115         AWEAK(current_cpsr)
    1116 ALABEL(current_cpsr)
     1295        AWEAK(_kernel_current_cpsr)
     1296ALABEL(_kernel_current_cpsr)
    11171297        mrs             r0, cpsr_cxsf
    11181298        bx              lr
    11191299
    11201300        AALIGN(2)
    1121         AWEAK(set_cpsr)
    1122 ALABEL(set_cpsr)
     1301        AWEAK(_kernel_set_cpsr)
     1302ALABEL(_kernel_set_cpsr)
    11231303        msr             cpsr_cxsf, r0
    11241304        bx              lr
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_sym.def

    r331 r429  
    11TARGET_ARCH_ARM,__TARGET_ARCH_ARM
    2 USE_INTCFG_TABLE,true,bool,defined(USE_INTCFG_TABLE)
     2USE_ARM_FPU,true,bool,defined(USE_ARM_FPU),false
     3USE_ARM_FPU_D32,true,bool,defined(USE_ARM_FPU_D32),false
     4USE_INTCFG_TABLE,true,bool,defined(USE_INTCFG_TABLE),false
     5TA_FPU
    36sizeof_TCB,sizeof(TCB)
    47offsetof_TCB_p_tinib,"offsetof(TCB,p_tinib)"
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_test.h

    r321 r429  
    44 *      Advanced Standard Profile Kernel
    55 *
    6  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     6 *  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    77 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    88 *
     
    3636 *  の責任を負わない.
    3737 *
    38  *  $Id$
     38 *  $Id: core_test.h 1244 2019-07-16 21:41:05Z ertl-hiro $
    3939 */
    4040
     
    5454
    5555/*
    56  *  CPU例外の発生
     56 *  不正アドレスの定義(メモリのない番地に設定する)
    5757 */
    58 
    5958#ifndef ILLEGAL_IADDR
    6059#define ILLEGAL_IADDR                   0xd0000000U             /* 不正命令アドレス */
     
    6665
    6766/*
     67 *  サンプルプログラムで用いるCPU例外の発生
     68 */
     69#if defined(USE_CPUEXC_SVC)
     70
     71#define CPUEXC1                                 EXCNO_SVC               /* スーパバイザコール */
     72#define RAISE_CPU_EXCEPTION             RAISE_CPU_EXCEPTION_SVC
     73#define PREPARE_RETURN_CPUEXC   PREPARE_RETURN_CPUEXC_SVC
     74
     75#elif defined(USE_CPUEXC_PABORT)
     76
     77#define CPUEXC1                                 EXCNO_PABORT    /* プリフェッチアボート */
     78#define RAISE_CPU_EXCEPTION             RAISE_CPU_EXCEPTION_PABORT
     79#define PREPARE_RETURN_CPUEXC   PREPARE_RETURN_CPUEXC_PABORT
     80
     81#elif defined(USE_CPUEXC_DABORT)
     82
     83#define CPUEXC1                                 EXCNO_DABORT    /* データアボート */
     84#define RAISE_CPU_EXCEPTION             RAISE_CPU_EXCEPTION_DABORT
     85#define PREPARE_RETURN_CPUEXC   PREPARE_RETURN_CPUEXC_DABORT
     86
     87#elif defined(USE_CPUEXC_FATAL)
     88
     89#define CPUEXC1                                 EXCNO_FATAL             /* フェイタルデータアボート */
     90#define RAISE_CPU_EXCEPTION             RAISE_CPU_EXCEPTION_FATAL
     91/* フェイタルデータアボート例外ハンドラからリターンしてはならない */
     92
     93#else
     94
     95#define CPUEXC1                                 EXCNO_UNDEF             /* 未定義命令 */
     96#define RAISE_CPU_EXCEPTION             RAISE_CPU_EXCEPTION_UNDEF
     97#define PREPARE_RETURN_CPUEXC   PREPARE_RETURN_CPUEXC_UNDEF
     98
     99#endif
     100
     101/*
    68102 *  スーパバイザコールによるCPU例外の発生
    69103 *
    70  *  CPU例外ハンドラから,そのままリターンすることができる.svc命令によ
    71  *  りlrレジスタが上書きされるため,lrレジスタは破壊されるものと指定し
    72  *  ている.
     104 *  svc #0によりCPU例外を発生させる.svc命令によりlrレジスタが上書きさ
     105 *  れるため,lrレジスタは破壊されるものと指定している.CPU例外ハンド
     106 *  ラからそのままリターンすることで,svc命令の次の命令から実行が継続
     107 *  する.
    73108 */
    74 #if defined(USE_SVC_CPUEXC)
    75 
    76 #define CPUEXC1                                 EXCNO_SVC               /* スーパバイザコール */
    77 #define RAISE_CPU_EXCEPTION             Asm("svc #0":::"lr")
    78 #define PREPARE_RETURN_CPUEXC
     109#define RAISE_CPU_EXCEPTION_SVC                 Asm("svc #0":::"lr")
     110#define PREPARE_RETURN_CPUEXC_SVC
    79111
    80112/*
    81113 *  プリフェッチアボートによるCPU例外の発生
    82114 *
    83  *  プリフェッチアボートを起こした命令をスキップしてCPU例外ハンドラから
    84  *  リターンするために,戻り番地はそのままで良い(ARMモードで使うことを
    85  *  想定).
     115 *  不正な番地を関数の先頭番地として呼び出すことで,プリフェッチアボー
     116 *  トによるCPU例外を発生させる.不正な番地に分岐した命令をスキップし
     117 *  てCPU例外ハンドラからリターンするために,戻り番地には,lrレジスタ
     118 *  の値(不正な番地への分岐命令からのリターン番地が入っている)を設定
     119 *  する.
    86120 */
    87 #elif defined(USE_PABORT_CPUEXC)
    88 
    89 #define CPUEXC1                                 EXCNO_PABORT    /* プリフェッチアボート */
    90 #define RAISE_CPU_EXCEPTION             ((void (*)(void)) ILLEGAL_IADDR)()
    91 #define PREPARE_RETURN_CPUEXC
     121#define RAISE_CPU_EXCEPTION_PABORT              (((void (*)(void)) ILLEGAL_IADDR)())
     122#define PREPARE_RETURN_CPUEXC_PABORT    (((T_EXCINF *) p_excinf)->pc \
     123                                                                                        = ((T_EXCINF *) p_excinf)->lr)
    92124
    93125/*
    94126 *  データアボートによるCPU例外の発生
    95127 *
    96  *  データアボートを起こした命令をスキップしてCPU例外ハンドラからリター
    97  *  ンするために,戻り番地から4を減算する(ARMモードで使うことを想定).
     128 *  不正な番地をリードすることで,データアボートによるCPU例外を発生さ
     129 *  せる.データアボートを起こした命令をスキップしてCPU例外ハンドラか
     130 *  らリターンするために,戻り番地から4を減算する(ARMモードで使うこと
     131 *  を想定している).
    98132 */
    99 #elif defined(USE_DABORT_CPUEXC)
    100 
    101 #include "arm.h"
    102 #define CPUEXC1                                 EXCNO_DABORT    /* データアボート */
    103 #define RAISE_CPU_EXCEPTION             (void)(*((volatile uint32_t *) ILLEGAL_DADDR))
    104 #define PREPARE_RETURN_CPUEXC   ((T_EXCINF *) p_excinf)->pc -= 4U
     133#define RAISE_CPU_EXCEPTION_DABORT              (void)(*((volatile uint32_t *) \
     134                                                                                                                        ILLEGAL_DADDR))
     135#define PREPARE_RETURN_CPUEXC_DABORT    (((T_EXCINF *) p_excinf)->pc -= 4U)
    105136
    106137/*
    107  *  フェイタルデータアボート処理
     138 *  フェイタルデータアボートによるCPU例外の発生
    108139 *
    109  *  スタックポインタを不正にして,フェイタルデータアボート処理を行わせ
    110  *  る.CPU例外ハンドラからはリターンできない.
     140 *  スタックポインタを不正にして,未定義命令を実行することで,フェイタ
     141 *  ルデータアボートによるCPU例外を発生させる.CPU例外ハンドラからリター
     142 *  ンしてはならない.
    111143 */
    112 #elif defined(USE_FATAL_DABORT_CPUEXC)
    113 
    114 #define CPUEXC1                                 EXCNO_DABORT    /* データアボート */
    115 #define RAISE_CPU_EXCEPTION             Asm("mov sp, %0"::"I"(ILLEGAL_DADDR))
     144#define RAISE_CPU_EXCEPTION_FATAL               Asm("mov sp, %0\n" \
     145                                                                                  "\t.word 0xf0500090" \
     146                                                                                  ::"I"(ILLEGAL_DADDR))
    116147
    117148/*
    118149 *  未定義命令によるCPU例外の発生
    119150 *
    120  *  RAISE_CPU_EXCEPTIONは,ARMモードで使うことを想定している.CPU例外ハ
    121  *  ンドラから,そのままリターンすることができる.使用している未定義命
    122  *  令は,"Multiply and multiply accumulate"命令群のエンコーディング内
    123  *  における未定義命令である.
     151 *  未定義命令によりCPU例外を発生させる.使用している未定義命令は,
     152 *  "Multiply and multiply accumulate"命令群のエンコーディング内におけ
     153 *  る未定義命令である.CPU例外ハンドラからそのままリターンすることで,
     154 *  未定義命令の次の命令から実行が継続する(ARMモードで使うことを想定
     155 *  している).
    124156 */
    125 #else
     157#define RAISE_CPU_EXCEPTION_UNDEF               Asm(".word 0xf0500090")
     158#define PREPARE_RETURN_CPUEXC_UNDEF
    126159
    127 #define CPUEXC1                                 EXCNO_UNDEF             /* 未定義命令 */
    128 #define RAISE_CPU_EXCEPTION             Asm(".word 0xf0500090")
    129 #define PREPARE_RETURN_CPUEXC
    130 
    131 #endif
    132160#endif /* TOPPERS_CORE_TEST_H */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/core_unrename.h

    r321 r429  
    2626#undef dabort_handler
    2727#undef fiq_handler
    28 #undef current_cpsr
    29 #undef set_cpsr
    3028
    3129/*
     
    3432#undef excpt_nest_count
    3533#undef arm_mmu_initialize
     34#undef arm_fpu_initialize
    3635#undef core_initialize
    3736#undef core_terminate
     
    4039#undef default_int_handler
    4140#undef default_exc_handler
     41
     42/*
     43 *  mpcore_kernel_impl.c
     44 */
     45#undef mpcore_initialize
     46#undef mpcore_terminate
     47
     48/*
     49 *  mpcore_timer.c
     50 */
     51#undef target_hrt_initialize
     52#undef target_hrt_terminate
     53#undef target_hrt_handler
     54#undef target_ovrtimer_initialize
     55#undef target_ovrtimer_terminate
     56#undef target_ovrtimer_handler
    4257
    4358/*
     
    6681#undef pl310_clean_and_invalidate_all
    6782
    68 /*
    69  *  target_kernel_impl.c
    70  */
    71 #undef arm_tnum_memory_area
    72 #undef arm_memory_area
    73 
    7483
    7584#endif /* TOPPERS_CORE_RENAME_H */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/gic_kernel_impl.c

    r321 r429  
    227227         */
    228228        gicd_set_priority(intno, INT_IPM(intpri));
    229         gicd_set_target(intno, 1U << arm_prc_index());
     229        gicd_set_target(intno, 1U << get_my_prcidx());
    230230
    231231        /*
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/gic_kernel_impl.h

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems
    44 *
    5  *  Copyright (C) 2006-2017 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    66 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    77 *
     
    6767 *  割込み番号の定義
    6868 */
    69 #define GIC_INTNO_SGI0          0U
    70 #define GIC_INTNO_PPI0          16U
    71 #define GIC_INTNO_SPI0          32U
     69#define GIC_INTNO_SGI0          UINT_C(0)
     70#define GIC_INTNO_PPI0          UINT_C(16)
     71#define GIC_INTNO_SPI0          UINT_C(32)
    7272
    7373/*
     
    126126#define GICC_EOIR               GIC_REG(GICC_BASE, 0x10)
    127127#define GICC_RPR                GIC_REG(GICC_BASE, 0x14)
    128 #define GICC_HPIR               GIC_REG(GICC_BASE, 0x18)
     128#define GICC_HPPIR              GIC_REG(GICC_BASE, 0x18)
    129129
    130130/*
     
    198198gicc_set_priority(uint_t pri)
    199199{
    200         sil_wrw_mem(GICC_PMR, pri);
     200        sil_swrw_mem(GICC_PMR, pri);
    201201}
    202202
     
    230230gicd_disable_int(INTNO intno)
    231231{
    232         sil_wrw_mem(GICD_ICENABLER(intno / 32), (1U << (intno % 32)));
     232        sil_swrw_mem(GICD_ICENABLER(intno / 32), (1U << (intno % 32)));
    233233}
    234234
     
    239239gicd_enable_int(INTNO intno)
    240240{
    241         sil_wrw_mem(GICD_ISENABLER(intno / 32), (1U << (intno % 32)));
     241        sil_swrw_mem(GICD_ISENABLER(intno / 32), (1U << (intno % 32)));
    242242}
    243243
     
    248248gicd_clear_pending(INTNO intno)
    249249{
    250         sil_wrw_mem(GICD_ICPENDR(intno / 32), (1U << (intno % 32)));
     250        sil_swrw_mem(GICD_ICPENDR(intno / 32), (1U << (intno % 32)));
    251251}
    252252
     
    257257gicd_set_pending(INTNO intno)
    258258{
    259         sil_wrw_mem(GICD_ISPENDR(intno / 32), (1U << (intno % 32)));
     259        sil_swrw_mem(GICD_ISPENDR(intno / 32), (1U << (intno % 32)));
    260260}
    261261
     
    271271
    272272/*
     273 *  ソフトウェア生成割込み(SGI)の生成
     274 */
     275Inline void
     276gicd_raise_sgi(INTNO intno)
     277{
     278        sil_swrw_mem(GICD_SGIR, (0x02000000 | intno));
     279}
     280
     281/*
    273282 *  割込みのコンフィグレーション
    274283 */
     
    279288        uint32_t        reg;
    280289
    281         reg = sil_rew_mem(GICD_ICFGR(intno / 16));
    282         reg &= ~(0x03U << shift);
    283         reg |= (config << shift);
    284         sil_wrw_mem(GICD_ICFGR(intno / 16), reg);
     290        if (intno >= GIC_INTNO_PPI0) {
     291                reg = sil_rew_mem(GICD_ICFGR(intno / 16));
     292                reg &= ~(0x03U << shift);
     293                reg |= (config << shift);
     294                sil_wrw_mem(GICD_ICFGR(intno / 16), reg);
     295        }
    285296}
    286297
     
    318329 *  割込みターゲットプロセッサの設定
    319330 *
    320  *  prcsは,ターゲットとするプロセッサを表すビットのビット毎論理和で指
    321  *  定する.
     331 *  affinityは,ターゲットとするプロセッサを表すビットのビット毎論理和
     332 *  で指定する.
    322333 *              プロセッサ0 : 0x01
    323334 *              プロセッサ1 : 0x02
     
    326337 */
    327338Inline void
    328 gicd_set_target(INTNO intno, uint_t prcs)
     339gicd_set_target(INTNO intno, uint_t affinity)
    329340{
    330341        uint_t          shift = (intno % 4) * 8;
     
    333344        reg = sil_rew_mem(GICD_ITARGETSR(intno / 4));
    334345        reg &= ~(0xffU << shift);
    335         reg |= (prcs << shift);
     346        reg |= (affinity << shift);
    336347        sil_wrw_mem(GICD_ITARGETSR(intno / 4), reg);
    337348}
     
    373384 */
    374385#ifndef TOPPERS_MACRO_ONLY
     386
     387/*
     388 *  割込み属性の設定のチェック
     389 */
     390Inline bool_t
     391check_intno_cfg(INTNO intno)
     392{
     393        return(intcfg_table[intno] != 0U);
     394}
    375395
    376396/*
     
    393413
    394414/*
     415 *  割込み要求禁止フラグが操作できる割込み番号の範囲の判定
     416 */
     417#ifdef GIC_SUPPORT_DISABLE_SGI
     418#define VALID_INTNO_DISINT(intno)       VALID_INTNO(intno)
     419#else /* GIC_SUPPORT_DISABLE_SGI */
     420#define VALID_INTNO_DISINT(intno) \
     421                                (GIC_INTNO_PPI0 <= (intno) && (intno) <= TMAX_INTNO)
     422#endif /* GIC_SUPPORT_DISABLE_SGI */
     423
     424/*
    395425 *  割込み要求禁止フラグのセット
    396  *
    397  *  intnoで指定された割込み要求ラインに対する割込み要求禁止フラグのセッ
    398  *  トし,割込みを禁止する.割込み属性が設定されていない割込み要求ライ
    399  *  ンが指定された場合には,falseを返す.
    400  */
    401 Inline bool_t
     426 */
     427Inline void
    402428disable_int(INTNO intno)
    403429{
    404         if (intcfg_table[intno] == 0U) {
    405                 return(false);
    406         }
    407430        gicd_disable_int(intno);
    408         return(true);
    409431}
    410432
    411433/*
    412434 *  割込み要求禁止フラグのクリア
    413  *
    414  *  intnoで指定された割込み要求ラインに対する割込み要求禁止フラグのクリ
    415  *  アし,割込みを許可する.割込み属性が設定されていない割込み要求ライ
    416  *  ンが指定された場合には,falseを返す.
     435 */
     436Inline void
     437enable_int(INTNO intno)
     438{
     439        gicd_enable_int(intno);
     440}
     441
     442/*
     443 *  割込み要求がクリアできる割込み番号の範囲の判定
     444 */
     445#define VALID_INTNO_CLRINT(intno) \
     446                                (GIC_INTNO_PPI0 <= (intno) && (intno) <= TMAX_INTNO)
     447
     448/*
     449 *  割込み要求がクリアできる状態か?
    417450 */
    418451Inline bool_t
    419 enable_int(INTNO intno)
    420 {
    421         if (intcfg_table[intno] == 0U) {
    422                 return(false);
     452check_intno_clear(INTNO intno)
     453{
     454        return(true);
     455}
     456
     457/*
     458 *  割込み要求のクリア
     459 */
     460Inline void
     461clear_int(INTNO intno)
     462{
     463        gicd_clear_pending(intno);
     464}
     465
     466/*
     467 *  割込みが要求できる状態か?
     468 */
     469Inline bool_t
     470check_intno_raise(INTNO intno)
     471{
     472        return(true);
     473}
     474
     475/*
     476 *  割込みの要求
     477 */
     478Inline void
     479raise_int(INTNO intno)
     480{
     481        if (intno < GIC_INTNO_PPI0) {
     482                gicd_raise_sgi(intno);
    423483        }
    424         gicd_enable_int(intno);
    425         return(true);
    426 }
    427 
    428 /*
    429  *  割込み要求のクリア
    430  */
    431 Inline void
    432 clear_int(INTNO intno)
    433 {
    434         gicd_clear_pending(intno);
     484        else {
     485                gicd_set_pending(intno);
     486        }
    435487}
    436488
     
    444496}
    445497
    446 /*
    447  *  割込み要求のセット
    448  */
    449 Inline void
    450 raise_int(INTNO intno)
    451 {
    452         gicd_set_pending(intno);
    453 }
    454 
    455498#endif /* TOPPERS_MACRO_ONLY */
    456499#endif /* TOPPERS_GIC_KERNEL_IMPL_H */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/gic_support.S

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2006-2017 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    7070         *  割込み要因を取得する.
    7171         */
     72#ifdef GIC_PL390_ERRATA                 /* GIC 390 Errata 801120への対策 */
     73        ldr             r1, =GICC_HPPIR
     74        ldr             r0, [r1]       
     75#endif /* GIC_PL390_ERRATA */
    7276        ldr             r1, =GICC_IAR
    7377        ldr             r3, [r1]
    74 
    75         /*
    76          *  割込み番号を求める.
    77          */
    7878        lsl             r4, r3, #22                     /* 下位10ビットを取り出す */
    7979        lsr             r4, r4, #22
    8080
    81         /*
    82          *  割込み要求をクリアする.
    83          */
    84         and             r0, r4, #31
    85         mov             r2, #1
    86         lsl             r0, r2, r0
    87         ldr             r2, =GICD_ICPENDR(0)
    88         lsr             r1, r4, #5
    89         str             r0, [r2,r1,lsl #2]
     81#ifdef GIC_PL390_ERRATA                 /* GIC 390 Errata 733075への対策 */
     82        movw    r0, #1023
     83        cmp             r4, r0
     84        beq             irc_begin_int_errata_1
     85        movw    r0, #1022
     86        cmp             r4, r0
     87        beq             irc_begin_int_errata_1
     88        cmp             r3, #0
     89        bne             irc_begin_int_errata_2
     90        ldr             r1, =GICD_ISACTIVER(0)          /* 割込み要求があるかチェック */
     91        ldr             r0, [r1]
     92        tst             r0, #0x01
     93        movweq  r4, #1024                                       /* 無効な割込みとみなす */
     94ALABEL(irc_begin_int_errata_1)
     95        ldr             r1, =GICD_IPRIORITYR(0)         /* 割込み優先度レジスタ0に書き込み */
     96        ldr             r0, [r1]
     97        str             r0, [r1]
     98        asm_data_sync_barrier r0
     99ALABEL(irc_begin_int_errata_2)
     100#endif /* GIC_PL390_ERRATA */
    90101
    91102        /*
     
    107118
    108119        /*
    109          *  割込み番号を返値としてリターンする.
     120         *  r4に割込み番号を入れた状態でリターンする.
    110121         */
    111122        bx              lr
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/pl310.c

    r428 r429  
    4343
    4444#include "kernel_impl.h"
    45 #include "core_pl310.h"
     45#include "pl310.h"
    4646
    4747Inline uint32_t
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/tUartPL011.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
    5  *
    6  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
     4 *
     5 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    76 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    87 *
     
    9594        CELLCB  *p_cellcb = GET_CELLCB(idx);
    9695
    97         /*
    98          *  UARTをディスエーブル
    99          */
    100         sil_wrw_mem(UART_CR(ATTR_baseAddress), 0U);
    101 
    102         /*
    103          *  エラーフラグをクリア
    104          */
    105         sil_wrw_mem(UART_ECR(ATTR_baseAddress), 0U);
    106 
    107         /*
    108          *  FIFOを空にする
    109          */
    110         while (uart_pl011_getready(p_cellcb)) {
    111                 (void) uart_pl011_getchar(p_cellcb);
    112         }
    113 
    114         /*
    115          *  ボーレートと通信規格を設定
    116          */
    117         sil_wrw_mem(UART_IBRD(ATTR_baseAddress), ATTR_ibrd);
    118         sil_wrw_mem(UART_FBRD(ATTR_baseAddress), ATTR_fbrd);
    119         sil_wrw_mem(UART_LCR_H(ATTR_baseAddress), ATTR_lcr_h);
    120                
    121         /*
    122          *  UARTをイネーブル
    123          */
    124         sil_wrw_mem(UART_CR(ATTR_baseAddress),
     96        if (!VAR_opened) {
     97                /*
     98                 *  既にオープンしている場合は、二重にオープンしない.
     99                 */
     100
     101                /*
     102                 *  UARTをディスエーブル
     103                 */
     104                sil_wrw_mem(UART_CR(ATTR_baseAddress), 0U);
     105
     106                /*
     107                 *  エラーフラグをクリア
     108                 */
     109                sil_wrw_mem(UART_ECR(ATTR_baseAddress), 0U);
     110
     111                /*
     112                 *  FIFOを空にする
     113                 */
     114                while (uart_pl011_getready(p_cellcb)) {
     115                        (void) uart_pl011_getchar(p_cellcb);
     116                }
     117
     118                /*
     119                 *  ボーレートと通信規格を設定
     120                 */
     121                sil_wrw_mem(UART_IBRD(ATTR_baseAddress), ATTR_ibrd);
     122                sil_wrw_mem(UART_FBRD(ATTR_baseAddress), ATTR_fbrd);
     123                sil_wrw_mem(UART_LCR_H(ATTR_baseAddress), ATTR_lcr_h);
     124
     125                /*
     126                 *  UARTをイネーブル
     127                 */
     128                sil_wrw_mem(UART_CR(ATTR_baseAddress),
    125129                                                UART_CR_UARTEN|UART_CR_TXE|UART_CR_RXE);
     130
     131                VAR_opened = true;
     132        }
    126133}
    127134
     
    134141        CELLCB  *p_cellcb = GET_CELLCB(idx);
    135142
    136         /*
    137          *  UARTをディスエーブル
    138          */
    139         sil_wrw_mem(UART_CR(ATTR_baseAddress), 0U);
     143        if (VAR_opened) {
     144                /*
     145                 *  UARTをディスエーブル
     146                 */
     147                sil_wrw_mem(UART_CR(ATTR_baseAddress), 0U);
     148
     149                VAR_opened = false;
     150        }
    140151}
    141152
     
    232243        }
    233244}
     245
     246/*
     247 *  SIOドライバの終了処理
     248 */
     249void
     250eTerminate_main(CELLIDX idx)
     251{
     252        eSIOPort_close(idx);
     253}
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/tUartPL011.cdl

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2015 by Ushio Laboratory
    76 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    98 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    109 *
     
    5857
    5958        entry   siHandlerBody   eiISR;
     59        entry   sRoutineBody    eTerminate;
    6060
    6161        attr {
     
    6565                uint8_t         lcr_h;                  /* ライン制御レジスタの設定値 */
    6666        };
     67        var {
     68                bool_t          opened = false; /* オープン済み */
     69        };
    6770};
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/common/uart_pl011.h

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/Makefile.chip

    r321 r429  
    22#               Makefile のチップ依存部(RZ/A1用)
    33#
    4 #  $Id$
     4#  $Id: Makefile.chip 720 2016-04-01 22:16:17Z ertl-hiro $
    55#
    66
     
    2222#
    2323KERNEL_DIRS := $(KERNEL_DIRS) $(CHIPDIR)
     24KERNEL_COBJS := $(KERNEL_COBJS) chip_kernel_impl.o mpcore_kernel_impl.o \
     25                                                                        gic_kernel_impl.o pl310.o chip_timer.o
    2426KERNEL_ASMOBJS := $(KERNEL_ASMOBJS) gic_support.o
    25 KERNEL_COBJS := $(KERNEL_COBJS) chip_kernel_impl.o gic_kernel_impl.o \
    26                                                                                                                         chip_timer.o
     27
     28#
     29#  システムサービスに関する定義
     30#
     31SYSSVC_DIRS := $(SYSSVC_DIRS) $(CHIPDIR)
    2732
    2833#
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_kernel.h

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems/
    44 *      Advanced Standard Profile Kernel
    5  *
    6  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     5 * 
     6 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    77 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    8  *
     8 * 
    99 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    1010 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    2929 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    3030 *      免責すること.
    31  *
     31 * 
    3232 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3333 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3535 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3636 *  の責任を負わない.
    37  *
     37 * 
    3838 *  $Id$
    3939 */
     
    4242 *              kernel.hのターゲット依存部(RZ/A1用)
    4343 *
    44  *  このヘッダファイルは,kernel.hからインクルードされる.他のファイル
    45  *  から直接インクルードすることはない.このファイルをインクルードする
    46  *  前に,t_stddef.hがインクルードされるので,それに依存してもよい.
     44 *  このヘッダファイルは,target_kernel.h(または,そこからインクルー
     45 *  ドされるファイル)のみからインクルードされる.他のファイルから直接
     46 *  インクルードしてはならない.
    4747 */
    4848
     
    6666 *  サポートできる機能の定義
    6767 *
    68  *  ena_int/dis_intとオーバランハンドラをサポートすることができる.
     68 *  ena_int/dis_int/clr_int/ras_int/prb_intとオーバランハンドラを
     69 *  サポートすることができる.
    6970 */
    7071#define TOPPERS_TARGET_SUPPORT_ENA_INT          /* ena_int */
    7172#define TOPPERS_TARGET_SUPPORT_DIS_INT          /* dis_int */
     73#define TOPPERS_TARGET_SUPPORT_CLR_INT          /* clr_int */
     74#define TOPPERS_TARGET_SUPPORT_RAS_INT          /* ras_int */
     75#define TOPPERS_TARGET_SUPPORT_PRB_INT          /* prb_int */
    7276#define TOPPERS_TARGET_SUPPORT_OVRHDR
    73 
    74 /*
    75  *  高分解能タイマのタイマ周期
    76  *
    77  *  2^32 / 33.33…を丸めた値とする.
    78  */
    79 #define TCYC_HRTCNT             128849019U
    80 
    81 /*
    82  *  高分解能タイマのカウント値の進み幅
    83  */
    84 #define TSTEP_HRTCNT    1U
    85 
    86 /*
    87  *  オーバランハンドラの残りプロセッサ時間に指定できる最大値
    88  *
    89  *  この値をOSタイマへの設定値に変換してタイマに設定した後,タイマの現
    90  *  在値を読み出してμ秒単位に変換できる値としている.タイマの現在値を
    91  *  μ秒単位に変換する時に34を加えるため,以下の条件を満たす最大の値と
    92  *  する.
    93  *              (TMAX_OVRTIM * 33 + TMAX_OVRTIM / 3 + 1) + 34 < 2^32
    94  */
    95 #define TMAX_OVRTIM             128849017U
    9677
    9778/*
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_kernel.trb

    r321 r429  
    2727#  割込み要求ライン属性に関するターゲット依存のエラーチェック
    2828#
    29 $cfgData[:CFG_INT].each do |key, params|
    30   if $INTNO_IRQ0 <= key && key <= $INTNO_IRQ7
     29$cfgData[:CFG_INT].each do |_, params|
     30  if $INTNO_IRQ0 <= params[:intno] && params[:intno] <= $INTNO_IRQ7
    3131    # IRQ割込みの場合
    3232    #(TA_EDGEがセットされている場合)
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_kernel_impl.c

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems/
    44 *      Advanced Standard Profile Kernel
    5  *
     5 * 
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    10  *
     10 * 
    1111 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    1212 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    3131 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    3232 *      免責すること.
    33  *
     33 * 
    3434 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3535 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3737 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3838 *  の責任を負わない.
    39  *
     39 * 
    4040 *  $Id$
    4141 */
     
    4646
    4747#include "kernel_impl.h"
     48#include <sil.h>
    4849#include "interrupt.h"
     50#include "pl310.h"
    4951
    5052/*
     
    5557{
    5658        /*
    57          *  キャッシュをディスエーブル
     59         *  MPCore依存の初期化
    5860         */
    59         arm_disable_cache();
     61        mpcore_initialize();
    6062
    6163        /*
    62          *  コア依存の初期化
     64         *  L2キャッシュコントローラ(PL310)の初期化
    6365         */
    64         core_initialize();
    65 
    66         /*
    67          *  キャッシュをイネーブル
    68          */
    69         arm_enable_cache();
    70 
    71         /*
    72          *  GICのディストリビュータの初期化
    73          */
    74         gicd_initialize();
    75 
    76         /*
    77          *  GICのCPUインタフェースの初期化
    78          */
    79         gicc_initialize();
    80 
    81         /*
    82          *  分岐予測の無効化とイネーブル
    83          */
    84         arm_invalidate_bp();
    85         arm_enable_bp();
     66        pl310_initialize(0x0U, ~0x0U);
    8667}
    8768
    8869/*
    89  *  チップ依存の終了処理
     70 *  チップ依存の終了処理
    9071 */
    9172void
    9273chip_terminate(void)
    9374{
    94         extern void    software_term_hook(void);
    95         void (*volatile fp)(void) = software_term_hook;
    96 
    9775        /*
    98          *  software_term_hookへのポインタを,一旦volatile指定のあるfpに代
    99          *  入してから使うのは,0との比較が最適化で削除されないようにするた
    100          *  めである.
     76         *  MPCore依存の終了処理
    10177         */
    102         if (fp != 0) {
    103                 (*fp)();
    104         }
    105 
    106         /*
    107          *  GICのCPUインタフェースの終了処理
    108          */
    109         gicc_terminate();
    110 
    111         /*
    112          *  GICのディストリビュータの終了処理
    113          */
    114         gicd_terminate();
    115 
    116         /*
    117          *  コア依存の終了処理
    118          */
    119         core_terminate();
     78        mpcore_terminate();
    12079}
    12180
     
    177136         */
    178137        gicd_set_priority(intno, INT_IPM(intpri));
    179         gicd_set_target(intno, 1U << arm_prc_index());
     138        gicd_set_target(intno, 1U << get_my_prcidx());
    180139
    181140        /*
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_kernel_impl.h

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems/
    44 *      Advanced Standard Profile Kernel
    5  *
     5 * 
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    10  *
     10 * 
    1111 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    1212 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    3131 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    3232 *      免責すること.
    33  *
     33 * 
    3434 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3535 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3737 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3838 *  の責任を負わない.
    39  *
     39 * 
    4040 *  $Id$
    4141 */
     
    5858
    5959/*
    60  *  MMUの使用に関する設定
     60 *  デフォルトの非タスクコンテキスト用のスタック領域の定義
    6161 */
    62 #define USE_ARM_MMU
    63 #define USE_ARM_SSECTION
     62#ifndef DEFAULT_ISTKSZ
     63#define DEFAULT_ISTKSZ  0x2000U                 /* 8KB */
     64#endif /* DEFAULT_ISTKSZ */
    6465
    6566/*
     
    7071
    7172/*
    72  *  GIC依存部の割込み管理機能の初期化は使用しない.
     73 *  GIC 390 Errataへの対策を実施
     74 */
     75#define GIC_PL390_ERRATA
     76
     77/*
     78 *  GIC依存部の割込み管理機能の初期化は使用しない
    7379 */
    7480#define OMIT_GIC_INITIALIZE_INTERRUPT
    7581
    7682/*
    77  *  GICに関する定義,コアで共通な定義
    78  *
    79  *  core_kernel_impl.hは,gic_kernel_impl.hからインクルードされる.
     83 *  MPCoreで共通な定義
    8084 */
    81 #include "gic_kernel_impl.h"
     85#include "mpcore_kernel_impl.h"
    8286
    8387#ifndef TOPPERS_MACRO_ONLY
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_rename.def

    r331 r429  
    66target_hrt_initialize
    77target_hrt_terminate
    8 target_hrt_set_event
    9 target_hrt_raise_event
    108target_hrt_handler
    119target_ovrtimer_initialize
    1210target_ovrtimer_terminate
    13 target_ovrtimer_stop
    14 target_ovrtimer_get_current
    1511target_ovrtimer_handler
    1612
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_rename.h

    r321 r429  
    1515#define target_hrt_initialize           _kernel_target_hrt_initialize
    1616#define target_hrt_terminate            _kernel_target_hrt_terminate
    17 #define target_hrt_set_event            _kernel_target_hrt_set_event
    18 #define target_hrt_raise_event          _kernel_target_hrt_raise_event
    1917#define target_hrt_handler                      _kernel_target_hrt_handler
    2018#define target_ovrtimer_initialize      _kernel_target_ovrtimer_initialize
    2119#define target_ovrtimer_terminate       _kernel_target_ovrtimer_terminate
    22 #define target_ovrtimer_stop            _kernel_target_ovrtimer_stop
    23 #define target_ovrtimer_get_current     _kernel_target_ovrtimer_get_current
    2420#define target_ovrtimer_handler         _kernel_target_ovrtimer_handler
    2521
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_stddef.h

    r321 r429  
    1 /*
    2  *  TOPPERS Software
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems
    4  *
    5  *  Copyright (C) 2007 by Embedded and Real-Time Systems Laboratory
    6  *              Graduate School of Information Science, Nagoya Univ., JAPAN
    7  *  Copyright (C) 2011-2016 by Embedded and Real-Time Systems Laboratory
    8  *              Graduate School of Information Science, Nagoya Univ., JAPAN
    9  *
    10  *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    11  *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
    12  *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
    13  *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
    14  *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
    15  *      スコード中に含まれていること.
    16  *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
    17  *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
    18  *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
    19  *      の無保証規定を掲載すること.
    20  *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
    21  *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
    22  *      と.
    23  *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
    24  *        作権表示,この利用条件および下記の無保証規定を掲載すること.
    25  *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
    26  *        報告すること.
    27  *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
    28  *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
    29  *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
    30  *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    31  *      免責すること.
    32  *
    33  *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    34  *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
    35  *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
    36  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    37  *  の責任を負わない.
    38  *
    39  *  $Id$
    40  */
    41 
    421/*
    432 *              t_stddef.hのチップ依存部(RZ/A1用)
     
    465 *  されるファイル)のみからインクルードされる.他のファイルから直接イ
    476 *  ンクルードしてはならない.
     7 *
     8 *  $Id$
    489 */
    4910
     
    6425
    6526/*
     27 *  開発環境で共通な定義
     28 */
     29#ifndef TOPPERS_MACRO_ONLY
     30#include <stdint.h>
     31#endif /* TOPPERS_MACRO_ONLY */
     32
     33#define TOPPERS_STDFLOAT_TYPE1
     34#include "tool_stddef.h"
     35
     36/*
    6637 *  コアで共通な定義
    6738 */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_sym.def

    r331 r429  
    1 TARGET_RZA1H,true,bool,defined(TARGET_RZA1H)
    2 TARGET_RZA1L,true,bool,defined(TARGET_RZA1L)
     1TARGET_RZA1H,true,bool,defined(TARGET_RZA1H),false
     2TARGET_RZA1L,true,bool,defined(TARGET_RZA1L),false
    33TA_NEGEDGE
    44TA_POSEDGE
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_timer.c

    r321 r429  
    44 *      Advanced Standard Profile Kernel
    55 *
    6  *  Copyright (C) 2006-2017 by Embedded and Real-Time Systems Laboratory
     6 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    77 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    88 *
     
    100100
    101101/*
    102  *  高分解能タイマへの割込みタイミングの設定
    103  */
    104 void
    105 target_hrt_set_event(HRTCNT hrtcnt)
    106 {
    107         uint32_t        cnt = hrtcnt * 33 + hrtcnt / 3 + 1;
    108         uint32_t        current;
    109 
    110         /*
    111          *  現在のカウント値を読み,hrtcnt後に割込みが発生するように設定する.
    112          */
    113         current = sil_rew_mem(OSTM_CNT(OSTM0_BASE));
    114         sil_wrw_mem(OSTM_CMP(OSTM0_BASE), current + cnt);
    115 
    116         /*
    117          *  上で現在のカウント値を読んで以降に,cnt以上カウントアップしてい
    118          *  た場合には,割込みを発生させる.
    119          */
    120         if (sil_rew_mem(OSTM_CNT(OSTM0_BASE)) - current >= cnt) {
    121                 raise_int(INTNO_OSTM0);
    122         }
    123 }
    124 
    125 /*
    126  *  高分解能タイマ割込みの要求
    127  */
    128 void
    129 target_hrt_raise_event(void)
    130 {
    131         raise_int(INTNO_OSTM0);
    132 }
    133 
    134 /*
    135102 *  タイマ割込みハンドラ
    136103 */
     
    143110        signal_time();
    144111}
     112
    145113/*
    146114 *  オーバランタイマドライバ
     
    183151
    184152/*
    185  *  オーバランタイマの停止
    186  */
    187 PRCTIM
    188 target_ovrtimer_stop(void)
    189 {
    190         uint32_t        cnt;
    191 
    192         /*
    193          *  OSタイマを停止する.
    194          */
    195         sil_wrb_mem(OSTM_TT(OSTM1_BASE), OSTM_TT_STOP);
    196 
    197         if (probe_int(INTNO_OSTM1)) {
    198                 /*
    199                  *  割込み要求が発生している場合
    200                  */
    201                 clear_int(INTNO_OSTM1);
    202                 return(0U);
    203         }
    204         else {
    205                 cnt = sil_rew_mem(OSTM_CNT(OSTM1_BASE));
    206                 return((PRCTIM)((cnt + 34) / 5 * 3 / 20));
    207         }
    208 }
    209 
    210 /*
    211  *  オーバランタイマの現在値の読出し
    212  */
    213 PRCTIM
    214 target_ovrtimer_get_current(void)
    215 {
    216         uint32_t        cnt;
    217 
    218         if (probe_int(INTNO_OSTM1)) {
    219                 /*
    220                  *  割込み要求が発生している場合
    221                  */
    222                 return(0U);
    223         }
    224         else {
    225                 cnt = sil_rew_mem(OSTM_CNT(OSTM1_BASE));
    226                 return((PRCTIM)((cnt + 34) / 5 * 3 / 20));
    227         }
    228 }
    229 
    230 /*
    231153 *  オーバランタイマ割込みハンドラ
    232154 *
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_timer.cfg

    r321 r429  
    11/*
    2  *              タイマドライバのコンフィギュレーションファイル
     2 *              タイマドライバのコンフィギュレーションファイル(RZ/A1 OSタイマ用)
    33 *
    44 *  $Id$
     
    1010ATT_INI({ TA_NULL, 0, _kernel_target_hrt_initialize });
    1111ATT_TER({ TA_NULL, 0, _kernel_target_hrt_terminate });
     12
    1213CFG_INT(INTNO_TIMER, { TA_ENAINT|INTATR_TIMER, INTPRI_TIMER });
    1314DEF_INH(INHNO_TIMER, { TA_NULL, _kernel_target_hrt_handler });
     
    1718 */
    1819#ifdef TOPPERS_SUPPORT_OVRHDR
     20
    1921ATT_INI({ TA_NULL, 0, _kernel_target_ovrtimer_initialize });
    2022ATT_TER({ TA_NULL, 0, _kernel_target_ovrtimer_terminate });
     23
    2124CFG_INT(INTNO_OVRTIMER, { TA_ENAINT|INTATR_OVRTIMER, INTPRI_OVRTIMER });
    2225DEF_INH(INHNO_OVRTIMER, { TA_NULL, _kernel_target_ovrtimer_handler });
     26
    2327#endif /* TOPPERS_SUPPORT_OVRHDR */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_timer.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5151#define TOPPERS_CHIP_TIMER_H
    5252
     53#include "kernel/kernel_impl.h"
    5354#include <sil.h>
    5455#include "rza1.h"
     
    140141 *  生させるように設定する.
    141142 */
    142 extern void target_hrt_set_event(HRTCNT hrtcnt);
     143Inline void
     144target_hrt_set_event(HRTCNT hrtcnt)
     145{
     146        uint32_t        cnt = hrtcnt * 33 + hrtcnt / 3 + 1;
     147        uint32_t        current;
     148
     149        /*
     150         *  現在のカウント値を読み,hrtcnt後に割込みが発生するように設定する.
     151         */
     152        current = sil_rew_mem(OSTM_CNT(OSTM0_BASE));
     153        sil_wrw_mem(OSTM_CMP(OSTM0_BASE), current + cnt);
     154
     155        /*
     156         *  上で現在のカウント値を読んで以降に,cnt以上カウントアップしてい
     157         *  た場合には,割込みを発生させる.
     158         */
     159        if (sil_rew_mem(OSTM_CNT(OSTM0_BASE)) - current >= cnt) {
     160                raise_int(INTNO_OSTM0);
     161        }
     162}
    143163
    144164/*
    145165 *  高分解能タイマ割込みの要求
    146166 */
    147 extern  void target_hrt_raise_event(void);
     167Inline void
     168target_hrt_raise_event(void)
     169{
     170        raise_int(INTNO_OSTM0);
     171}
    148172
    149173/*
     
    184208 *  オーバランタイマの停止
    185209 */
    186 extern PRCTIM target_ovrtimer_stop(void);
     210Inline PRCTIM
     211target_ovrtimer_stop(void)
     212{
     213        uint32_t        cnt;
     214
     215        /*
     216         *  OSタイマを停止する.
     217         */
     218        sil_wrb_mem(OSTM_TT(OSTM1_BASE), OSTM_TT_STOP);
     219
     220        if (probe_int(INTNO_OSTM1)) {
     221                /*
     222                 *  割込み要求が発生している場合
     223                 */
     224                clear_int(INTNO_OSTM1);
     225                return(0U);
     226        }
     227        else {
     228                cnt = sil_rew_mem(OSTM_CNT(OSTM1_BASE));
     229                return((PRCTIM)((cnt + 34) / 5 * 3 / 20));
     230        }
     231}
    187232
    188233/*
    189234 *  オーバランタイマの現在値の読出し
    190235 */
    191 extern PRCTIM target_ovrtimer_get_current(void);
     236Inline PRCTIM
     237target_ovrtimer_get_current(void)
     238{
     239        uint32_t        cnt;
     240
     241        if (probe_int(INTNO_OSTM1)) {
     242                /*
     243                 *  割込み要求が発生している場合
     244                 */
     245                return(0U);
     246        }
     247        else {
     248                cnt = sil_rew_mem(OSTM_CNT(OSTM1_BASE));
     249                return((PRCTIM)((cnt + 34) / 5 * 3 / 20));
     250        }
     251}
    192252
    193253/*
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/chip_unrename.h

    r321 r429  
    1616#undef target_hrt_initialize
    1717#undef target_hrt_terminate
    18 #undef target_hrt_set_event
    19 #undef target_hrt_raise_event
    2018#undef target_hrt_handler
    2119#undef target_ovrtimer_initialize
    2220#undef target_ovrtimer_terminate
    23 #undef target_ovrtimer_stop
    24 #undef target_ovrtimer_get_current
    2521#undef target_ovrtimer_handler
    2622
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/rza1.h

    r321 r429  
    22 *  TOPPERS Software
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems
    4  *
    5  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     4 * 
     5 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    66 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    7  *
     7 * 
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    99 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    2828 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    2929 *      免責すること.
    30  *
     30 * 
    3131 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3232 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3434 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3535 *  の責任を負わない.
    36  *
     36 * 
    3737 *  $Id$
    3838 */
     
    4545#define TOPPERS_RZA1_H
    4646
     47#include <kernel.h>
    4748#include <sil.h>
     49#include "arm.h"
    4850
    4951/*
     
    8486
    8587/*
     88 *  CP15の補助制御レジスタ(ACTLR)の設定値
     89 */
     90#define CP15_ACTLR_SMP          UINT_C(0x00000040)
     91
     92/*
    8693 *  GIC依存部を使用するための定義
    8794 */
     
    9299#define GIC_TNUM_INTNO          UINT_C(538)
    93100#endif /* TOPPERS_RZA1H */
    94 #endif /* GIC_TNUM_INT */
     101#endif /* GIC_TNUM_INTNO */
    95102
    96103/*
     
    256263        reg = sil_reh_mem(RZA1_IRQRR);
    257264        reg &= ~(0x01U << (intno - INTNO_IRQ0));
    258         sil_wrh_mem(RZA1_IRQRR, reg);
     265        sil_swrh_mem(RZA1_IRQRR, reg);
    259266}
    260267
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/scif.h

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
    5  *
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
     4 *
    65 *  Copyright (C) 2001-2011 by Industrial Technology Institute,
    76 *                              Miyagi Prefectural Government, JAPAN
    87 *  Copyright (C) 2007-2016 by Embedded and Real-Time Systems Laboratory
    98 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    10  *
     9 * 
    1110 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    1211 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    3130 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    3231 *      免責すること.
    33  *
     32 * 
    3433 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3534 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3736 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3837 *  の責任を負わない.
    39  *
     38 * 
    4039 *  $Id$
    4140 */
     
    6665 *  シリアルモードレジスタ(SCIF_SCSMR)の設定値
    6766 */
     67#define SCIF_SCSMR_ASYNC        0x0000U         /* 調歩同期式モード */
    6868#define SCIF_SCSMR_SYNC         0x0080U         /* クロック同期式モード */
     69#define SCIF_SCSMR_8BIT         0x0000U         /* 8ビットデータ */
    6970#define SCIF_SCSMR_7BIT         0x0040U         /* 7ビットデータ */
    70 #define SCIF_SCSMR_PARITY       0x0020U         /* パリティビットの付加 */
     71#define SCIF_SCSMR_NOPARITY     0x0000U         /* パリティビットなし */
     72#define SCIF_SCSMR_PARITY       0x0020U         /* パリティビット付加 */
     73#define SCIF_SCSMR_EVEN         0x0000U         /* 偶数パリティ */
    7174#define SCIF_SCSMR_ODD          0x0010U         /* 奇数パリティ */
     75#define SCIF_SCSMR_1STOP        0x0000U         /* 1ストッピビット */
    7276#define SCIF_SCSMR_2STOP        0x0008U         /* 2ストッピビット */
    7377#define SCIF_SCSMR_CKS1         0x0000U         /* P1φクロック1 */
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/tSCIF.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    6  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    76 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    87 *
     
    133132        uint_t  brr;
    134133
    135         if (VAR_initialized) {
    136                 /*
    137                  *  既に初期化している場合は、二重に初期化しない.
    138                  */
    139                 return;
    140         }
    141 
    142         brr = SCIF_CLK / (32 * ATTR_baudRate) - 1;
    143         assert(brr <= 255);
    144 
    145         sil_wrh_mem(SCIF_SCSCR(ATTR_baseAddress), 0U);
    146         sil_wrh_mem(SCIF_SCFCR(ATTR_baseAddress),
     134        if (!VAR_opened) {
     135                /*
     136                 *  既にオープンしている場合は、二重にオープンしない.
     137                 */
     138                brr = SCIF_CLK / (32 * ATTR_baudRate) - 1;
     139                assert(brr <= 255);
     140
     141                sil_wrh_mem(SCIF_SCSCR(ATTR_baseAddress), 0U);
     142                sil_wrh_mem(SCIF_SCFCR(ATTR_baseAddress),
    147143                                                        SCIF_SCFCR_TFRST|SCIF_SCFCR_RFRST);
    148         (void) sil_reh_mem(SCIF_SCFSR(ATTR_baseAddress));
    149         (void) sil_reh_mem(SCIF_SCLSR(ATTR_baseAddress));
    150         sil_wrh_mem(SCIF_SCFSR(ATTR_baseAddress), 0U);
    151         sil_wrh_mem(SCIF_SCLSR(ATTR_baseAddress), 0U);
    152         sil_wrh_mem(SCIF_SCSCR(ATTR_baseAddress), SCIF_SCSCR_INTCLK);
    153         sil_wrh_mem(SCIF_SCSMR(ATTR_baseAddress), SCIF_SCSMR_CKS1);
    154         sil_wrh_mem(SCIF_SCEMR(ATTR_baseAddress), 0U);
    155         sil_wrb_mem(SCIF_SCBRR(ATTR_baseAddress), (uint8_t) brr);
    156         sil_wrh_mem(SCIF_SCFCR(ATTR_baseAddress),
     144                (void) sil_reh_mem(SCIF_SCFSR(ATTR_baseAddress));
     145                (void) sil_reh_mem(SCIF_SCLSR(ATTR_baseAddress));
     146                sil_wrh_mem(SCIF_SCFSR(ATTR_baseAddress), 0U);
     147                sil_wrh_mem(SCIF_SCLSR(ATTR_baseAddress), 0U);
     148                sil_wrh_mem(SCIF_SCSCR(ATTR_baseAddress), SCIF_SCSCR_INTCLK);
     149                sil_wrh_mem(SCIF_SCSMR(ATTR_baseAddress),
     150                                                        SCIF_SCSMR_ASYNC|ATTR_mode|SCIF_SCSMR_CKS1);
     151                sil_wrh_mem(SCIF_SCEMR(ATTR_baseAddress), 0U);
     152                sil_wrb_mem(SCIF_SCBRR(ATTR_baseAddress), (uint8_t) brr);
     153                sil_wrh_mem(SCIF_SCFCR(ATTR_baseAddress),
    157154                                        SCIF_SCFCR_RSTRG_15|SCIF_SCFCR_RTRG_1|SCIF_SCFCR_TTRG_8);
    158         sil_wrh_mem(SCIF_SCSCR(ATTR_baseAddress),
     155                sil_wrh_mem(SCIF_SCSCR(ATTR_baseAddress),
    159156                                        SCIF_SCSCR_TE|SCIF_SCSCR_RE|SCIF_SCSCR_INTCLK);
    160157
    161         while ((sil_reh_mem(SCIF_SCFSR(ATTR_baseAddress)) & SCIF_SCFSR_RDF) != 0U) {
    162                 (void) sil_reb_mem(SCIF_SCFRDR(ATTR_baseAddress));
    163                 sil_wrh_mem(SCIF_SCFSR(ATTR_baseAddress), (uint16_t) ~(SCIF_SCFSR_RDF));
    164         }
    165         sil_wrh_mem(SCIF_SCFSR(ATTR_baseAddress), 0U);
    166 
    167         VAR_initialized = true;
     158                while ((sil_reh_mem(SCIF_SCFSR(ATTR_baseAddress)) & SCIF_SCFSR_RDF)
     159                                                                                                                                        != 0U) {
     160                        (void) sil_reb_mem(SCIF_SCFRDR(ATTR_baseAddress));
     161                        sil_wrh_mem(SCIF_SCFSR(ATTR_baseAddress),
     162                                                        (uint16_t) ~(SCIF_SCFSR_RDF));
     163                }
     164                sil_wrh_mem(SCIF_SCFSR(ATTR_baseAddress), 0U);
     165
     166                VAR_opened = true;
     167        }
    168168}
    169169
     
    176176        CELLCB  *p_cellcb = GET_CELLCB(idx);
    177177
    178         sil_wrh_mem(SCIF_SCSCR(ATTR_baseAddress), 0U);
     178        if (VAR_opened) {
     179                sil_wrh_mem(SCIF_SCSCR(ATTR_baseAddress), 0U);
     180
     181                VAR_opened = false;
     182        }
    179183}
    180184
     
    284288        }
    285289}
     290
     291/*
     292 *  SIOドライバの終了処理
     293 */
     294void
     295eTerminate_main(CELLIDX idx)
     296{
     297        CELLCB  *p_cellcb = GET_CELLCB(idx);
     298
     299        if (VAR_opened) {
     300                /*
     301                 *  送信FIFOが空になるまで待つ
     302                 */
     303                while ((sil_reh_mem(SCIF_SCFSR(ATTR_baseAddress))
     304                                                                                        & SCIF_SCFSR_TEND) == 0U) ;
     305                /*
     306                 *  ポートのクローズ
     307                 */
     308                eSIOPort_close(idx);
     309        }
     310}
  • EcnlProtoTool/trunk/asp3_dcre/arch/arm_gcc/rza1/tSCIF.cdl

    r321 r429  
    55 *  Copyright (C) 2015 by Ushio Laboratory
    66 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    7  *  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    6161        entry   siHandlerBody   eiRxISR;
    6262        entry   siHandlerBody   eiTxISR;
     63        entry   sRoutineBody    eTerminate;
    6364
    6465        attr {
    6566                uintptr_t       baseAddress;    /* SCIFレジスタのベースアドレス */
    66                 uint32_t        baudRate;               /* ボーレートの設定値 */
     67                uint16_t        mode;                   /* モードレジスタの設定値 */
     68                uint32_t        baudRate;               /* ボーレート */
    6769        };
    6870        var {
    69                 bool_t          initialized = false;    /* 初期化済み */
     71                bool_t          opened = false; /* オープン済み */
    7072        };
    7173};
  • EcnlProtoTool/trunk/asp3_dcre/arch/gcc/tool_stddef.h

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2004-2011 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    9090 *
    9191 *  TOPPERS_STDINT_TYPE1: char/short/int/long longのビット長がそれぞれ
    92  *                        8/16/32/64ビットで,ポインタのビット長がlong
    93  *                        のビット長と一致する場合
     92 *                        8/16/32/64ビットで,size_tとポインタのビット
     93 *                        長がlongのビット長と一致する場合
    9494 */
    9595#ifdef TOPPERS_STDINT_TYPE1
     
    177177#define INT_LEAST8_MIN          INT8_MIN
    178178#define UINT_LEAST8_MAX         INT8_MAX
     179
     180#define SIZE_MAX                        ULONG_MAX
    179181
    180182#endif /* TOPPERS_STDINT_TYPE1 */
  • EcnlProtoTool/trunk/asp3_dcre/arch/tracelog/tTraceLog.c

    r331 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2005-2019 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    4848#include "kernel/task.h"
    4949#include "kernel/time_event.h"
     50#ifdef TOPPERS_SUPPORT_PROTECT
     51#include "kernel/domain.h"
     52#endif /* TOPPERS_SUPPORT_PROTECT */
    5053#include <sil.h>
    5154#include <log_output.h>
     
    5659 *
    5760 *  デフォルトでは,ログ時刻として,高分解能タイマのカウント値を用いて
    58  *  いる.ターゲット依存で変更する場合には,SYSLOG_GET_LOGTIMに,ログ時
     61 *  いる.ターゲット依存で変更する場合には,TRACE_GET_LOGTIMに,ログ時
    5962 *  刻を取り出すマクロを定義する.
    6063 */
    61 #ifndef SYSLOG_GET_LOGTIM
    62 #define SYSLOG_GET_LOGTIM(p_logtim) \
     64#ifndef TRACE_GET_LOGTIM
     65#define TRACE_GET_LOGTIM(p_logtim) \
    6366                                (*(p_logtim) = target_hrt_get_current())
    64 #endif /* SYSLOG_GET_TIM */
    65 
    66 /*
    67  *  トレースログの開始
     67#endif /* TRACE_GET_TIM */
     68
     69/*
     70 *  トレースログの開始(受け口関数)
    6871 */
    6972ER
     
    8184
    8285/*
    83  *  トレースログの書込み
     86 *  トレースログの書込み(受け口関数)
    8487 */
    8588ER
     
    9497                 *  トレース時刻の設定
    9598                 */
    96                 SYSLOG_GET_LOGTIM(&(((SYSLOG *) p_trace)->logtim));
     99                TRACE_GET_LOGTIM(&(((SYSLOG *) p_trace)->logtim));
    97100
    98101                /*
     
    121124
    122125/*
    123  *  トレースログの読出し
     126 *  トレースログの読出し(受け口関数)
    124127 */
    125128ER
     
    203206        p_tcb = (TCB *) info;
    204207        if (p_tcb == NULL) {
    205                 tskid = 0;
     208                tskid = TSK_NONE;
    206209        }
    207210        else {
     
    240243}
    241244
     245#ifdef TOPPERS_SUPPORT_PROTECT
     246
     247static intptr_t
     248get_somid(intptr_t info)
     249{
     250        SOMINIB *p_sominib;
     251        ID              somid;
     252
     253        p_sominib = (SOMINIB *) info;
     254        if (p_sominib == NULL) {
     255                somid = TSOM_STP;
     256        }
     257        else {
     258                somid = SOMID(p_sominib);
     259        }
     260        return((intptr_t) somid);
     261}
     262
     263static intptr_t
     264get_twd_domid(intptr_t info)
     265{
     266        TWDINIB *p_twdinib;
     267        ID              domid;
     268
     269        p_twdinib = (TWDINIB *) info;
     270        domid = (ID)(p_twdinib->p_dominib - dominib_table) + TMIN_DOMID;
     271        return((intptr_t) domid);
     272}
     273
     274#endif /* TOPPERS_SUPPORT_PROTECT */
     275
    242276/*
    243277 *  トレースログの表示
     
    267301                tracemsg = "dispatch to task %d.";
    268302                break;
     303
     304#ifdef TOPPERS_SUPPORT_PROTECT
     305        case LOG_TYPE_SCYC|LOG_START:
     306                traceinfo[0] = get_somid(p_trace->logpar[0]);
     307                tracemsg = "system cycle starts with system operating mode %d.";
     308                break;
     309        case LOG_TYPE_TWD|LOG_START:
     310                if (p_trace->logpar[0] == 0) {
     311                        tracemsg = "idle window starts.";
     312                }
     313                else {
     314                        traceinfo[0] = get_twd_domid(p_trace->logpar[0]);
     315                        tracemsg = "time window for domain %d starts.";
     316                }
     317                break;
     318#endif /* TOPPERS_SUPPORT_PROTECT */
     319
    269320        case LOG_TYPE_COMMENT:
    270321                for (i = 1; i < TNUM_LOGPAR; i++) {
     
    313364}
    314365
    315 /* 
    316  *  トレースログのダンプ
    317  */
    318 void
    319 eTraceLog_dump(void)
     366/*
     367 *  トレースログのダンプ(受け口関数)
     368 */
     369void
     370eDump_main(uintptr_t exinf)
    320371{
    321372        TRACE   trace;
     
    325376        }
    326377}
    327 
    328 /*
    329  *  トレースログのダンプ(受け口関数)
    330  */
    331 void
    332 tTraceLog_eDump_main(uintptr_t exinf)
    333 {
    334         eTraceLog_dump();
    335 }
  • EcnlProtoTool/trunk/asp3_dcre/arch/tracelog/tTraceLog.cdl

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2015 by Ushio Laboratory
    76 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    98 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    109 *
     
    6867         */
    6968        ER              read([out] TRACE *p_trace);
    70 
    71         /*
    72          *  トレースログのダンプ
    73          */
    74         void    dump(void);
    7569};
    7670
     
    8175celltype tTraceLog {
    8276        entry   sTraceLog               eTraceLog;
    83         entry   sRoutineBody    eDump;          /* 終了処理ルーチンとの接続 */
    84         call    sPutLog                 cPutLog;        /* 低レベル出力との接続 */
     77        entry   sRoutineBody    eDump;          /* トレースログのダンプ */
     78        call    sPutLog                 cPutLog;        /* ダンプ先との接続 */
    8579
    8680        attr {
  • EcnlProtoTool/trunk/asp3_dcre/arch/tracelog/trace_log.h

    r331 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2004-2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    4141
    4242/*
    43  *              トレースログに関する設定
     43 *              トレースログ機能のヘッダファイル
    4444 *
    4545 *  このインクルードファイルは,target_kernel_impl.hおよび
    46  *  target_syssvc.hのみからインクルードされる.また,トレースログ機能の
    47  *  初期化や記録の開始/停止,トレースログのダンプを行うプログラムから
    48  *  ンクルードすることを想定している.
    49  */
    50 
    51 #ifndef TOPPERS_TRACE_CONFIG_H
    52 #define TOPPERS_TRACE_CONFIG_H
     46 *  target_syssvc.hからインクルードされる.また,トレースログ機能の初
     47 *  期化や記録の開始/停止,トレースログのダンプを行うプログラムからイ
     48 *  ンクルードすることを想定している.
     49 */
     50
     51#ifndef TOPPERS_TRACE_LOG_H
     52#define TOPPERS_TRACE_LOG_H
    5353
    5454/*
     
    7575
    7676/*
    77  *  TECSで記述されたテストプログラム用のサービスを直接呼び出すための定義
     77 *  TECSで記述されたトレースログ機能を直接呼び出すための定義
    7878 *
    7979 *  C言語で記述されたアプリケーションから,TECSで記述されたトレースログ
     
    134134
    135135Inline void
    136 trace_write_1(uint_t type, intptr_t arg1)
     136trace_write_1(uint_t type, LOGPAR arg1)
    137137{
    138138        TRACE   trace;
     
    144144
    145145Inline void
    146 trace_write_2(uint_t type, intptr_t arg1, intptr_t arg2)
     146trace_write_2(uint_t type, LOGPAR arg1, LOGPAR arg2)
    147147{
    148148        TRACE   trace;
     
    155155
    156156Inline void
    157 trace_write_3(uint_t type, intptr_t arg1, intptr_t arg2, intptr_t arg3)
     157trace_write_3(uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
    158158{
    159159        TRACE   trace;
     
    174174
    175175#define trace_1(type, arg1) \
    176                                 trace_write_1(type, (intptr_t)(arg1))
     176                                trace_write_1(type, (LOGPAR)(arg1))
    177177
    178178#define trace_2(type, arg1, arg2) \
    179                                 trace_write_2(type, (intptr_t)(arg1), (intptr_t)(arg2))
     179                                trace_write_2(type, (LOGPAR)(arg1), (LOGPAR)(arg2))
    180180
    181181#define trace_3(type, arg1, arg2, arg3) \
    182                                 trace_write_3(type, (intptr_t)(arg1), (intptr_t)(arg2), \
    183                                                                                                                 (intptr_t)(arg3))
     182                                trace_write_3(type, (LOGPAR)(arg1), (LOGPAR)(arg2), \
     183                                                                                                                (LOGPAR)(arg3))
    184184
    185185/*
    186186 *  トレースログのダンプ
    187  *
    188  *  トレースログをダンプする.終了処理ルーチンとして登録することも想定
    189  *  している.引数として,ダンプ先となる文字出力関数へのポインタを渡す.
    190  *  ターゲット依存の低レベル文字出力を利用する場合には,target_putcを渡
    191  *  す.
    192187 */
    193188Inline void
     
    203198 */
    204199#define LOG_TSKSTAT(p_tcb)              trace_2(LOG_TYPE_TSKSTAT, p_tcb, p_tcb->tstat)
     200
     201#define LOG_DSP_LEAVE(p_tcb)    trace_1(LOG_TYPE_DSP|LOG_LEAVE, p_tcb)
     202
     203#ifdef TOPPERS_SUPPORT_PROTECT
     204#define LOG_SCYC_START(p_sominib)       trace_1(LOG_TYPE_SCYC|LOG_START, p_sominib)
     205#define LOG_TWD_START(p_twdinib)        trace_1(LOG_TYPE_TWD|LOG_START, p_twdinib)
     206#endif /* TOPPERS_SUPPORT_PROTECT */
    205207
    206208#define LOG_TSYSLOG_ESYSLOG_WRITE_ENTER(priority, p_syslog) \
    207209                                                                trace_wri_log((TRACE *) p_syslog)
    208210
    209 #endif /* TOPPERS_TRACE_CONFIG_H */
     211#endif /* TOPPERS_TRACE_LOG_H */
  • EcnlProtoTool/trunk/asp3_dcre/cfg/GenFile.rb

    r321 r429  
    3737#  の責任を負わない.
    3838#
    39 #  $Id$
     39#  $Id: GenFile.rb 111 2016-03-16 23:50:27Z ertl-hiro $
    4040#
    4141
  • EcnlProtoTool/trunk/asp3_dcre/cfg/MANIFEST

    r270 r429  
     1PACKAGE cfg
     2VERSION 1.5.0
     3
    14MANIFEST
    25cfg.rb
  • EcnlProtoTool/trunk/asp3_dcre/cfg/SRecord.rb

    r321 r429  
    3636#  の責任を負わない.
    3737#
    38 #  $Id$
     38#  $Id: SRecord.rb 161 2018-12-12 00:45:04Z ertl-hiro $
    3939#
    4040
     
    170170    end
    171171  end
     172
     173  # 文字列としてのデータ取得
     174  def get_string(address)
     175    str = ""
     176    targetChar = get_data(address, 1).hex
     177    while (!targetChar.nil? && targetChar != 0)
     178      str += targetChar.chr
     179      address += 1
     180      targetChar = get_data(address, 1).hex
     181    end
     182    return(str)
     183  end
    172184end
  • EcnlProtoTool/trunk/asp3_dcre/cfg/cfg.rb

    r331 r429  
    1 #!/usr/bin/env ruby
     1#!/usr/bin/env ruby -Eutf-8 -w
    22# -*- coding: utf-8 -*-
    33#
     
    55#
    66#  Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    7 #  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     7#  Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    88#              Graduate School of Information Science, Nagoya Univ., JAPAN
    99#
     
    3737#  の責任を負わない.
    3838#
    39 #  $Id$
     39#  $Id: cfg.rb 175 2019-06-19 01:51:58Z ertl-hiro $
    4040#
    4141
     
    5656#
    5757# 共通
    58 VERSION = "1.2.2"
     58VERSION = "1.5.0"
    5959
    6060# cfg1_out関係
    61 CFG1_PREFIX        = "TOPPERS_cfg_"
    62 CFG1_MAGIC_NUM     = "TOPPERS_magic_number"
    63 CFG1_SIZEOF_SIGNED = "TOPPERS_sizeof_signed_t"
    64 CFG1_OUT_C         = "cfg1_out.c"
    65 CFG1_OUT_DB        = "cfg1_out.db"
    66 CFG1_OUT_SREC      = "cfg1_out.srec"
    67 CFG1_OUT_SYMS      = "cfg1_out.syms"
    68 CFG1_OUT_TIMESTAMP = "cfg1_out.timestamp"
    69 CFG1_OUT_TARGET_H  = "target_cfg1_out.h"
     61CFG1_PREFIX         = "TOPPERS_cfg_"
     62CFG1_MAGIC_NUM      = "TOPPERS_magic_number"
     63CFG1_SIZEOF_SIGNED  = "TOPPERS_sizeof_signed_t"
     64CFG1_SIZEOF_INTPTR  = "TOPPERS_sizeof_intptr_t"
     65CFG1_SIZEOF_CHARPTR = "TOPPERS_sizeof_char_ptr_t"
     66CFG1_OUT_C          = "cfg1_out.c"
     67CFG1_OUT_DB         = "cfg1_out.db"
     68CFG1_OUT_SREC       = "cfg1_out.srec"
     69CFG1_OUT_SYMS       = "cfg1_out.syms"
     70CFG1_OUT_TIMESTAMP  = "cfg1_out.timestamp"
     71CFG1_OUT_TARGET_H   = "target_cfg1_out.h"
    7072
    7173# cfg2_out関係
     
    105107$noParseError = 0
    106108def parse_error(cfgFile, message)
    107   error(message, "#{cfgFile.getFileName()}:#{cfgFile.getLineNo}:")
     109  error(message, "#{cfgFile.getFileName}:#{cfgFile.getLineNo}:")
    108110  if ($noParseError += 1) >= 10
    109111    abort("too many errors emitted, stopping now")
     
    113115# システムコンフィギュレーションファイルの構文解析時の警告
    114116def parse_warning(cfgFile, message)
    115   warning(message, "#{cfgFile.getFileName()}:#{cfgFile.getLineNo}:")
     117  warning(message, "#{cfgFile.getFileName}:#{cfgFile.getLineNo}:")
    116118end
    117119
     
    155157def error_ercd(errorCode, params, message)
    156158  error_api(params, "#{errorCode}: #{message}")
    157 end
    158 
    159 # 静的API処理時の警告(エラーコード付き)
    160 def warning_ercd(errorCode, params, message)
    161   warning_api(params, "#{errorCode}: #{message}")
    162159end
    163160
     
    316313  # ハッシュのキーとして使う時の比較も数値情報で行う
    317314  def eql?(other)
    318     @val == other.val
     315    @val == other
    319316  end
    320317
     
    390387    if symbolData.has_key?(:VALUE)
    391388      eval("$#{symbolName} = #{symbolData[:VALUE]}")
     389      if symbolData.has_key?(:NUMSTRVAR)
     390        eval("$#{symbolData[:NUMSTRVAR]} = " \
     391                                        "NumStr.new(symbolData[:VALUE], symbolData[:EXPR])")
     392      end
    392393    end
    393394  end
     
    431432
    432433#
     434#  インクルードディレクティブ(#include)の生成
     435#
     436def GenerateIncludes(genFile)
     437  $cfgFileInfo.each do |cfgInfo|
     438    if cfgInfo.has_key?(:DIRECTIVE)
     439      genFile.add(cfgInfo[:DIRECTIVE])
     440    end
     441  end
     442end
     443
     444#
    433445#  パス3の処理
    434446#
     
    439451  db = PStore.new(CFG2_OUT_DB)
    440452  db.transaction(true) do
    441     $apiDefinition = db[:apiDefinition]
    442     $symbolValueTable = db[:symbolValueTable]
    443     $cfgFileInfo = db[:cfgFileInfo]
    444     $includeFiles = db[:includeFiles]
    445     $cfgData = db[:cfgData]
    446     $asmLabel = db[:asmLabel]
    447     $endianLittle = db[:endianLittle]
    448     $cfg2Data = db[:cfg2Data]
    449   end
    450   $cfg3Data = {}
     453    db.roots.each do |var|
     454      eval("$#{var} = db[:#{var}]")
     455    end
     456  end
    451457
    452458  #
     
    465471  #  パス4に引き渡す情報をファイルに生成
    466472  #
    467   if $omitOutputDb.nil?
     473  if !$omitOutputDb
    468474    db = PStore.new(CFG3_OUT_DB)
    469475    db.transaction do
    470       db[:apiDefinition] = $apiDefinition
    471       db[:symbolValueTable] = $symbolValueTable
    472       db[:cfgFileInfo] = $cfgFileInfo
    473       db[:includeFiles] = $includeFiles
    474       db[:cfgData] = $cfgData
    475       db[:asmLabel] = $asmLabel
    476       db[:endianLittle] = $endianLittle
    477       db[:cfg3Data] = $cfg3Data
     476      $globalVars.each do |var|
     477        eval("db[:#{var}] = $#{var}")
     478      end
    478479    end
    479480  end
     
    489490  db = PStore.new(CFG3_OUT_DB)
    490491  db.transaction(true) do
    491     $apiDefinition = db[:apiDefinition]
    492     $symbolValueTable = db[:symbolValueTable]
    493     $cfgFileInfo = db[:cfgFileInfo]
    494     $includeFiles = db[:includeFiles]
    495     $cfgData = db[:cfgData]
    496     $asmLabel = db[:asmLabel]
    497     $endianLittle = db[:endianLittle]
    498     $cfg3Data = db[:cfg3Data] || db[:cfg2Data]
     492    db.roots.each do |var|
     493      eval("$#{var} = db[:#{var}]")
     494    end
    499495  end
    500496
     
    557553$romImageFileName = nil
    558554$romSymbolFileName = nil
    559 $dependencyFileName = nil
    560555$idInputFileName = nil
    561556$idOutputFileName = nil
     557$dependencyFileName = nil
     558$omitOutputDb = false
     559$supportDomain = false
     560$supportClass = false
    562561
    563562#
    564563#  オプションの処理
    565564#
    566 OptionParser.new(banner="Usage: cfg.rb [options] CONFIG-FILE", 40) do |opt|
     565OptionParser.new("Usage: cfg.rb [options] CONFIG-FILE", 40) do |opt|
    567566  opt.version = VERSION
     567  opt.release = nil
    568568  opt.on("-k KERNEL", "--kernel KERNEL", "kernel profile name") do |val|
    569569    $kernel = val
     
    605605    $omitOutputDb = true
    606606  end
     607  opt.on("--enable-domain", "enable DOMAIN support") do
     608        $supportDomain = true
     609  end
     610  opt.on("--enable-class", "enable CLASS support") do
     611        $supportClass = true
     612  end
    607613  opt.on("-v", "--version", "show version number") do
    608     abort(opt.ver)
     614    puts(opt.ver)
     615    exit(0)
    609616  end
    610617  opt.on("-h", "--help", "show help (this)") do
    611     abort(opt.help)
     618    puts(opt.help)
     619    exit(0)
    612620  end
    613621  opt.parse!(ARGV)
     
    642650        $supportDomain = true
    643651when /^fmp/
     652        $supportClass = true
     653when /^hrmp/
     654        $supportDomain = true
    644655        $supportClass = true
    645656end
  • EcnlProtoTool/trunk/asp3_dcre/cfg/pass1.rb

    r360 r429  
    44#
    55#  Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    6 #  Copyright (C) 2015-2017 by Embedded and Real-Time Systems Laboratory
     6#  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    77#              Graduate School of Information Science, Nagoya Univ., JAPAN
    88#
     
    3636#  の責任を負わない.
    3737#
    38 #  $Id$
     38#  $Id: pass1.rb 165 2019-01-11 01:29:47Z ertl-hiro $
    3939#
    4040
     
    6161  "LONG_MAX"  => { EXPR: "LONG_MAX",  SIGNED: true },
    6262  "LONG_MIN"  => { EXPR: "LONG_MIN",  SIGNED: true },
    63   "ULONG_MAX" => { EXPR: "ULONG_MAX" }
     63  "ULONG_MAX" => { EXPR: "ULONG_MAX" },
     64  "SIL_ENDIAN_BIG" \
     65        => { EXPR: "true", BOOL: true, CONDITION: "defined(SIL_ENDIAN_BIG)" },
     66  "SIL_ENDIAN_LITTLE" \
     67        => { EXPR: "true", BOOL: true, CONDITION: "defined(SIL_ENDIAN_LITTLE)" }
    6468}
    6569
     
    6872#
    6973$apiDefinition = { "INCLUDE" =>
    70   { :PARAM => [ { :NAME => :file, :STRING => true }]}}
     74  { :PARAM => [ { :NAME => :file, :STRING_LITERAL => true }]}}
    7175
    7276#
     
    121125            apiParam[:EXPTYPE] = "signed_t"
    122126            apiParam[:SIGNED] = true
     127          when "^"                                      # ポインタ整数定数式パラメータ
     128            apiParam[:EXPTYPE] = "uintptr_t"
     129            apiParam[:INTPTR] = true
    123130          when "&"                                      # 一般整数定数式パラメータ
    124131            # do nothing
    125132          when "$"                                      # 文字列定数式パラメータ
    126133            apiParam[:STRING] = true
     134            apiParam[:EXPTYPE] = "char *"
    127135          else
    128136            error_exit("`#{param}' is invalid")
     
    171179                                                { skip_blanks: true, skip_lines: /^#/ })
    172180    symvalCsv.each do |record|
     181      symbol = {}
     182
    173183      # 変数名
    174184      if record[0].nil?
    175185        error_exit("invalid variable name in " \
    176186                                                "`#{symvalTableFileName}:#{symvalCsv.to_io.lineno}'")
    177       end
    178 
    179       symbol = {}
    180       variable = record[0]
     187      elsif /^(.+)\[(.+)\]$/ =~ record[0]
     188        variable = $1
     189        symbol[:NUMSTRVAR] = $2
     190      else
     191        variable = record[0]
     192      end
    181193
    182194      # 式
     
    192204        when /^[bB]/                            # 真偽値
    193205          symbol[:BOOL] = true
     206        when /^[iI]/                            # ポインタ整数値
     207          symbol[:INTPTR] = true
    194208        when /^[uU]/                            # 符号無し整数値
    195209          # 何も設定しない
     
    367381    skipSpace(cfgFile, withinApi)
    368382    if @line.nil?                                                       # ファイル末であればエラー終了
    369       error_exit("unexpexced end-of-file")
     383      error_exit("#{cfgFile.getFileName}: unexpeced end-of-file")
    370384    end
    371385  end
     
    472486    end
    473487
    474     if apiParam.has_key?(:STRING)
     488    if apiParam.has_key?(:STRING_LITERAL)
    475489      return(param.unquote)
    476490    else
     
    604618        # プリプロセッサディレクティブを読む
    605619        case @line
    606         when /^#include\b(.*)$/
    607           $includeFiles.push($1.strip)
    608         when /^#(ifdef|ifndef|if|endif|else|elif)\b/
    609           directive = { :DIRECTIVE => @line.strip }
     620        when /^#(include|ifdef|ifndef|if|endif|else|elif)\b/
     621          directive = {}
     622          directive[:DIRECTIVE] = @line.strip
     623          directive[:_FILE_] = cfgFile.getFileName
     624          directive[:_LINE_] = cfgFile.getLineNo
    610625          $cfgFileInfo.push(directive)
    611626        else
     
    619634        case apiName
    620635        when "KERNEL_DOMAIN"
    621           if $supportDomain.nil?
     636          if !$supportDomain
    622637            parse_warning(cfgFile, "`KERNEL_DOMAIN' is not supported")
    623638          end
     
    629644          @@nestDC.push("domain")
    630645        when "DOMAIN"
    631           if $supportDomain.nil?
     646          if !$supportDomain
    632647            parse_warning(cfgFile, "`DOMAIN' is not supported")
    633648          end
     
    655670          @@nestDC.push("domain")
    656671        when "CLASS"
    657           if $supportClass.nil?
     672          if !$supportClass
    658673            parse_warning(cfgFile, "`CLASS' is not supported")
    659674          end
     
    676691              includeFilePath = SearchFilePath(staticApi[:file])
    677692              if includeFilePath.nil?
    678                 parse_error(cfgFile, "`#{staticApi[:file]}' not found")
     693                error = {}
     694                error[:DIRECTIVE] = "#error '#{staticApi[:file]}' not found."
     695                error[:_FILE_] = cfgFile.getFileName
     696                error[:_LINE_] = cfgFile.getLineNo
     697                $cfgFileInfo.push(error)
    679698              else
    680699                $dependencyFiles.push(includeFilePath)
     
    694713              $cfgFileInfo.push(staticApi)
    695714            end
     715
     716            # ";"を読む
     717            skipToToken(cfgFile, false)         # 次の文字まで読み飛ばす
     718            if (/^\;(.*)$/ =~ @line)
     719              @line = $1
     720            else
     721              parse_error(cfgFile, "`;' expected after static API")
     722            end
    696723          else
    697724            parse_error(cfgFile, "unknown static API: #{apiName}")
     
    727754  #
    728755  def self.OutLineNumber(cfgInfo)
    729     @cfg1Out.add("#line #{cfgInfo[:_LINE_]} \"#{cfgInfo[:_FILE_].gsub('\\', '/')}\"")
     756    @cfg1Out.add("#line #{cfgInfo[:_LINE_]} \"#{cfgInfo[:_FILE_]}\"")
    730757  end
    731758
     
    734761  #
    735762  def self.OutClassLineNumber(cfgInfo)
    736     @cfg1Out.add("#line #{cfgInfo[:CLASS_LINE_]} \"#{cfgInfo[:CLASS_FILE_].gsub('\\', '/')}\"")
     763    @cfg1Out.add("#line #{cfgInfo[:CLASS_LINE_]} \"#{cfgInfo[:CLASS_FILE_]}\"")
    737764  end
    738765
     
    763790EOS
    764791
    765     # インクルードヘッダファイル
    766     $includeFiles.each do |file|
    767       @cfg1Out.add("#include #{file}")
     792    # インクルードディレクティブ(#include)の生成
     793    $cfgFileInfo.each do |cfgInfo|
     794      if cfgInfo.has_key?(:DIRECTIVE)
     795        OutLineNumber(cfgInfo)
     796        @cfg1Out.add(cfgInfo[:DIRECTIVE])
     797      end
    768798    end
    769799
     
    780810#include "#{CFG1_OUT_TARGET_H}"
    781811
    782 #if defined(SIL_ENDIAN_BIG) && defined(SIL_ENDIAN_LITTLE)
    783 #error Both SIL_ENDIAN_BIG and SIL_ENDIAN_LITTLE are defined.
    784 #endif
    785 #if !defined(SIL_ENDIAN_BIG) && !defined(SIL_ENDIAN_LITTLE)
    786 #error Neither SIL_ENDIAN_BIG nor SIL_ENDIAN_LITTLE is defined.
    787 #endif
    788 
    789812const uint32_t #{CFG1_MAGIC_NUM} = 0x12345678;
    790813const uint32_t #{CFG1_SIZEOF_SIGNED} = sizeof(signed_t);
     814const uint32_t #{CFG1_SIZEOF_INTPTR} = sizeof(intptr_t);
     815const uint32_t #{CFG1_SIZEOF_CHARPTR} = sizeof(char *);
    791816EOS
    792817
    793818    # 値取得シンボルの処理
    794819    $symbolValueTable.each do |symbolName, symbolData|
    795       if symbolData.has_key?(:BOOL) || symbolData.has_key?(:SIGNED)
     820      if symbolData.has_key?(:BOOL)
     821        type = "signed_t"
     822      elsif symbolData.has_key?(:INTPTR)
     823        type = "uintptr_t"
     824      elsif symbolData.has_key?(:SIGNED)
    796825        type = "signed_t"
    797826      else
     
    825854    $cfgFileInfo.each do |cfgInfo|
    826855      if cfgInfo.has_key?(:DIRECTIVE)
    827         @cfg1Out.add2(cfgInfo[:DIRECTIVE])
     856        # 条件ディレクティブを出力
     857        if cfgInfo[:DIRECTIVE] =~ /^#(ifdef|ifndef|if|endif|else|elif)\b/
     858          OutLineNumber(cfgInfo)
     859          @cfg1Out.add2(cfgInfo[:DIRECTIVE])
     860        end
    828861      else
    829862        apiDef = $apiDefinition[cfgInfo[:APINAME]]
     
    882915  $cfgFileInfo = []
    883916  $dependencyFiles = $configFileNames.dup
    884   $includeFiles = []
    885917  $domainId = { "TDOM_KERNEL" => -1, "TDOM_NONE" => -2 }
    886918  $configFileNames.each do |configFileName|
     
    939971  #  パス2に引き渡す情報をファイルに生成
    940972  #
    941   if $omitOutputDb.nil?
     973  if !$omitOutputDb
    942974    db = PStore.new(CFG1_OUT_DB)
    943975    db.transaction do
     
    945977      db[:symbolValueTable] = $symbolValueTable
    946978      db[:cfgFileInfo] = $cfgFileInfo
    947       db[:includeFiles] = $includeFiles
    948979      db[:domainId] = $domainId
    949980    end
  • EcnlProtoTool/trunk/asp3_dcre/cfg/pass2.rb

    r331 r429  
    44#
    55#  Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    6 #  Copyright (C) 2015-2017 by Embedded and Real-Time Systems Laboratory
     6#  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    77#              Graduate School of Information Science, Nagoya Univ., JAPAN
    88#
     
    3636#  の責任を負わない.
    3737#
    38 #  $Id$
     38#  $Id: pass2.rb 175 2019-06-19 01:51:58Z ertl-hiro $
    3939#
    4040
     
    5959
    6060  #
     61  #  Sレコードファイルからシンボルの文字列を取り出す
     62  #
     63  def self.GetSymbolString(symbol)
     64    if @symbolAddress.has_key?(symbol) \
     65                        && !(address = @cfg1SRec.get_value(@symbolAddress[symbol], \
     66                                                                                                $sizeOfCharPtr, false)).nil?
     67      return(@cfg1SRec.get_string(address))
     68    else
     69      return(nil)
     70    end
     71  end
     72
     73  #
    6174  #  パス1の生成物の読み込み(メインの処理)
    6275  #
     
    7285    end
    7386
    74     # マジックナンバーの取得
     87    # マジックナンバーの取得とエンディアンの設定
    7588    if @symbolAddress.has_key?(CFG1_MAGIC_NUM)
    7689      $asmLabel = ""
     
    95108    # 固定出力した変数の取得
    96109    $sizeOfSigned = GetSymbolValue($asmLabel + CFG1_SIZEOF_SIGNED, 4, false)
     110    $sizeOfIntptr = GetSymbolValue($asmLabel + CFG1_SIZEOF_INTPTR, 4, false)
     111    $sizeOfCharPtr = GetSymbolValue($asmLabel + CFG1_SIZEOF_CHARPTR, 4, false)
    97112
    98113    # 値取得シンボルの取得
     
    106121        end
    107122      else
    108         value = GetSymbolValue(symbol, $sizeOfSigned, \
     123        if symbolData.has_key?(:INTPTR)
     124          value = GetSymbolValue(symbol, $sizeOfIntptr, \
    109125                                                                                symbolData.has_key?(:SIGNED))
     126        else
     127          value = GetSymbolValue(symbol, $sizeOfSigned, \
     128                                                                                symbolData.has_key?(:SIGNED))
     129        end
    110130        if !value.nil?
    111131          symbolData[:VALUE] = value
    112132        end
     133      end
     134    end
     135
     136    # SILによるエンディアン定義のチェック
     137    if $symbolValueTable["SIL_ENDIAN_BIG"].has_key?(:VALUE)
     138      if $symbolValueTable["SIL_ENDIAN_LITTLE"].has_key?(:VALUE)
     139        error_exit("Both SIL_ENDIAN_BIG and SIL_ENDIAN_LITTLE are defined.")
     140      else
     141        if $endianLittle
     142          error_exit("Definition of SIL_ENDIAN_BIG seems to be wrong.")
     143        end
     144      end
     145    else
     146      if $symbolValueTable["SIL_ENDIAN_LITTLE"].has_key?(:VALUE)
     147        if !$endianLittle
     148          error_exit("Definition of SIL_ENDIAN_LITTLE seems to be wrong.")
     149        end
     150      else
     151        # 両方が未定義の場合のエラーチェックは,sil.hで実施する
    113152      end
    114153    end
     
    133172
    134173    #
    135     #  ドメイン生成データをコンフィギュレーションデータ($cfgData)に格納
    136     #
    137     $cfgData[:CRE_DOM] = {}
    138     $domainId.each do |domainName, domainVal|
    139       domid = NumStr.new(domainVal, domainName)
    140       $cfgData[:CRE_DOM][domainVal] = { :domid => domid }
     174    #  ドメインデータ($domData)を生成
     175    #
     176    if $supportDomain
     177      $domData = {}
     178      $domainId.each do |domainName, domainVal|
     179        domid = NumStr.new(domainVal, domainName)
     180        $domData[domainVal] = { :domid => domid }
     181      end
     182      $globalVars.push("domData")
    141183    end
    142184
     
    146188  #
    147189  #  パラメータの値を取り出す
     190  #
     191  #  生成スクリプト内で追加された静的APIの場合には,apiIndexがnilになる.
    148192  #
    149193  def self.GetParamValue(paramName, param, apiIndex, index, apiParam, cfgInfo)
     
    160204        value = nil
    161205      end
     206    elsif apiParam.has_key?(:STRING)                    # 文字列パラメータ
     207      if !apiIndex.nil?
     208        symbol = "#{$cfg1_prefix}valueof_#{paramName}_#{apiIndex}#{index}"
     209        return(GetSymbolString(symbol))
     210      else
     211        return(param)
     212      end
    162213    elsif apiParam.has_key?(:EXPTYPE)                   # 整数定数式パラメータ
    163       if apiIndex.nil?
     214      if !apiIndex.nil?
     215        symbol = "#{$cfg1_prefix}valueof_#{paramName}_#{apiIndex}#{index}"
     216        if apiParam.has_key?(:INTPTR)
     217          value = GetSymbolValue(symbol, $sizeOfIntptr, \
     218                                                                                apiParam.has_key?(:SIGNED))
     219        else
     220          value = GetSymbolValue(symbol, $sizeOfSigned, \
     221                                                                                apiParam.has_key?(:SIGNED))
     222        end
     223      else
    164224        if param.is_a?(NumStr)
    165225          return(param)
     
    167227          return(NumStr.new(param))
    168228        end
    169       else
    170         symbol = "#{$cfg1_prefix}valueof_#{paramName}_#{apiIndex}#{index}"
    171         value = GetSymbolValue(symbol, $sizeOfSigned, \
    172                                                                         apiParam.has_key?(:SIGNED))
    173       end
    174     else                                                                                # 一般定数式/文字列パラメータ
     229      end
     230    else                                                                                # 一般定数式パラメータ
    175231      return(param)
    176232    end
     
    201257
    202258    # ID番号割り当ての前処理
    203     objidParamNameList = []
    204259    $cfgFileInfo.each do |cfgInfo|
    205260      # プリプロセッサディレクティブは読み飛ばす
     
    228283            @objidValues[objidParamName][objName] = nil
    229284          end
    230           objidParamNameList.push(objidParamName)
    231285        end
    232286      end
     
    234288
    235289    # ID番号の割当て処理
    236     objidParamNameList.each do |objidParamName|
    237       objidList = @objidValues[objidParamName]
    238 
     290    @objidValues.each do |objidParamName, objidList|
    239291      # 未使用のID番号のリスト(使用したものから消していく)
    240292      unusedObjidList = (1.upto(objidList.keys.size)).to_a
     
    311363      # クラスIDを追加
    312364      if cfgInfo.has_key?(:CLASS)
    313         if apiIndex.nil?
    314           params[:class] = cfgInfo[:CLASS]
    315         else
     365        if !apiIndex.nil?
    316366          symbol = "#{$cfg1_prefix}valueof_CLASS_#{apiIndex}"
    317367          value = GetSymbolValue(symbol, $sizeOfSigned, true)
    318368          params[:class] = NumStr.new(value, cfgInfo[:CLASS])
     369        else
     370          params[:class] = cfgInfo[:CLASS]
    319371        end
    320372      end
     
    343395
    344396  #
     397  #  ID番号の割当て結果の上書き
     398  #
     399  def self.SetObjidList(objidParamName, objidList)
     400    @objidValues[objidParamName] = objidList
     401  end
     402
     403  #
    345404  #  ID番号出力ファイルの生成
    346405  #
     
    364423  db = PStore.new(CFG1_OUT_DB)
    365424  db.transaction(true) do
    366     $apiDefinition = db[:apiDefinition]
    367     $symbolValueTable = db[:symbolValueTable]
    368     $cfgFileInfo = db[:cfgFileInfo]
    369     $includeFiles = db[:includeFiles]
    370     $domainId = db[:domainId]
    371   end
    372   $cfg2Data = {}
     425    db.roots.each do |var|
     426      eval("$#{var} = db[:#{var}]")
     427    end
     428  end
     429
     430  #
     431  #  パス3以降に引き渡す情報の定義
     432  #
     433  $globalVars = [ "globalVars",
     434                  "apiDefinition",
     435                  "symbolValueTable",
     436                  "cfgFileInfo",
     437                  "cfgData",
     438                  "asmLabel",
     439                  "endianLittle" ]
    373440
    374441  #
     
    404471  #  パス3に引き渡す情報をファイルに生成
    405472  #
    406   if $omitOutputDb.nil?
     473  if !$omitOutputDb
    407474    db = PStore.new(CFG2_OUT_DB)
    408475    db.transaction do
    409       db[:apiDefinition] = $apiDefinition
    410       db[:symbolValueTable] = $symbolValueTable
    411       db[:cfgFileInfo] = $cfgFileInfo
    412       db[:includeFiles] = $includeFiles
    413       db[:cfgData] = $cfgData
    414       db[:asmLabel] = $asmLabel
    415       db[:endianLittle] = $endianLittle
    416       db[:cfg2Data] = $cfg2Data
     476      $globalVars.each do |var|
     477        eval("db[:#{var}] = $#{var}")
     478      end
    417479    end
    418480  end
  • EcnlProtoTool/trunk/asp3_dcre/configure.rb

    r331 r429  
    77#  Copyright (C) 2001-2003 by Embedded and Real-Time Systems Laboratory
    88#                              Toyohashi Univ. of Technology, JAPAN
    9 #  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     9#  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    1010#              Graduate School of Information Science, Nagoya Univ., JAPAN
    1111#
     
    4242#
    4343
     44Encoding.default_external = 'utf-8'
    4445require "optparse"
    4546require "fileutils"
     
    5657#                                               ル名)名
    5758#  -C <cdlflle>                 コンポーネント記述ファイル(.cdlファイル)名
    58 #  -U <applobjs>                他のアプリケーションプログラムファイル
     59#  -U <applobjs>                アプリケーションの追加のオブジェクトファイル
    5960#                                               (.oファイル名で指定.複数指定可)
    60 #  -S <syssvcobjs>              システムサービスのプログラムファイル
     61#  -S <syssvcobjs>              システムサービスのオブジェクトファイル
    6162#                                               (.oファイル名で指定.複数指定可)
     63#  -B <bannerobj>               バナー表示のオブジェクトファイル(.oファイル名で指定)
    6264#  -L <kernel_lib>              カーネルライブラリ(libkernel.a)のディレクトリ名
    6365#                                               (省略した場合,カーネルライブラリもmakeする)
     
    6769#  -m <tempmakefile>    Makefileのテンプレートのファイル名の指定(デフォル
    6870#                                               トはsampleディレクトリのMakefile)
    69 #  -d <depdir>                  依存関係ファイルのディレクトリ名(デフォルトはdeps)
     71#  -d <objdir>                  中間オブジェクトファイルと依存関係ファイルを置く
     72#                                               ディレクトリ名(デフォルトはobjs)
    7073#  -w                                   TECSを使用しない
     74#  -W <tecsdir>                 TECS関係ファイルのディレクトリ名(デフォルトはソー
     75#                                               スファイルのディレクトリの下のtecsgen)
    7176#  -r                                   トレースログ記録のサンプルコードを使用するかどうか
    7277#                                               の指定
     
    7782#  -o <options>                 コンパイルオプション(COPTSに追加)
    7883#  -O <options>                 シンボル定義オプション(CDEFSに追加)
    79 #  -k <options>                 リンカオプション(LDFLAGS等に追加)
     84#  -k <options>                 リンカオプション(LDFLAGSに追加)
     85#  -b <options>                 リンカオプション(LIBSに追加)
    8086#  -e <tinetdir>                TINET のソースの置かれているディレクトリ
    8187#  -i <net_if>                  ネットワークインタフェース(TINETが有効の場合は必須)
     
    111117#
    112118#  % ../configure.rb -T gr_sakura_gcc -A sample1n \
    113 #                                       -e tinet -i ether -v if_rx62n -n inet4 -s tcp -U sample1.o
     119#                                       -e tinet -i ether -v if_mbed -n inet4 -s tcp -U sample1.o
    114120#       TINETを有効にする.
    115121
     
    119125$target = nil
    120126$appldirs = []
     127$applname = nil
     128$option_t = false
     129$cfgfile = nil
     130$cdlfile = nil
    121131$applobjs = []
    122132$syssvcobjs = []
     133$bannerobj = nil
    123134$kernel_lib = ""
    124135$kernel_funcobjs = ""
     136$srcdir = nil
    125137$srclang = "c"
    126 $depdir = "deps"
     138$tempmakefile = nil
     139$objdir = "objs"
    127140$omit_tecs = ""
     141$tecsdir = nil
    128142$enable_trace = ""
    129143$devtooldir = ""
    130144$ruby = "ruby"
     145$cfg = nil
     146$tecsgen = nil
    131147$copts = []
    132148$cdefs = []
    133149$ldflags = []
     150$libs = []
    134151
    135152#
     
    141158  end
    142159  opt.on("-a appldirs",         "application directories") do |val|
    143     $appldirs += val.split("\s+")
     160    $appldirs += val.split(/\s+/)
    144161  end
    145162  opt.on("-A applname",         "application program name") do |val|
     
    156173  end
    157174  opt.on("-U applobjs",         "additional application object files") do |val|
    158     $applobjs += val.split("\s+")
     175    $applobjs += val.split(/\s+/)
    159176  end
    160177  opt.on("-S syssvcobjs",       "system service object files") do |val|
    161     $syssvcobjs += val.split("\s+")
     178    $syssvcobjs += val.split(/\s+/)
     179  end
     180  opt.on("-B bannerobj",        "banner display object file") do |val|
     181    $bannerobj = val
    162182  end
    163183  opt.on("-L kernel_lib",       "directory of built kernel library") do |val|
     
    165185  end
    166186  opt.on("-f", "each function is complied separately in kernel") do |val|
    167     $kernel_funcobjs = true
     187    $kernel_funcobjs = "true"
    168188  end
    169189  opt.on("-D srcdir",           "path of source code directory") do |val|
     
    176196    $tempmakefile = val
    177197  end
    178   opt.on("-d depdir",           "dependency relation file directory") do |val|
    179     $depdir = val
     198  opt.on("-d objdir",           "relocatable object file directory") do |val|
     199    $objdir = val
    180200  end
    181201  opt.on("-w",                          "TECS is not used at all") do |val|
    182     $omit_tecs = true
     202    $omit_tecs = "true"
     203  end
     204  opt.on("-W tecsdir",          "path of TECS file directory") do |val|
     205    $tecsdir = val
    183206  end
    184207  opt.on("-r",                          "use the sample code for trace log") do |val|
    185     $enable_trace = true
     208    $enable_trace = "true"
    186209  end
    187210  opt.on("-V devtooldir",       "development tools directory") do |val|
     
    198221  end
    199222  opt.on("-o options",          "compiler options") do |val|
    200     $copts += val.split("\s+")
     223    $copts += val.split(/\s+/)
    201224  end
    202225  opt.on("-O options",          "symbol definition options") do |val|
    203     $cdefs += val.split("\s+")
     226    $cdefs += val.split(/\s+/)
    204227  end
    205228  opt.on("-k options",          "linker options") do |val|
    206     $ldflags += val.split("\s+")
     229    $ldflags += val.split(/\s+/)
     230  end
     231  opt.on("-b options",          "linker options for linking libraries") do |val|
     232    $libs += val.split(/\s+/)
    207233  end
    208234  opt.on("-e options",          "path of TINET directory") do |val|
     
    236262
    237263#
    238 #  変数のデフォルト値
     264#  変数のデフォルト値(文字列変数のデフォルト値は初期化で与える)
    239265#
    240266if $appldirs.empty?
     
    242268end
    243269$applname ||= "sample1"
    244 if $option_t.nil?
    245   $applobjs.unshift($applname + ".o")
    246 end
    247270$cfgfile ||= $applname + ".cfg"
    248271$cdlfile ||= $applname + ".cdl"
     272$applobjs.unshift($applname + ".o") if !$option_t
     273$bannerobj ||= ($omit_tecs == "") ? "tBannerMain.o" : "banner.o"
    249274if $srcdir.nil?
    250275  # ソースディレクトリ名を取り出す
     
    261286end
    262287$tempmakefile ||= $srcdir + "/sample/Makefile"
     288$tecsdir ||= "\$(SRCDIR)/tecsgen"
    263289$cfg ||= $ruby + " \$(SRCDIR)/cfg/cfg.rb"
    264 $tecsgen ||= $ruby + " \$(SRCDIR)/tecsgen/tecsgen.rb"
     290$tecsgen ||= $ruby + " \$(TECSDIR)/tecsgen.rb"
    265291
    266292#
     
    294320$vartable["APPLOBJS"] = $applobjs.join(" ")
    295321$vartable["SYSSVCOBJS"] = $syssvcobjs.join(" ")
     322$vartable["BANNEROBJ"] = $bannerobj
    296323$vartable["KERNEL_LIB"] = $kernel_lib
    297324$vartable["KERNEL_FUNCOBJS"] = $kernel_funcobjs
     
    299326$vartable["SRCABSDIR"] = $srcabsdir
    300327$vartable["SRCLANG"] = $srclang
    301 $vartable["DEPDIR"] = $depdir
     328$vartable["OBJDIR"] = $objdir
    302329$vartable["OMIT_TECS"] = $omit_tecs
     330$vartable["TECSDIR"] = $tecsdir
    303331$vartable["ENABLE_TRACE"] = $enable_trace
    304332$vartable["DEVTOOLDIR"] = $devtooldir
     
    309337$vartable["CDEFS"] = $cdefs.join(" ")
    310338$vartable["LDFLAGS"] = $ldflags.join(" ")
     339$vartable["LIBS"] = $libs.join(" ")
    311340$vartable["OBJEXT"] = GetObjectExtension()
    312341$vartable["TINETDIR"] = $tinetdir
     
    362391#  依存関係ファイルのディレクトリの作成
    363392#
    364 if !File.directory?($depdir)
    365   Dir.mkdir($depdir)
    366 end
     393if !File.directory?($objdir)
     394  Dir.mkdir($objdir)
     395end
  • EcnlProtoTool/trunk/asp3_dcre/include/kernel.h

    r331 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2004-2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    8080#endif /* TOPPERS_TARGET_SUPPORT_ENA_INT */
    8181
     82#ifdef TOPPERS_TARGET_SUPPORT_CLR_INT
     83#define TOPPERS_SUPPORT_CLR_INT                 /* clr_intがサポートされている */
     84#endif /* TOPPERS_TARGET_SUPPORT_CLR_INT */
     85
     86#ifdef TOPPERS_TARGET_SUPPORT_RAS_INT
     87#define TOPPERS_SUPPORT_RAS_INT                 /* ras_intがサポートされている */
     88#endif /* TOPPERS_TARGET_SUPPORT_RAS_INT */
     89
     90#ifdef TOPPERS_TARGET_SUPPORT_PRB_INT
     91#define TOPPERS_SUPPORT_PRB_INT                 /* prb_intがサポートされている */
     92#endif /* TOPPERS_TARGET_SUPPORT_PRB_INT */
     93
    8294#define TOPPERS_SUPPORT_DYNAMIC_CRE             /* 動的生成機能拡張 */
    8395
     
    195207        PRI                     itskpri;        /* タスクの起動時優先度 */
    196208        size_t          stksz;          /* タスクのスタック領域のサイズ */
    197         STK_T           *stk;           /* タスクのスタック領域の先頭番地 */
     209        STK_T           *stk;           /* タスクのスタック領域の先頭番地 */
    198210} T_CTSK;
    199211
     
    235247        ATR             dtqatr;         /* データキュー属性 */
    236248        uint_t  dtqcnt;         /* データキュー管理領域に格納できるデータ数 */
    237         void    *dtqmb;         /* データキュー管理領域の先頭番地 */
     249        void    *dtqmb;         /* データキュー管理領域の先頭番地 */
    238250} T_CDTQ;
    239251
     
    249261        PRI             maxdpri;        /* 優先度データキューに送信できるデータ優先度の最
    250262                                                   大値 */
    251         void    *pdqmb;         /* 優先度データキュー管理領域の先頭番地 */
     263        void    *pdqmb;         /* 優先度データキュー管理領域の先頭番地 */
    252264} T_CPDQ;
    253265
     
    275287        uint_t  blkcnt;         /* 獲得できる固定長メモリブロックの数 */
    276288        uint_t  blksz;          /* 固定長メモリブロックのサイズ */
    277         MPF_T   *mpf;           /* 固定長メモリプール領域の先頭番地 */
    278         void    *mpfmb;         /* 固定長メモリプール管理領域の先頭番地 */
     289        MPF_T   *mpf;           /* 固定長メモリプール領域の先頭番地 */
     290        void    *mpfmb;         /* 固定長メモリプール管理領域の先頭番地 */
    279291} T_CMPF;
    280292
     
    471483extern ER               dis_int(INTNO intno) throw();
    472484extern ER               ena_int(INTNO intno) throw();
     485extern ER               clr_int(INTNO intno) throw();
     486extern ER               ras_int(INTNO intno) throw();
     487extern ER_BOOL  prb_int(INTNO intno) throw();
    473488extern ER               chg_ipm(PRI intpri) throw();
    474489extern ER               get_ipm(PRI *p_intpri) throw();
     
    508523#define idis_int(intno)                                         dis_int(intno)
    509524#define iena_int(intno)                                         ena_int(intno)
     525#define iclr_int(intno)                                         clr_int(intno)
     526#define iras_int(intno)                                         ras_int(intno)
     527#define iprb_int(intno)                                         prb_int(intno)
    510528#define ixsns_dpn(p_excinf)                                     xsns_dpn(p_excinf)
    511529
     
    613631#define TKERNEL_MAKER   UINT_C(0x0118)  /* カーネルのメーカーコード */
    614632#define TKERNEL_PRID    UINT_C(0x0007)  /* カーネルの識別番号 */
    615 #define TKERNEL_SPVER   UINT_C(0xf631)  /* カーネル仕様のバージョン番号 */
    616 #define TKERNEL_PRVER   UINT_C(0x3010)  /* カーネルのバージョン番号 */
     633#define TKERNEL_SPVER   UINT_C(0xf634)  /* カーネル仕様のバージョン番号 */
     634#define TKERNEL_PRVER   UINT_C(0x3050)  /* カーネルのバージョン番号 */
    617635
    618636/*
     
    632650 *  システム時刻の調整できる範囲(単位:μ秒)
    633651 */
    634 #define TMIN_ADJTIM             -1000000                /* システム時刻の最小調整時間 */
     652#define TMIN_ADJTIM             (-1000000)              /* システム時刻の最小調整時間 */
    635653#define TMAX_ADJTIM             1000000                 /* システム時刻の最大調整時間 */
    636654
     
    654672#define ROUND_MPF_T(blksz)      TOPPERS_ROUND_SZ(blksz, sizeof(MPF_T))
    655673
     674#define COUNT_MB_T(sz)          TOPPERS_COUNT_SZ(sz, sizeof(MB_T))
     675#define ROUND_MB_T(sz)          TOPPERS_ROUND_SZ(sz, sizeof(MB_T))
     676
    656677#define TSZ_DTQMB(dtqcnt)       (sizeof(intptr_t) * (dtqcnt))
    657 #define TCNT_DTQMB(dtqcnt)      TOPPERS_COUNT_SZ(TSZ_DTQMB(dtqcnt), sizeof(MB_T))
     678#define TCNT_DTQMB(dtqcnt)      COUNT_MB_T(TSZ_DTQMB(dtqcnt))
    658679
    659680#ifndef TSZ_PDQMB
    660681#define TSZ_PDQMB(pdqcnt)       (sizeof(intptr_t) * 3 * (pdqcnt))
    661682#endif /* TSZ_PDQMB */
    662 #define TCNT_PDQMB(pdqcnt)      TOPPERS_COUNT_SZ(TSZ_PDQMB(pdqcnt), sizeof(MB_T))
     683#define TCNT_PDQMB(pdqcnt)      COUNT_MB_T(TSZ_PDQMB(pdqcnt))
    663684
    664685#define TSZ_MPFMB(blkcnt)       (sizeof(uint_t) * (blkcnt))
    665 #define TCNT_MPFMB(blkcnt)      TOPPERS_COUNT_SZ(TSZ_MPFMB(blkcnt), sizeof(MB_T))
     686#define TCNT_MPFMB(blkcnt)      COUNT_MB_T(TSZ_MPFMB(blkcnt))
    666687
    667688/*
  • EcnlProtoTool/trunk/asp3_dcre/include/sil.h

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2004-2011 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    276276#endif /* TOPPERS_OMIT_SIL_ACCESS */
    277277
     278#ifndef TOPPERS_OMIT_SIL_SYNC_WRITE
     279
     280/*
     281 *  8ビット単位の同期書込み
     282 */
     283#ifdef UINT8_MAX
     284
     285Inline void
     286sil_swrb_mem(uint8_t *mem, uint8_t data)
     287{
     288        sil_wrb_mem(mem, data);
     289        TOPPERS_SIL_WRITE_SYNC();
     290}
     291
     292#endif /* UINT8_MAX */
     293
     294/*
     295 *  16ビット単位の同期書込み
     296 */
     297
     298Inline void
     299sil_swrh_mem(uint16_t *mem, uint16_t data)
     300{
     301        sil_wrh_mem(mem, data);
     302        TOPPERS_SIL_WRITE_SYNC();
     303}
     304
     305Inline void
     306sil_swrh_lem(uint16_t *mem, uint16_t data)
     307{
     308        sil_wrh_lem(mem, data);
     309        TOPPERS_SIL_WRITE_SYNC();
     310}
     311
     312Inline void
     313sil_swrh_bem(uint16_t *mem, uint16_t data)
     314{
     315        sil_wrh_bem(mem, data);
     316        TOPPERS_SIL_WRITE_SYNC();
     317}
     318
     319/*
     320 *  32ビット単位の同期書込み
     321 */
     322
     323Inline void
     324sil_swrw_mem(uint32_t *mem, uint32_t data)
     325{
     326        sil_wrw_mem(mem, data);
     327        TOPPERS_SIL_WRITE_SYNC();
     328}
     329
     330Inline void
     331sil_swrw_lem(uint32_t *mem, uint32_t data)
     332{
     333        sil_wrw_lem(mem, data);
     334        TOPPERS_SIL_WRITE_SYNC();
     335}
     336
     337Inline void
     338sil_swrw_bem(uint32_t *mem, uint32_t data)
     339{
     340        sil_wrw_bem(mem, data);
     341        TOPPERS_SIL_WRITE_SYNC();
     342}
     343
     344#endif /* TOPPERS_OMIT_SIL_SYNC_WRITE */
     345
    278346#endif /* TOPPERS_MACRO_ONLY */
    279347
  • EcnlProtoTool/trunk/asp3_dcre/include/t_stddef.h

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2004-2015 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    113113#endif /* UINT64_MAX */
    114114typedef uint32_t                PRCTIM;         /* プロセッサ時間[NGKI0573]*/
     115#ifndef USE_64BIT_HRTCNT
    115116typedef uint32_t                HRTCNT;         /* 高分解能タイマのカウント値 */
     117#else /* USE_64BIT_HRTCNT */
     118#ifndef UINT64_MAX
     119#error 64bit data types are required when USE_64BIT_HRTCNT.
     120#endif
     121typedef uint64_t                HRTCNT;         /* 高分解能タイマのカウント値 */
     122#endif /* USE_64BIT_HRTCNT */
    116123
    117124typedef TOPPERS_fp              FP;                     /* プログラムの起動番地 */
     
    214221 */
    215222#ifndef offsetof
    216 #define offsetof(structure, field)      ((uintptr_t) &(((structure *) 0)->field))
     223#define offsetof(structure, field) \
     224                ((uintptr_t)(((char *) &(((structure *) 0)->field)) - ((char *) 0)))
    217225#endif /* offsetof */
    218226
  • EcnlProtoTool/trunk/asp3_dcre/include/t_stdlib.h

    r321 r429  
    6161extern const char       *itron_strerror(ER ercd) throw();
    6262
    63 /*
    64  *  エラーメッセージのログ出力
    65  *
    66  *  サービスコールがエラーを返した場合に,そのファイル名,行番号,メイ
    67  *  ンエラーコード等を表示するための関数.
    68  */
    69 extern void             t_perror(uint_t prio, const char *file, int_t line,
    70                                                                         const char *expr, ER ercd) throw();
    71 
    7263#ifdef __cplusplus
    7364}
  • EcnlProtoTool/trunk/asp3_dcre/include/t_syslog.h

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    76 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory
    98 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    109 *
     
    6968#include <t_stddef.h>
    7069
     70#ifndef TOPPERS_MACRO_ONLY
     71#include <stdarg.h>
     72#endif /* TOPPERS_MACRO_ONLY */
     73
    7174/*
    7275 *  ログ情報の種別の定義
     
    7780#define LOG_TYPE_INH            UINT_C(0x11)    /* 割込みハンドラ */
    7881#define LOG_TYPE_ISR            UINT_C(0x12)    /* 割込みサービスルーチン */
    79 #define LOG_TYPE_CYC            UINT_C(0x13)    /* 周期ハンドラ */
    80 #define LOG_TYPE_ALM            UINT_C(0x14)    /* アラームハンドラ */
     82#define LOG_TYPE_CYC            UINT_C(0x13)    /* 周期通知 */
     83#define LOG_TYPE_ALM            UINT_C(0x14)    /* アラーム通知 */
    8184#define LOG_TYPE_OVR            UINT_C(0x15)    /* オーバランハンドラ */
    8285#define LOG_TYPE_EXC            UINT_C(0x16)    /* CPU例外ハンドラ */
     
    124127
    125128/*
    126  *  ログ情報の重要度のビットマップを作るためのマクロ
    127  */
    128 #define LOG_MASK(prio)          (1U << (prio))
    129 #define LOG_UPTO(prio)          ((1U << ((prio) + 1)) - 1)
    130 
    131 /*
    132  *  パケット形式の定義
    133  */
    134 typedef struct t_syslog_rlog {
    135         uint_t  count;          /* ログバッファ中のログの数 */
    136         uint_t  lost;           /* 失われたログの数 */
    137         uint_t  logmask;        /* ログバッファに記録すべき重要度 */
    138         uint_t  lowmask;        /* 低レベル出力すべき重要度 */
    139 } T_SYSLOG_RLOG;
     129 *  ログ情報の出力
     130 *
     131 *  ログ情報の出力は,システムログ機能のアダプタ経由で行う.
     132 */
     133
     134extern ER       syslog_wri_log(uint_t prio, const SYSLOG *p_syslog) throw();
     135
     136#define syslog_write(prio, p_syslog) \
     137                                                ((void) syslog_wri_log(prio, p_syslog))
    140138
    141139#ifndef TOPPERS_OMIT_SYSLOG
    142 
    143 /*
    144  *  ログ情報を出力するためのライブラリ関数
    145  *
    146  *  TECSで記述されたシステムログ機能を直接呼び出す.
    147  */
    148 
    149 extern ER       tSysLog_eSysLog_write(uint_t prio, const SYSLOG *p_syslog) throw();
    150 
    151 Inline void
    152 _syslog_0(uint_t prio, uint_t type)
    153 {
    154         SYSLOG  logbuf;
    155 
    156         logbuf.logtype = type;
    157         (void) tSysLog_eSysLog_write(prio, &logbuf);
    158 }
    159 
    160 Inline void
    161 _syslog_1(uint_t prio, uint_t type, LOGPAR arg1)
    162 {
    163         SYSLOG  logbuf;
    164 
    165         logbuf.logtype = type;
    166         logbuf.logpar[0] = arg1;
    167         (void) tSysLog_eSysLog_write(prio, &logbuf);
    168 }
    169 
    170 Inline void
    171 _syslog_2(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2)
    172 {
    173         SYSLOG  logbuf;
    174 
    175         logbuf.logtype = type;
    176         logbuf.logpar[0] = arg1;
    177         logbuf.logpar[1] = arg2;
    178         (void) tSysLog_eSysLog_write(prio, &logbuf);
    179 }
    180 
    181 Inline void
    182 _syslog_3(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
     140/*
     141 *  システムログ出力のための下位のライブラリ関数
     142 */
     143
     144Inline void
     145t_syslog_0(uint_t prio, uint_t type)
     146{
     147        SYSLOG  logbuf;
     148
     149        logbuf.logtype = type;
     150        syslog_write(prio, &logbuf);
     151}
     152
     153Inline void
     154t_syslog_1(uint_t prio, uint_t type, LOGPAR arg1)
     155{
     156        SYSLOG  logbuf;
     157
     158        logbuf.logtype = type;
     159        logbuf.logpar[0] = arg1;
     160        syslog_write(prio, &logbuf);
     161}
     162
     163Inline void
     164t_syslog_2(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2)
     165{
     166        SYSLOG  logbuf;
     167
     168        logbuf.logtype = type;
     169        logbuf.logpar[0] = arg1;
     170        logbuf.logpar[1] = arg2;
     171        syslog_write(prio, &logbuf);
     172}
     173
     174Inline void
     175t_syslog_3(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
    183176{
    184177        SYSLOG  logbuf;
     
    188181        logbuf.logpar[1] = arg2;
    189182        logbuf.logpar[2] = arg3;
    190         (void) tSysLog_eSysLog_write(prio, &logbuf);
    191 }
    192 
    193 Inline void
    194 _syslog_4(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
     183        syslog_write(prio, &logbuf);
     184}
     185
     186Inline void
     187t_syslog_4(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
    195188                                                                                        LOGPAR arg3, LOGPAR arg4)
    196189{
     
    202195        logbuf.logpar[2] = arg3;
    203196        logbuf.logpar[3] = arg4;
    204         (void) tSysLog_eSysLog_write(prio, &logbuf);
    205 }
    206 
    207 Inline void
    208 _syslog_5(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
     197        syslog_write(prio, &logbuf);
     198}
     199
     200Inline void
     201t_syslog_5(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
    209202                                                                LOGPAR arg3, LOGPAR arg4, LOGPAR arg5)
    210203{
     
    217210        logbuf.logpar[3] = arg4;
    218211        logbuf.logpar[4] = arg5;
    219         (void) tSysLog_eSysLog_write(prio, &logbuf);
    220 }
    221 
    222 Inline void
    223 _syslog_6(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
     212        syslog_write(prio, &logbuf);
     213}
     214
     215Inline void
     216t_syslog_6(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
    224217                                        LOGPAR arg3, LOGPAR arg4, LOGPAR arg5, LOGPAR arg6)
    225218{
     
    233226        logbuf.logpar[4] = arg5;
    234227        logbuf.logpar[5] = arg6;
    235         (void) tSysLog_eSysLog_write(prio, &logbuf);
     228        syslog_write(prio, &logbuf);
    236229}
    237230
     
    239232 *  ログ情報(コメント)を出力するためのライブラリ関数(vasyslog.c)
    240233 */
    241 extern void     syslog(uint_t prio, const char *format, ...) throw();
     234extern void     tt_syslog(SYSLOG *p_logbuf, const char *format, va_list ap);
     235
     236Inline void
     237syslog(uint_t prio, const char *format, ...)
     238{
     239        va_list ap;
     240        SYSLOG  logbuf;
     241
     242        va_start(ap, format);
     243        tt_syslog(&logbuf, format, ap);
     244        va_end(ap);
     245        syslog_write(prio, &logbuf);
     246}
     247
     248/*
     249 *  エラーメッセージを出力するためのライブラリ関数(t_perror.c)
     250 */
     251extern void     tt_perror(SYSLOG *p_logbuf, const char *file, int_t line,
     252                                                                                        const char *expr, ER ercd);
     253
     254Inline void
     255t_perror(uint_t prio, const char *file, int_t line, const char *expr, ER ercd)
     256{
     257        SYSLOG  logbuf;
     258
     259        tt_perror(&logbuf, file, line, expr, ercd);
     260        syslog_write(prio, &logbuf);
     261}
    242262
    243263#else /* TOPPERS_OMIT_SYSLOG */
    244 
    245264/*
    246265 *  システムログ出力を抑止する場合
     
    248267
    249268Inline void
    250 _syslog_0(uint_t prio, uint_t type)
    251 {
    252 }
    253 
    254 Inline void
    255 _syslog_1(uint_t prio, uint_t type, LOGPAR arg1)
    256 {
    257 }
    258 
    259 Inline void
    260 _syslog_2(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2)
    261 {
    262 }
    263 
    264 Inline void
    265 _syslog_3(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
    266 {
    267 }
    268 
    269 Inline void
    270 _syslog_4(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
     269t_syslog_0(uint_t prio, uint_t type)
     270{
     271}
     272
     273Inline void
     274t_syslog_1(uint_t prio, uint_t type, LOGPAR arg1)
     275{
     276}
     277
     278Inline void
     279t_syslog_2(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2)
     280{
     281}
     282
     283Inline void
     284t_syslog_3(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2, LOGPAR arg3)
     285{
     286}
     287
     288Inline void
     289t_syslog_4(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
    271290                                                                                        LOGPAR arg3, LOGPAR arg4)
    272291{
     
    274293
    275294Inline void
    276 _syslog_5(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
     295t_syslog_5(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
    277296                                                                LOGPAR arg3, LOGPAR arg4, LOGPAR arg5)
    278297{
     
    280299
    281300Inline void
    282 _syslog_6(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
     301t_syslog_6(uint_t prio, uint_t type, LOGPAR arg1, LOGPAR arg2,
    283302                                        LOGPAR arg3, LOGPAR arg4, LOGPAR arg5, LOGPAR arg6)
    284303{
     
    289308{
    290309}
     310                                                                                               
     311Inline void
     312t_perror(uint_t prio, const char *file, int_t line, const char *expr, ER ercd)
     313{
     314}
    291315
    292316#endif /* TOPPERS_OMIT_SYSLOG */
    293317
    294318/*
    295  *  ログ情報(コメント)を出力するためのマクロ
     319 *  システムログ出力のためのライブラリ関数
    296320 *
    297321 *  formatおよび後続の引数から作成したメッセージを,重大度prioでログ情
     
    301325
    302326#define syslog_0(prio, format) \
    303                                 _syslog_1(prio, LOG_TYPE_COMMENT, (LOGPAR)(format))
     327                                t_syslog_1(prio, LOG_TYPE_COMMENT, (LOGPAR)(format))
    304328
    305329#define syslog_1(prio, format, arg1) \
    306                                 _syslog_2(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
     330                                t_syslog_2(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
    307331                                                                                                                (LOGPAR)(arg1))
    308332
    309333#define syslog_2(prio, format, arg1, arg2) \
    310                                 _syslog_3(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
     334                                t_syslog_3(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
    311335                                                                                (LOGPAR)(arg1), (LOGPAR)(arg2))
    312336
    313337#define syslog_3(prio, format, arg1, arg2, arg3) \
    314                                 _syslog_4(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
     338                                t_syslog_4(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
    315339                                                (LOGPAR)(arg1), (LOGPAR)(arg2), (LOGPAR)(arg3))
    316340
    317341#define syslog_4(prio, format, arg1, arg2, arg3, arg4) \
    318                                 _syslog_5(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
     342                                t_syslog_5(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
    319343                                                (LOGPAR)(arg1), (LOGPAR)(arg2), (LOGPAR)(arg3), \
    320344                                                                                                                (LOGPAR)(arg4))
    321345
    322346#define syslog_5(prio, format, arg1, arg2, arg3, arg4, arg5) \
    323                                 _syslog_6(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
     347                                t_syslog_6(prio, LOG_TYPE_COMMENT, (LOGPAR)(format), \
    324348                                                (LOGPAR)(arg1), (LOGPAR)(arg2), (LOGPAR)(arg3), \
    325349                                                                                (LOGPAR)(arg4), (LOGPAR)(arg5))
     
    330354#ifndef TOPPERS_assert_fail
    331355#define TOPPERS_assert_fail(exp, file, line) \
    332                                 _syslog_3(LOG_EMERG, LOG_TYPE_ASSERT, (LOGPAR)(file), \
     356                                t_syslog_3(LOG_EMERG, LOG_TYPE_ASSERT, (LOGPAR)(file), \
    333357                                                                                (LOGPAR)(line), (LOGPAR)(exp))
    334358#endif /* TOPPERS_assert_fail */
  • EcnlProtoTool/trunk/asp3_dcre/kernel/Makefile.kernel

    r321 r429  
    66#  Copyright (C) 2003 by Embedded and Real-Time Systems Laboratory
    77#                              Toyohashi Univ. of Technology, JAPAN
    8 #  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8#  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99#              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    6868                wobjwai.o wobjwaitmo.o iniwque.o
    6969
    70 time_event = tmeini.o tmeup.o tmedown.o tmecur.o tmeset.o \
    71                 tmereg.o tmeenq.o tmedeq.o tmechk.o tmeltim.o sigtim.o
     70time_event = tmeini.o tmeup.o tmedown.o tmecur.o tmeset.o tmereg.o \
     71                tmeenqrel.o tmedeq.o tmechk.o tmeltim.o sigtim.o
    7272
    7373task_manage = acre_tsk.o del_tsk.o act_tsk.o can_act.o get_tst.o \
     
    112112                sns_ctx.o sns_loc.o sns_dsp.o sns_dpn.o sns_ker.o
    113113
    114 interrupt = isrini.o isrcal.o acre_isr.o del_isr.o \
    115                 intini.o dis_int.o ena_int.o chg_ipm.o get_ipm.o
     114interrupt = isrini.o isrcal.o acre_isr.o del_isr.o intini.o \
     115                dis_int.o ena_int.o clr_int.o ras_int.o prb_int.o chg_ipm.o get_ipm.o
    116116
    117117exception = excini.o xsns_dpn.o
     
    120120#  生成されるオブジェクトファイルの依存関係の定義
    121121#
    122 $(startup) $(startup:.o=.s): startup.c
    123 $(task) $(task:.o=.s): task.c
    124 $(taskhook) $(taskhook:.o=.s): taskhook.c
    125 $(wait) $(wait:.o=.s): wait.c
    126 $(time_event) $(time_event:.o=.s): time_event.c
    127 $(task_manage) $(task_manage:.o=.s): task_manage.c
    128 $(task_refer) $(task_refer:.o=.s): task_refer.c
    129 $(task_sync) $(task_sync:.o=.s): task_sync.c
    130 $(task_term) $(task_term:.o=.s): task_term.c
    131 $(semaphore) $(semaphore:.o=.s): semaphore.c
    132 $(eventflag) $(eventflag:.o=.s): eventflag.c
    133 $(dataqueue) $(dataqueue:.o=.s): dataqueue.c
    134 $(pridataq) $(pridataq:.o=.s): pridataq.c
    135 $(mutex) $(mutex:.o=.s): mutex.c
    136 $(mempfix) $(mempfix:.o=.s): mempfix.c
    137 $(time_manage) $(time_manage:.o=.s): time_manage.c
    138 $(cyclic) $(cyclic:.o=.s): cyclic.c
    139 $(alarm) $(alarm:.o=.s): alarm.c
    140 $(sys_manage) $(sys_manage:.o=.s): sys_manage.c
    141 $(interrupt) $(interrupt:.o=.s): interrupt.c
    142 $(exception) $(exception:.o=.s): exception.c
     122$(addprefix $(OBJDIR)/, $(startup)) $(startup:.o=.s): startup.c
     123$(addprefix $(OBJDIR)/, $(task)) $(task:.o=.s): task.c
     124$(addprefix $(OBJDIR)/, $(taskhook)) $(taskhook:.o=.s): taskhook.c
     125$(addprefix $(OBJDIR)/, $(wait)) $(wait:.o=.s): wait.c
     126$(addprefix $(OBJDIR)/, $(time_event)) $(time_event:.o=.s): time_event.c
     127$(addprefix $(OBJDIR)/, $(task_manage)) $(task_manage:.o=.s): task_manage.c
     128$(addprefix $(OBJDIR)/, $(task_refer)) $(task_refer:.o=.s): task_refer.c
     129$(addprefix $(OBJDIR)/, $(task_sync)) $(task_sync:.o=.s): task_sync.c
     130$(addprefix $(OBJDIR)/, $(task_term)) $(task_term:.o=.s): task_term.c
     131$(addprefix $(OBJDIR)/, $(semaphore)) $(semaphore:.o=.s): semaphore.c
     132$(addprefix $(OBJDIR)/, $(eventflag)) $(eventflag:.o=.s): eventflag.c
     133$(addprefix $(OBJDIR)/, $(dataqueue)) $(dataqueue:.o=.s): dataqueue.c
     134$(addprefix $(OBJDIR)/, $(pridataq)) $(pridataq:.o=.s): pridataq.c
     135$(addprefix $(OBJDIR)/, $(mutex)) $(mutex:.o=.s): mutex.c
     136$(addprefix $(OBJDIR)/, $(mempfix)) $(mempfix:.o=.s): mempfix.c
     137$(addprefix $(OBJDIR)/, $(time_manage)) $(time_manage:.o=.s): time_manage.c
     138$(addprefix $(OBJDIR)/, $(cyclic)) $(cyclic:.o=.s): cyclic.c
     139$(addprefix $(OBJDIR)/, $(alarm)) $(alarm:.o=.s): alarm.c
     140$(addprefix $(OBJDIR)/, $(sys_manage)) $(sys_manage:.o=.s): sys_manage.c
     141$(addprefix $(OBJDIR)/, $(interrupt)) $(interrupt:.o=.s): interrupt.c
     142$(addprefix $(OBJDIR)/, $(exception)) $(exception:.o=.s): exception.c
  • EcnlProtoTool/trunk/asp3_dcre/kernel/alarm.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    164164        ALMINIB         *p_alminib;
    165165        ATR                     almatr;
    166         T_NFYINFO       nfyinfo, *p_nfyinfo;
    167         ER                      ercd, rercd;
     166        T_NFYINFO       *p_nfyinfo;
     167        ER                      ercd;
    168168
    169169        LOG_ACRE_ALM_ENTER(pk_calm);
     
    171171
    172172        almatr = pk_calm->almatr;
    173         nfyinfo = pk_calm->nfyinfo;
    174 
    175         CHECK_RSATR(almatr, TA_NULL);
    176         rercd = check_nfyinfo(&nfyinfo);
    177         if (rercd != E_OK) {
    178                 ercd = rercd;
     173
     174        CHECK_VALIDATR(almatr, TA_NULL);
     175        ercd = check_nfyinfo(&(pk_calm->nfyinfo));
     176        if (ercd != E_OK) {
    179177                goto error_exit;
    180178        }
     
    189187                p_alminib = (ALMINIB *)(p_almcb->p_alminib);
    190188                p_alminib->almatr = almatr;
    191                 if (nfyinfo.nfymode == TNFY_HANDLER) {
    192                         p_alminib->exinf = nfyinfo.nfy.handler.exinf;
    193                         p_alminib->nfyhdr = (NFYHDR)(nfyinfo.nfy.handler.tmehdr);
     189                if (pk_calm->nfyinfo.nfymode == TNFY_HANDLER) {
     190                        p_alminib->exinf = pk_calm->nfyinfo.nfy.handler.exinf;
     191                        p_alminib->nfyhdr = (NFYHDR)(pk_calm->nfyinfo.nfy.handler.tmehdr);
    194192                }
    195193                else {
    196194                        p_nfyinfo = &aalm_nfyinfo_table[p_alminib - aalminib_table];
    197                         *p_nfyinfo = nfyinfo;
     195                        *p_nfyinfo = pk_calm->nfyinfo;
    198196                        p_alminib->exinf = (intptr_t) p_nfyinfo;
    199197                        p_alminib->nfyhdr = notify_handler;
     
    283281                        p_almcb->almsta = true;
    284282                }
    285                 tmevtb_enqueue(&(p_almcb->tmevtb), almtim);
     283                tmevtb_enqueue_reltim(&(p_almcb->tmevtb), almtim);
    286284                ercd = E_OK;
    287285        }
     
    385383        /*
    386384         *  通知ハンドラを,CPUロック解除状態で呼び出す.
     385         *
     386         *  アラーム通知の生成/削除はタスクからしか行えないため,アラーム
     387         *  通知初期化ブロックをCPUロック解除状態で参照しても問題ない.
    387388         */
    388389        unlock_cpu();
  • EcnlProtoTool/trunk/asp3_dcre/kernel/alarm.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5252
    5353  def prepare(key, params)
    54     # almatrが無効の場合(E_RSATR)[NGKI2491]
    55     #(TA_STA以外のビットがセットされている場合)
    56     if (params[:almatr] & ~($TA_STA)) != 0
     54    # almatrが無効の場合(E_RSATR)[NGKI2491][NGKI3423][NGKI3424]
     55    #(TA_NULLでない場合)
     56    if (params[:almatr] != $TA_NULL)
    5757      error_illegal_id("E_RSATR", params, :almatr, :almid)
    5858    end
  • EcnlProtoTool/trunk/asp3_dcre/kernel/allfunc.h

    r321 r429  
    44 *      Advanced Standard Profile Kernel
    55 *
    6  *  Copyright (C) 2005-2015 by Embedded and Real-Time Systems Laboratory
     6 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    77 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    88 *
     
    8181#define TOPPERS_tmeset
    8282#define TOPPERS_tmereg
    83 #define TOPPERS_tmeenq
     83#define TOPPERS_tmeenqrel
    8484#define TOPPERS_tmedeq
    8585#define TOPPERS_tmechk
     
    257257#define TOPPERS_dis_int
    258258#define TOPPERS_ena_int
     259#define TOPPERS_clr_int
     260#define TOPPERS_ras_int
     261#define TOPPERS_prb_int
    259262#define TOPPERS_chg_ipm
    260263#define TOPPERS_get_ipm
  • EcnlProtoTool/trunk/asp3_dcre/kernel/check.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    6565
    6666/*
    67  *  オブジェクト番号の範囲の判定
    68  */
    69 #ifndef VALID_INTNO_DISINT
    70 #define VALID_INTNO_DISINT(intno)    VALID_INTNO(intno)
    71 #endif /* VALID_INTNO_DISINT */
    72 
    73 #ifndef VALID_INTNO_CREISR
    74 #define VALID_INTNO_CREISR(intno)    VALID_INTNO(intno)
    75 #endif /* VALID_INTNO_CREISR */
    76 
    77 /*
    7867 *  優先度の範囲の判定
    7968 */
     
    8574                                (TMIN_ISRPRI <= (isrpri) && (isrpri) <= TMAX_ISRPRI)
    8675
    87 #ifndef VALID_INTPRI_CHGIPM
    88 #define VALID_INTPRI_CHGIPM(intpri) \
    89                                 (TMIN_INTPRI <= (intpri) && (intpri) <= TIPM_ENAALL)
    90 #endif /* VALID_INTPRI_CHGIPM */
    91 
    9276/*
    9377 *  相対時間の範囲の判定
     
    9882 *  タイムアウト指定値の範囲の判定
    9983 */
    100 #define VALID_TMOUT(tmout)      ((tmout) <= TMAX_RELTIM || (tmout) == TMO_FEVR \
    101                                                                                                         || (tmout) == TMO_POL)
     84#define VALID_TMOUT(tmout)      ((tmout) <= TMAX_RELTIM || (tmout) == TMO_FEVR)
    10285
    10386/*
     
    208191
    209192/*
    210  *  オブジェクトIDのチェック(E_ID)
     193 *  不正ID番号のチェック(E_ID)
    211194 */
    212195#define CHECK_ID(exp) do {                                                                      \
     
    218201
    219202/*
    220  *  予約属性エラーのチェック(E_RSATR)
    221  */
    222 #define CHECK_RSATR(atr, valid_atr) do {                                        \
     203 *  属性が無効なビットが立っていないかのチェック(E_RSATR)
     204 */
     205#define CHECK_VALIDATR(atr, valid_atr) do {                                     \
    223206        if (((atr) & ~(valid_atr)) != 0U) {                                             \
    224207                ercd = E_RSATR;                                                                         \
     
    238221
    239222/*
    240  *  不正使用エラーのチェック(E_ILUSE)
     223 *  サービスコール不正使用のチェック(E_ILUSE)
    241224 */
    242225#define CHECK_ILUSE(exp) do {                                                           \
     
    248231
    249232/*
    250  *  静的なオブジェクト状態エラーのチェック(E_OBJ)
     233 *  オブジェクト状態エラーのチェック(E_OBJ)
    251234 */
    252235#define CHECK_OBJ(exp) do {                                                                     \
  • EcnlProtoTool/trunk/asp3_dcre/kernel/cyclic.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    175175        CYCINIB         *p_cycinib;
    176176        ATR                     cycatr;
    177         T_NFYINFO       nfyinfo, *p_nfyinfo;
    178         RELTIM          cyctim;
    179         RELTIM          cycphs;
    180         ER                      ercd, rercd;
     177        RELTIM          cyctim, cycphs;
     178        T_NFYINFO       *p_nfyinfo;
     179        ER                      ercd;
    181180
    182181        LOG_ACRE_CYC_ENTER(pk_ccyc);
     
    184183
    185184        cycatr = pk_ccyc->cycatr;
    186         nfyinfo = pk_ccyc->nfyinfo;
    187185        cyctim = pk_ccyc->cyctim;
    188186        cycphs = pk_ccyc->cycphs;
    189187
    190         CHECK_RSATR(cycatr, TA_STA);
    191         rercd = check_nfyinfo(&nfyinfo);
    192         if (rercd != E_OK) {
    193                 ercd = rercd;
     188        CHECK_VALIDATR(cycatr, TA_STA);
     189        ercd = check_nfyinfo(&(pk_ccyc->nfyinfo));
     190        if (ercd != E_OK) {
    194191                goto error_exit;
    195192        }
     
    206203                p_cycinib = (CYCINIB *)(p_cyccb->p_cycinib);
    207204                p_cycinib->cycatr = cycatr;
    208                 if (nfyinfo.nfymode == TNFY_HANDLER) {
    209                         p_cycinib->exinf = nfyinfo.nfy.handler.exinf;
    210                         p_cycinib->nfyhdr = (NFYHDR)(nfyinfo.nfy.handler.tmehdr);
     205                if (pk_ccyc->nfyinfo.nfymode == TNFY_HANDLER) {
     206                        p_cycinib->exinf = pk_ccyc->nfyinfo.nfy.handler.exinf;
     207                        p_cycinib->nfyhdr = (NFYHDR)(pk_ccyc->nfyinfo.nfy.handler.tmehdr);
    211208                }
    212209                else {
    213210                        p_nfyinfo = &acyc_nfyinfo_table[p_cycinib - acycinib_table];
    214                         *p_nfyinfo = nfyinfo;
     211                        *p_nfyinfo = pk_ccyc->nfyinfo;
    215212                        p_cycinib->exinf = (intptr_t) p_nfyinfo;
    216213                        p_cycinib->nfyhdr = notify_handler;
     
    221218                if ((p_cyccb->p_cycinib->cycatr & TA_STA) != 0U) {
    222219                        p_cyccb->cycsta = true;
    223                         tmevtb_enqueue(&(p_cyccb->tmevtb), p_cyccb->p_cycinib->cycphs);
     220                        tmevtb_enqueue_reltim(&(p_cyccb->tmevtb),
     221                                                                                p_cyccb->p_cycinib->cycphs);
    224222                }
    225223                else {
     
    311309                 *  初回の起動のためのタイムイベントを登録する[ASPD1036].
    312310                 */
    313                 tmevtb_enqueue(&(p_cyccb->tmevtb), p_cyccb->p_cycinib->cycphs);
     311                tmevtb_enqueue_reltim(&(p_cyccb->tmevtb), p_cyccb->p_cycinib->cycphs);
    314312                ercd = E_OK;
    315313        }
     
    414412        /*
    415413         *  通知ハンドラを,CPUロック解除状態で呼び出す.
     414         *
     415         *  周期通知の生成/削除はタスクからしか行えないため,周期通知初期
     416         *  化ブロックをCPUロック解除状態で参照しても問題ない.
    416417         */
    417418        unlock_cpu();
  • EcnlProtoTool/trunk/asp3_dcre/kernel/cyclic.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5252
    5353  def prepare(key, params)
    54     # cycatrが無効の場合(E_RSATR)[NGKI2383]
     54    # cycatrが無効の場合(E_RSATR)[NGKI2383][NGKI2370][ASPS0172]
    5555    #(TA_STA以外のビットがセットされている場合)
    5656    if (params[:cycatr] & ~($TA_STA)) != 0
     
    5858    end
    5959
    60     # (0 < cyctim && cyctim <= TMAX_RELTIM)でない場合(E_PAR)[NGKI2397]
     60    # cyctimが有効範囲外の場合(E_PAR)[NGKI2397]
     61    #(0 < cyctim && cyctim <= TMAX_RELTIMでない場合)
    6162    if !(0 < params[:cyctim] && params[:cyctim] <= $TMAX_RELTIM)
    6263      error_illegal_id("E_PAR", params, :cyctim, :cycid)
    6364    end
    6465
    65     # (0 <= cycphs && cycphs <= TMAX_RELTIM)でない場合(E_PAR)[NGKI2399]
     66    # cycphsが有効範囲外の場合(E_PAR)[NGKI2399]
     67    #(0 <= cycphs && cycphs <= TMAX_RELTIMでない場合)
    6668    if !(0 <= params[:cycphs] && params[:cycphs] <= $TMAX_RELTIM)
    6769      error_illegal_id("E_PAR", params, :cycphs, :cycid)
  • EcnlProtoTool/trunk/asp3_dcre/kernel/dataqueue.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2017 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    356356        p_dtqmb = pk_cdtq->dtqmb;
    357357
    358         CHECK_RSATR(dtqatr, TA_TPRI);
     358        CHECK_VALIDATR(dtqatr, TA_TPRI);
     359        if (p_dtqmb != NULL) {
     360                CHECK_PAR(MB_ALIGN(p_dtqmb));
     361        }
    359362
    360363        lock_cpu();
     
    364367        else {
    365368                if (dtqcnt != 0 && p_dtqmb == NULL) {
    366                         p_dtqmb = kernel_malloc(sizeof(DTQMB) * dtqcnt);
     369                        p_dtqmb = malloc_mpk(sizeof(DTQMB) * dtqcnt);
    367370                        dtqatr |= TA_MBALLOC;
    368371                }
     
    423426                p_dtqinib = (DTQINIB *)(p_dtqcb->p_dtqinib);
    424427                if ((p_dtqinib->dtqatr & TA_MBALLOC) != 0U) {
    425                         kernel_free(p_dtqinib->p_dtqmb);
     428                        free_mpk(p_dtqinib->p_dtqmb);
    426429                }
    427430                p_dtqinib->dtqatr = TA_NOEXS;
     
    449452snd_dtq(ID dtqid, intptr_t data)
    450453{
    451         DTQCB   *p_dtqcb;
    452         WINFO_SDTQ winfo_sdtq;
    453         ER              ercd;
     454        DTQCB           *p_dtqcb;
     455        WINFO_SDTQ      winfo_sdtq;
     456        ER                      ercd;
    454457
    455458        LOG_SND_DTQ_ENTER(dtqid, data);
     
    473476        else {
    474477                winfo_sdtq.data = data;
    475                 p_runtsk->tstat = TS_WAITING_SDTQ;
    476                 wobj_make_wait((WOBJCB *) p_dtqcb, (WINFO_WOBJ *) &winfo_sdtq);
     478                wobj_make_wait((WOBJCB *) p_dtqcb, TS_WAITING_SDTQ,
     479                                                                                        (WINFO_WOBJ *) &winfo_sdtq);
    477480                dispatch();
    478481                ercd = winfo_sdtq.winfo.wercd;
     
    513516                        }
    514517                        else {
    515                                 request_dispatch();
     518                                request_dispatch_retint();
    516519                        }
    517520                }
     
    538541tsnd_dtq(ID dtqid, intptr_t data, TMO tmout)
    539542{
    540         DTQCB   *p_dtqcb;
    541         WINFO_SDTQ winfo_sdtq;
    542         TMEVTB  tmevtb;
    543         ER              ercd;
     543        DTQCB           *p_dtqcb;
     544        WINFO_SDTQ      winfo_sdtq;
     545        TMEVTB          tmevtb;
     546        ER                      ercd;
    544547
    545548        LOG_TSND_DTQ_ENTER(dtqid, data, tmout);
     
    567570        else {
    568571                winfo_sdtq.data = data;
    569                 p_runtsk->tstat = TS_WAITING_SDTQ;
    570                 wobj_make_wait_tmout((WOBJCB *) p_dtqcb, (WINFO_WOBJ *) &winfo_sdtq,
    571                                                                                                                 &tmevtb, tmout);
     572                wobj_make_wait_tmout((WOBJCB *) p_dtqcb, TS_WAITING_SDTQ,
     573                                                                (WINFO_WOBJ *) &winfo_sdtq, &tmevtb, tmout);
    572574                dispatch();
    573575                ercd = winfo_sdtq.winfo.wercd;
     
    612614                        }
    613615                        else {
    614                                 request_dispatch();
     616                                request_dispatch_retint();
    615617                        }
    616618                }
    617         ercd = E_OK;
     619                ercd = E_OK;
    618620        }
    619621        unlock_cpu();
     
    634636rcv_dtq(ID dtqid, intptr_t *p_data)
    635637{
    636         DTQCB   *p_dtqcb;
    637         WINFO_RDTQ winfo_rdtq;
    638         ER              ercd;
     638        DTQCB           *p_dtqcb;
     639        WINFO_RDTQ      winfo_rdtq;
     640        ER                      ercd;
    639641
    640642        LOG_RCV_DTQ_ENTER(dtqid, p_data);
     
    657659        }
    658660        else {
    659                 p_runtsk->tstat = TS_WAITING_RDTQ;
    660                 make_wait(&(winfo_rdtq.winfo));
     661                make_wait(TS_WAITING_RDTQ, &(winfo_rdtq.winfo));
    661662                queue_insert_prev(&(p_dtqcb->rwait_queue), &(p_runtsk->task_queue));
    662663                winfo_rdtq.p_dtqcb = p_dtqcb;
     
    723724trcv_dtq(ID dtqid, intptr_t *p_data, TMO tmout)
    724725{
    725         DTQCB   *p_dtqcb;
    726         WINFO_RDTQ winfo_rdtq;
    727         TMEVTB  tmevtb;
    728         ER              ercd;
     726        DTQCB           *p_dtqcb;
     727        WINFO_RDTQ      winfo_rdtq;
     728        TMEVTB          tmevtb;
     729        ER                      ercd;
    729730
    730731        LOG_TRCV_DTQ_ENTER(dtqid, p_data, tmout);
     
    751752        }
    752753        else {
    753                 p_runtsk->tstat = TS_WAITING_RDTQ;
    754                 make_wait_tmout(&(winfo_rdtq.winfo), &tmevtb, tmout);
     754                make_wait_tmout(TS_WAITING_RDTQ, &(winfo_rdtq.winfo), &tmevtb, tmout);
    755755                queue_insert_prev(&(p_dtqcb->rwait_queue), &(p_runtsk->task_queue));
    756756                winfo_rdtq.p_dtqcb = p_dtqcb;
  • EcnlProtoTool/trunk/asp3_dcre/kernel/dataqueue.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5454    params[:dtqmb] ||= "NULL"
    5555
    56     # dtqatrが無効の場合(E_RSATR)[NGKI1669]
     56    # dtqatrが無効の場合(E_RSATR)[NGKI1669][NGKI1661]
    5757    #(TA_TPRI以外のビットがセットされている場合)
    5858    if (params[:dtqatr] & ~($TA_TPRI)) != 0
  • EcnlProtoTool/trunk/asp3_dcre/kernel/eventflag.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2017 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    216216        flgatr = pk_cflg->flgatr;
    217217
    218         CHECK_RSATR(flgatr, TA_TPRI|TA_WMUL|TA_CLR);
     218        CHECK_VALIDATR(flgatr, TA_TPRI|TA_WMUL|TA_CLR);
    219219
    220220        lock_cpu();
     
    292292set_flg(ID flgid, FLGPTN setptn)
    293293{
    294         FLGCB   *p_flgcb;
    295         QUEUE   *p_queue;
    296         TCB             *p_tcb;
    297         WINFO_FLG *p_winfo_flg;
    298         ER              ercd;
     294        FLGCB           *p_flgcb;
     295        QUEUE           *p_queue;
     296        TCB                     *p_tcb;
     297        WINFO_FLG       *p_winfo_flg;
     298        bool_t          lock;
     299        ER                      ercd;
    299300
    300301        LOG_SET_FLG_ENTER(flgid, setptn);
    301         CHECK_UNL();
     302        lock = sense_lock();
    302303        CHECK_ID(VALID_FLGID(flgid));
    303304        p_flgcb = get_flgcb(flgid);
    304305
    305         lock_cpu();
     306        if (!lock)
     307                lock_cpu();
    306308        if (p_flgcb->p_flginib->flgatr == TA_NOEXS) {
    307309                ercd = E_NOEXS;
     
    328330                        }
    329331                        else {
    330                                 request_dispatch();
     332                                request_dispatch_retint();
    331333                        }
    332334                }
    333335                ercd = E_OK;
    334336        }
    335         unlock_cpu();
     337        if (!lock)
     338                unlock_cpu();
    336339
    337340  error_exit:
     
    351354{
    352355        FLGCB   *p_flgcb;
     356        bool_t lock;
    353357        ER              ercd;
    354358
    355359        LOG_CLR_FLG_ENTER(flgid, clrptn);
    356         CHECK_TSKCTX_UNL();
     360        lock = sense_lock();
    357361        CHECK_ID(VALID_FLGID(flgid));
    358362        p_flgcb = get_flgcb(flgid);
    359363
    360         lock_cpu();
     364        if (!lock)
     365                lock_cpu();
    361366        if (p_flgcb->p_flginib->flgatr == TA_NOEXS) {
    362367                ercd = E_NOEXS;
     
    366371                ercd = E_OK;
    367372        }
    368         unlock_cpu();
     373        if (!lock)
     374                unlock_cpu();
    369375
    370376  error_exit:
     
    383389wai_flg(ID flgid, FLGPTN waiptn, MODE wfmode, FLGPTN *p_flgptn)
    384390{
    385         FLGCB   *p_flgcb;
    386         WINFO_FLG winfo_flg;
    387         ER              ercd;
     391        FLGCB           *p_flgcb;
     392        WINFO_FLG       winfo_flg;
     393        ER                      ercd;
    388394
    389395        LOG_WAI_FLG_ENTER(flgid, waiptn, wfmode, p_flgptn);
     
    411417                winfo_flg.waiptn = waiptn;
    412418                winfo_flg.wfmode = wfmode;
    413                 p_runtsk->tstat = TS_WAITING_FLG;
    414                 wobj_make_wait((WOBJCB *) p_flgcb, (WINFO_WOBJ *) &winfo_flg);
     419                wobj_make_wait((WOBJCB *) p_flgcb, TS_WAITING_FLG,
     420                                                                                        (WINFO_WOBJ *) &winfo_flg);
    415421                dispatch();
    416422                ercd = winfo_flg.winfo.wercd;
     
    477483twai_flg(ID flgid, FLGPTN waiptn, MODE wfmode, FLGPTN *p_flgptn, TMO tmout)
    478484{
    479         FLGCB   *p_flgcb;
    480         WINFO_FLG winfo_flg;
    481         TMEVTB  tmevtb;
    482         ER              ercd;
     485        FLGCB           *p_flgcb;
     486        WINFO_FLG       winfo_flg;
     487        TMEVTB          tmevtb;
     488        ER                      ercd;
    483489
    484490        LOG_TWAI_FLG_ENTER(flgid, waiptn, wfmode, p_flgptn, tmout);
     
    510516                winfo_flg.waiptn = waiptn;
    511517                winfo_flg.wfmode = wfmode;
    512                 p_runtsk->tstat = TS_WAITING_FLG;
    513                 wobj_make_wait_tmout((WOBJCB *) p_flgcb, (WINFO_WOBJ *) &winfo_flg,
    514                                                                                                                 &tmevtb, tmout);
     518                wobj_make_wait_tmout((WOBJCB *) p_flgcb, TS_WAITING_FLG,
     519                                                                (WINFO_WOBJ *) &winfo_flg, &tmevtb, tmout);
    515520                dispatch();
    516521                ercd = winfo_flg.winfo.wercd;
     
    575580        FLGCB   *p_flgcb;
    576581        ER              ercd;
    577    
     582        bool_t lock;
     583
    578584        LOG_REF_FLG_ENTER(flgid, pk_rflg);
    579         CHECK_TSKCTX_UNL();
     585        lock = sense_lock();
    580586        CHECK_ID(VALID_FLGID(flgid));
    581587        p_flgcb = get_flgcb(flgid);
    582588
    583         lock_cpu();
     589        if (!lock)
     590                lock_cpu();
    584591        if (p_flgcb->p_flginib->flgatr == TA_NOEXS) {
    585592                ercd = E_NOEXS;
     
    590597                ercd = E_OK;
    591598        }
    592         unlock_cpu();
     599        if (!lock)
     600                unlock_cpu();
    593601
    594602  error_exit:
  • EcnlProtoTool/trunk/asp3_dcre/kernel/eventflag.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5151
    5252  def prepare(key, params)
    53     # flgatrが無効の場合(E_RSATR)[NGKI1562]
     53    # flgatrが無効の場合(E_RSATR)[NGKI1562][NGKI1550]
    5454    #(TA_TPRI,TA_WMUL,TA_CLR以外のビットがセットされている場合)
    5555    if (params[:flgatr] & ~($TA_TPRI|$TA_WMUL|$TA_CLR)) != 0
  • EcnlProtoTool/trunk/asp3_dcre/kernel/exception.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5151
    5252#
     53#  DEF_EXCで使用できるCPU例外ハンドラ番号のデフォルト定義
     54#
     55if !defined?($EXCNO_DEFEXC_VALID)
     56  $EXCNO_DEFEXC_VALID = $EXCNO_VALID
     57end
     58
     59#
    5360#  CPU例外ハンドラに関するエラーチェック
    5461#
    55 $cfgData[:DEF_EXC].each do |key, params|
    56   # excnoがCPU例外ハンドラ番号として正しくない場合(E_PAR)[NGKI3134]
    57   if $EXCNO_VALID.index(params[:excno]).nil?
     62$cfgData[:DEF_EXC].each do |_, params|
     63  # excnoが有効範囲外の場合(E_PAR)[NGKI3134]
     64  if !$EXCNO_DEFEXC_VALID.include?(params[:excno])
    5865    error_illegal("E_PAR", params, :excno)
    5966  end
    6067
    61   # excatrが無効の場合(E_RSATR)[NGKI3131]
     68  # excatrが無効の場合(E_RSATR)[NGKI3131][NGKI5178][NGKI3123]
    6269  #(TARGET_EXCATR以外のビットがセットされている場合)
    6370  if (params[:excatr] & ~($TARGET_EXCATR)) != 0
    6471    error_illegal_sym("E_RSATR", params, :excatr, :excno)
     72  end
     73
     74  # ターゲット依存のエラーチェック
     75  if defined? TargetCheckDefExc()
     76    TargetCheckDefExc(params)
    6577  end
    6678end
     
    8294    #  CPU例外ハンドラのエントリ
    8395    #
    84     $cfgData[:DEF_EXC].each do |key, params|
     96    $cfgData[:DEF_EXC].each do |_, params|
    8597      $kernelCfgC.add("EXCHDR_ENTRY(#{params[:excno]}, " \
    8698                                                "#{params[:excno].val}, #{params[:exchdr]})")
     
    92104    #
    93105    $kernelCfgC.add("const EXCINIB _kernel_excinib_table[TNUM_DEF_EXCNO] = {")
    94     $cfgData[:DEF_EXC].each_with_index do |(key, params), index|
     106    $cfgData[:DEF_EXC].each_with_index do |(_, params), index|
    95107      $kernelCfgC.add(",") if index > 0
    96108      $kernelCfgC.append("\t{ (#{params[:excno]}), (#{params[:excatr]}), " \
  • EcnlProtoTool/trunk/asp3_dcre/kernel/genoffset.trb

    r321 r429  
    11# -*- coding: utf-8 -*-
     2#
     3#   TOPPERS Software
     4#       Toyohashi Open Platform for Embedded Real-Time Systems
    25#
    3 #   TOPPERS/ASP Kernel
    4 #       Toyohashi Open Platform for Embedded Real-Time Systems/
    5 #       Advanced Standard Profile Kernel
    6 #
    7 #   Copyright (C) 2011-2016 by Embedded and Real-Time Systems Laboratory
     6#   Copyright (C) 2011-2018 by Embedded and Real-Time Systems Laboratory
    87#               Graduate School of Information Science, Nagoya Univ., JAPAN
    98
     
    3736#   の責任を負わない.
    3837#
    39 #   $Id$
     38#   $Id: genoffset.trb 936 2018-04-07 09:46:42Z ertl-hiro $
    4039#
    4140
     
    4443#
    4544
    46 # 
     45#
    4746#  タイムスタンプファイルの指定
    48 # 
     47#
    4948$timeStampFileName = "offset.timestamp"
    5049
    51 # 
     50#
    5251#  offset.hの先頭部分の生成
    53 # 
     52#
    5453$offsetH = GenFile.new("offset.h")
    5554$offsetH.add2("/* offset.h */")
    5655
    57 #
    58 #  #defineディレクティブの生成
    59 #
    60 def GenerateDefine(symbol, value)
    61   $offsetH.add("#define #{symbol}\t#{value}")
    62 end
    63 
    64 #
     56#
    6557#  ビットのサーチ
    66 # 
     58#
    6759def SearchBit(val)
    6860  (0..7).each do |valBit|
     
    7466end
    7567
    76 # 
    77 #  ビットフィールドのオフセットとビット位置の定義の生成
    78 # 
    79 def GenerateDefineBit(label, structSize, outputSize)
     68#
     69#  ビットフィールドのオフセットとビット位置の算出
     70#
     71def BitOffsetPosition(label, structSize, outputSize)
    8072  top = SYMBOL(label)
    8173  if top.nil?
     
    9688      error_exit("bit not found in `#{label}'")
    9789    else
    98       valBit = SearchBit(val)
     90      position = SearchBit(val)
    9991      case outputSize
    100       when "W"
    101         if $SIL_ENDIAN_BIG
    102           valBit = valBit + 24 - ((offset & 0x03) << 3)
     92      when 4, "W"
     93        if $endianLittle
     94          position = position + ((offset & 0x03) << 3)
    10395        else
    104           valBit = valBit + ((offset & 0x03) << 3)
     96          position = position + 24 - ((offset & 0x03) << 3)
    10597        end
    10698        offset &= ~0x03
    107       when "H"
    108         if $SIL_ENDIAN_BIG
    109           valBit = valBit + 8 - ((offset & 0x01) << 3)
     99      when 2, "H"
     100        if $endianLittle
     101          position = position + ((offset & 0x01) << 3)
    110102        else
    111           valBit = valBit + ((offset & 0x01) << 3)
     103          position = position + 8 - ((offset & 0x01) << 3)
    112104        end
    113105        offset &= ~0x01
    114106      end
    115107    end
    116 
    117     $offsetH.add("#define #{label}\t#{offset}")
    118     $offsetH.add("#define #{label}_bit\t#{valBit}")
    119     $offsetH.add("#define #{label}_mask\t#{sprintf("0x%x", 1 << valBit)}")
     108    return offset, position
    120109  end
    121110end
    122111
    123 #
    124 #  バイト配置のチェック
    125 #
    126 def magicCheck(size, check)
    127   label = "MAGIC_#{size}"
    128   top = SYMBOL(label)
    129   if top.nil?
    130     error_exit("label `#{label}' not found")
    131   else
    132     1.upto(size).each do |offset|
    133       if $SIL_ENDIAN_BIG
    134         val = PEEK(top + offset - 1, 1)
    135       else
    136         val = PEEK(top + size - offset, 1)
    137       end
    138       if val != check.at(offset - 1)
    139         error_exit("value check of `#{label}' failed")
    140       end
    141     end
     112# 以下の定義は,過去のバージョンとの互換性のために残している.
     113
     114#
     115#  #defineディレクティブの生成
     116#
     117def GenerateDefine(symbol, value)
     118  $offsetH.add("#define #{symbol}\t#{value}")
     119end
     120
     121#
     122#  ビットフィールドのオフセットとビット位置の定義の生成
     123#
     124def GenerateDefineBit(label, structSize, outputSize)
     125  offset, position = BitOffsetPosition(label, structSize, outputSize)
     126  if !offset.nil?
     127    GenerateDefine(label, offset)
     128    GenerateDefine("#{label}_bit", position)
     129    GenerateDefine("#{label}_mask", sprintf("0x%x", 1 << position))
    142130  end
    143131end
    144 
    145 magicCheck(1, [ 0x12 ])
    146 magicCheck(2, [ 0x12, 0x34 ])
    147 magicCheck(4, [ 0x12, 0x34, 0x56, 0x78 ])
  • EcnlProtoTool/trunk/asp3_dcre/kernel/interrupt.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    9393#endif /* LOG_ENA_INT_LEAVE */
    9494
     95#ifndef LOG_CLR_INT_ENTER
     96#define LOG_CLR_INT_ENTER(intno)
     97#endif /* LOG_CLR_INT_ENTER */
     98
     99#ifndef LOG_CLR_INT_LEAVE
     100#define LOG_CLR_INT_LEAVE(ercd)
     101#endif /* LOG_CLR_INT_LEAVE */
     102
     103#ifndef LOG_RAS_INT_ENTER
     104#define LOG_RAS_INT_ENTER(intno)
     105#endif /* LOG_RAS_INT_ENTER */
     106
     107#ifndef LOG_RAS_INT_LEAVE
     108#define LOG_RAS_INT_LEAVE(ercd)
     109#endif /* LOG_RAS_INT_LEAVE */
     110
     111#ifndef LOG_PRB_INT_ENTER
     112#define LOG_PRB_INT_ENTER(intno)
     113#endif /* LOG_PRB_INT_ENTER */
     114
     115#ifndef LOG_PRB_INT_LEAVE
     116#define LOG_PRB_INT_LEAVE(ercd)
     117#endif /* LOG_PRB_INT_LEAVE */
     118
    95119#ifndef LOG_CHG_IPM_ENTER
    96120#define LOG_CHG_IPM_ENTER(intpri)
     
    108132#define LOG_GET_IPM_LEAVE(ercd, p_intpri)
    109133#endif /* LOG_GET_IPM_LEAVE */
     134
     135/*
     136 *  割込み番号の範囲の判定
     137 */
     138#ifndef VALID_INTNO_DISINT
     139#define VALID_INTNO_DISINT(intno)       VALID_INTNO(intno)
     140#endif /* VALID_INTNO_DISINT */
     141
     142#ifndef VALID_INTNO_CLRINT
     143#define VALID_INTNO_CLRINT(intno)       VALID_INTNO(intno)
     144#endif /* VALID_INTNO_CLRINT */
     145
     146#ifndef VALID_INTNO_RASINT
     147#define VALID_INTNO_RASINT(intno)       VALID_INTNO(intno)
     148#endif /* VALID_INTNO_RASINT */
     149
     150#ifndef VALID_INTNO_PRBINT
     151#define VALID_INTNO_PRBINT(intno)       VALID_INTNO(intno)
     152#endif /* VALID_INTNO_PRBINT */
     153
     154#ifndef VALID_INTNO_CREISR
     155#define VALID_INTNO_CREISR(intno)       VALID_INTNO(intno)
     156#endif /* VALID_INTNO_CREISR */
     157
     158/*
     159 *  割込み優先度の範囲の判定
     160 */
     161#ifndef VALID_INTPRI_CHGIPM
     162#define VALID_INTPRI_CHGIPM(intpri)     \
     163                                        (TMIN_INTPRI <= (intpri) && (intpri) <= TIPM_ENAALL)
     164#endif /* VALID_INTPRI_CHGIPM */
    110165
    111166/*
     
    266321        isrpri = pk_cisr->isrpri;
    267322
    268         CHECK_RSATR(isratr, TARGET_ISRATR);
     323        CHECK_VALIDATR(isratr, TARGET_ISRATR);
    269324        CHECK_PAR(VALID_INTNO_CREISR(intno));
    270325        CHECK_PAR(FUNC_ALIGN(isr));
     
    384439                lock_cpu();
    385440        }
    386         if (disable_int(intno)) {                                       /*[NGKI3086]*/
     441        if (check_intno_cfg(intno)) {
     442                disable_int(intno);                                             /*[NGKI3086]*/
    387443                ercd = E_OK;
    388444        }
     
    421477                lock_cpu();
    422478        }
    423         if (enable_int(intno)) {                                        /*[NGKI3099]*/
     479        if (check_intno_cfg(intno)) {
     480                enable_int(intno);                                              /*[NGKI3099]*/
    424481                ercd = E_OK;
    425482        }
     
    438495#endif /* TOPPERS_SUPPORT_ENA_INT */
    439496#endif /* TOPPERS_ena_int */
     497
     498/*
     499 *  割込み要求のクリア[NGKI3920]
     500 */
     501#ifdef TOPPERS_clr_int
     502#ifdef TOPPERS_SUPPORT_CLR_INT                                  /*[NGKI3927]*/
     503
     504ER
     505clr_int(INTNO intno)
     506{
     507        bool_t  locked;
     508        ER              ercd;
     509
     510        LOG_CLR_INT_ENTER(intno);
     511        CHECK_PAR(VALID_INTNO_CLRINT(intno));           /*[NGKI3921][NGKI3930]*/
     512
     513        locked = sense_lock();
     514        if (!locked) {
     515                lock_cpu();
     516        }
     517        if (check_intno_cfg(intno) && check_intno_clear(intno)) {
     518                clear_int(intno);                                               /*[NGKI3924]*/
     519                ercd = E_OK;
     520        }
     521        else {
     522                ercd = E_OBJ;                                                   /*[NGKI3923][NGKI3929]*/
     523        }
     524        if (!locked) {
     525                unlock_cpu();
     526        }
     527
     528  error_exit:
     529        LOG_CLR_INT_LEAVE(ercd);
     530        return(ercd);
     531}
     532
     533#endif /* TOPPERS_SUPPORT_CLR_INT */
     534#endif /* TOPPERS_clr_int */
     535
     536/*
     537 *  割込みの要求[NGKI3932]
     538 */
     539#ifdef TOPPERS_ras_int
     540#ifdef TOPPERS_SUPPORT_RAS_INT                                  /*[NGKI3939]*/
     541
     542ER
     543ras_int(INTNO intno)
     544{
     545        bool_t  locked;
     546        ER              ercd;
     547
     548        LOG_RAS_INT_ENTER(intno);
     549        CHECK_PAR(VALID_INTNO_RASINT(intno));           /*[NGKI3933][NGKI3942]*/
     550
     551        locked = sense_lock();
     552        if (!locked) {
     553                lock_cpu();
     554        }
     555        if (check_intno_cfg(intno) && check_intno_raise(intno)) {
     556                raise_int(intno);                                               /*[NGKI3936]*/
     557                ercd = E_OK;
     558        }
     559        else {
     560                ercd = E_OBJ;                                                   /*[NGKI3935][NGKI3941]*/
     561        }
     562        if (!locked) {
     563                unlock_cpu();
     564        }
     565
     566  error_exit:
     567        LOG_RAS_INT_LEAVE(ercd);
     568        return(ercd);
     569}
     570
     571#endif /* TOPPERS_SUPPORT_RAS_INT */
     572#endif /* TOPPERS_ras_int */
     573
     574/*
     575 *  割込み要求のチェック[NGKI3944]
     576 */
     577#ifdef TOPPERS_prb_int
     578#ifdef TOPPERS_SUPPORT_PRB_INT                                  /*[NGKI3951]*/
     579
     580ER_BOOL
     581prb_int(INTNO intno)
     582{
     583        bool_t  locked;
     584        ER_BOOL ercd;
     585
     586        LOG_PRB_INT_ENTER(intno);
     587        CHECK_PAR(VALID_INTNO_PRBINT(intno));           /*[NGKI3945][NGKI3952]*/
     588
     589        locked = sense_lock();
     590        if (!locked) {
     591                lock_cpu();
     592        }
     593        if (check_intno_cfg(intno)) {
     594                ercd = (ER_BOOL) probe_int(intno);              /*[NGKI3948]*/
     595        }
     596        else {
     597                ercd = E_OBJ;                                                   /*[NGKI3947]*/
     598        }
     599        if (!locked) {
     600                unlock_cpu();
     601        }
     602
     603  error_exit:
     604        LOG_PRB_INT_LEAVE(ercd);
     605        return(ercd);
     606}
     607
     608#endif /* TOPPERS_SUPPORT_PRB_INT */
     609#endif /* TOPPERS_prb_int */
    440610
    441611/*
     
    456626        t_set_ipm(intpri);                                                      /*[NGKI3111]*/
    457627        if (intpri == TIPM_ENAALL && enadsp) {
    458                 dspflg = true;
    459                 p_schedtsk = search_schedtsk();
     628                set_dspflg();
    460629                if (p_runtsk->raster && p_runtsk->enater) {
    461630                        task_terminate(p_runtsk);
  • EcnlProtoTool/trunk/asp3_dcre/kernel/interrupt.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    3838#   の責任を負わない.
    3939#
    40 #   $Id$
     40#   $Id: interrupt.trb 1167 2019-02-03 17:06:17Z ertl-hiro $
    4141#
    4242
     
    5454#  フォルト定義
    5555#
    56 if $INTNO_CREISR_VALID.nil?
     56if !defined?($INTNO_CREISR_VALID)
    5757  $INTNO_CREISR_VALID = $INTNO_VALID
    5858end
    59 if $INHNO_CREISR_VALID.nil?
     59if !defined?($INHNO_CREISR_VALID)
    6060  $INHNO_CREISR_VALID = $INHNO_VALID
    6161end
     
    6464#  CFG_INTで使用できる割込み優先度のデフォルト定義
    6565#
    66 if $INTPRI_CFGINT_VALID.nil?
     66if !defined?($INTPRI_CFGINT_VALID)
    6767  $INTPRI_CFGINT_VALID = $TMIN_INTPRI.upto($TMAX_INTPRI).to_a
    6868end
     
    8787#  割込み要求ラインに関するエラーチェック
    8888#
    89 $cfgData[:CFG_INT].each do |key, params|
    90   #     intnoが割込み番号として正しくない場合(E_PAR)[NGKI2972]
    91   if $INTNO_VALID.index(params[:intno]).nil?
     89$cfgData[:CFG_INT].each do |_, params|
     90  # intnoが有効範囲外の場合(E_PAR)[NGKI2972]
     91  if !$INTNO_VALID.include?(params[:intno])
    9292    error_illegal("E_PAR", params, :intno)
    9393  end
    9494
    95   #     intatrが無効の場合(E_RSATR)[NGKI2969
     95  # intatrが無効の場合(E_RSATR)[NGKI2969][NGKI2944][NGKI2945
    9696  #(TA_ENAINT,TA_EDGE,TARGET_INTATR以外のビットがセットされている場合)
    9797  if (params[:intatr] & ~($TA_ENAINT|$TA_EDGE|$TARGET_INTATR)) != 0
     
    9999  end
    100100
    101   #     intpriがCFG_INTに対する割込み優先度として正しくない場合(E_PAR)
    102   #     [NGKI2973]
    103   if $INTPRI_CFGINT_VALID.index(params[:intpri]).nil?
    104     error_illegal_sym("E_OBJ", params, :intpri, :intno)
    105   end
    106 
    107   # カーネル管理外に固定されているintnoに対して,intpriにTMIN_INTPRI
    108   #     りも小さい値が指定されなかった場合(E_OBJ)[NGKI2983]
    109   if !$INTNO_FIX_NONKERNEL.nil?
    110     if !$INTNO_FIX_NONKERNEL.index(params[:intno]).nil?
    111       if params[:intpri] >= $TMIN_INTPRI
    112         error_ercd("E_OBJ", params, "%%intno must have higher priority " \
     101  # intpriがCFG_INTに対する割込み優先度として正しくない場合(E_PAR)
     102  # [NGKI2973]
     103  if !$INTPRI_CFGINT_VALID.include?(params[:intpri])
     104    error_illegal_sym("E_PAR", params, :intpri, :intno)
     105  end
     106
     107  # カーネル管理外に固定されているintnoに対して,intpriにTMIN_INTPRI
     108  # 上の値が指定された場合(E_OBJ)[NGKI2983]
     109  if defined?($INTNO_FIX_NONKERNEL) \
     110                                && $INTNO_FIX_NONKERNEL.include?(params[:intno])
     111    if params[:intpri] >= $TMIN_INTPRI
     112      error_ercd("E_OBJ", params, "%%intno must have higher priority " \
    113113                                                                                        "than TMIN_INTPRI in %apiname")
    114       end
    115     end
    116   end
    117 
    118   #     カーネル管理に固定されているintnoに対して,intpriにTMIN_INTPRIより
    119   #     も小さい値が指定された場合(E_OBJ)[NGKI2984]
    120   if !$INTNO_FIX_KERNEL.nil?
    121     if !$INTNO_FIX_KERNEL.index(params[:intno]).nil?
    122       if params[:intpri] < $TMIN_INTPRI
    123         error_ercd("E_OBJ", params, "%%intno must have lower or equal " \
     114    end
     115  end
     116
     117  # カーネル管理に固定されているintnoに対して,intpriにTMIN_INTPRIより
     118  # も小さい値が指定された場合(E_OBJ)[NGKI2984]
     119  if defined?($INTNO_FIX_KERNEL) \
     120                                && $INTNO_FIX_KERNEL.include?(params[:intno])
     121    if params[:intpri] < $TMIN_INTPRI
     122      error_ercd("E_OBJ", params, "%%intno must have lower or equal " \
    124123                                                                        "priority to TMIN_INTPRI in %apiname")
    125       end
    126     end
     124    end
     125  end
     126
     127  # ターゲット依存のエラーチェック[NGKI2985]
     128  if defined? TargetCheckCfgInt()
     129    TargetCheckCfgInt(params)
    127130  end
    128131end
     
    131134#  割込みハンドラに関するエラーチェック
    132135#
    133 $cfgData[:DEF_INH].each do |key, params|
    134   # inhnoが割込みハンドラ番号として正しくない場合(E_PAR)[NGKI3055]
    135   if $INHNO_VALID.index(params[:inhno]).nil?
     136$cfgData[:DEF_INH].each do |_, params|
     137  # inhnoが有効範囲外の場合(E_PAR)[NGKI3055]
     138  if !$INHNO_VALID.include?(params[:inhno])
    136139    error_illegal("E_PAR", params, :inhno)
    137140  end
    138141
    139   # inhatrが無効の場合(E_RSATR)[NGKI3052]
     142  # inhatrが無効の場合(E_RSATR)[NGKI3052][NGKI2957][NGKI2959]
    140143  #(TARGET_INHATR以外のビットがセットされている場合)
    141144  if (params[:inhatr] & ~($TARGET_INHATR)) != 0
     
    143146  end
    144147
    145   #     カーネル管理外に固定されているinhnoに対して,inhatrにTA_NONKERNELが
    146   #     指定されていない場合(E_RSATR)[NGKI3067]
    147   if !$INHNO_FIX_NONKERNEL.nil?
    148     if !$INHNO_FIX_NONKERNEL.index(params[:inhno]).nil?
    149       if (params[:inhatr] & $TA_NONKERNEL) == 0
    150         error_ercd("E_RSATR", params, "%%inhno must be " \
     148  # カーネル管理外に固定されているinhnoに対して,inhatrにTA_NONKERNELが
     149  # 指定されていない場合(E_RSATR)[NGKI3067]
     150  if defined?($INHNO_FIX_NONKERNEL) \
     151                                && $INHNO_FIX_NONKERNEL.include?(params[:inhno])
     152    if (params[:inhatr] & $TA_NONKERNEL) == 0
     153      error_ercd("E_RSATR", params, "%%inhno must be " \
    151154                                                                "non-kernel interrupt in %apiname")
    152       end
    153     end
    154   end
    155 
    156   #     カーネル管理に固定されているinhnoに対して,inhatrにTA_NONKERNELが指
    157   #     定されている場合(E_RSATR)[NGKI3068]
    158   if !$INHNO_FIX_KERNEL.nil?
    159     if !$INHNO_FIX_KERNEL.index(params[:inhno]).nil?
    160       if (params[:inhatr] & $TA_NONKERNEL) != 0
    161         error_ercd("E_RSATR", params, "%%inhno must not be " \
     155    end
     156  end
     157
     158  # カーネル管理に固定されているinhnoに対して,inhatrにTA_NONKERNELが指
     159  # 定されている場合(E_RSATR)[NGKI3068]
     160  if defined?($INHNO_FIX_KERNEL) \
     161                                && $INHNO_FIX_KERNEL.include?(params[:inhno])
     162    if (params[:inhatr] & $TA_NONKERNEL) != 0
     163      error_ercd("E_RSATR", params, "%%inhno must not be " \
    162164                                                                "non-kernel interrupt in %apiname")
    163       end
    164     end
    165   end
    166 
    167   if $toIntnoVal.has_key?(params[:inhno].val)
     165    end
     166  end
     167
     168  if $INHNO_CREISR_VALID.include?(params[:inhno])
     169    # 割込みハンドラ番号に対応する割込み番号がある場合
    168170    intnoVal = $toIntnoVal[params[:inhno].val]
    169171
     
    174176    else
    175177      intnoParams = $cfgData[:CFG_INT][intnoVal]
     178
    176179      if (params[:inhatr] & $TA_NONKERNEL) == 0
    177180        # inhatrにTA_NONKERNELが指定されておらず,inhnoに対応するintno
     
    193196    end
    194197  end
     198
     199  # ターゲット依存のエラーチェック[NGKI3078]
     200  if defined? TargetCheckDefInh()
     201    TargetCheckDefInh(params)
     202  end
    195203end
    196204
     
    198206#  割込みサービスルーチン(ISR)に関するエラーチェック
    199207#
    200 $cfgData[:CRE_ISR].sort.each do |key, params|
    201   #     isratrが無効の場合(E_RSATR)[NGKI2998
     208$cfgData[:CRE_ISR].sort.each do |_, params|
     209  # isratrが無効の場合(E_RSATR)[NGKI2998][NGKI2952][NGKI5176
    202210  #(TARGET_ISRATR以外のビットがセットされている場合)
    203211  if (params[:isratr] & ~($TARGET_ISRATR)) != 0
     
    205213  end
    206214
    207   #     intnoがCRE_ISRに対する割込み番号として正しくない場合(E_PAR)
    208   #     [NGKI3003]
    209   if $INTNO_CREISR_VALID.index(params[:intno]).nil?
     215  # intnoが有効範囲外の場合(E_PAR)[NGKI3003]
     216  if !$INTNO_CREISR_VALID.include?(params[:intno])
    210217    error_illegal("E_PAR", params, "intno")
    211218  end
    212219
    213   #     (TMIN_ISRPRI <= isrpri && isrpri <= TMAX_ISRPRI)でない場合(E_PAR)
    214   #     [NGKI3005]
     220  # isrpriが有効範囲外の場合(E_PAR)[NGKI3005]
     221  #(TMIN_ISRPRI <= isrpri && isrpri <= TMAX_ISRPRIでない場合)
    215222  if !($TMIN_ISRPRI <= params[:isrpri] && params[:isrpri] <= $TMAX_ISRPRI)
    216223    error_illegal("E_PAR", params, "isrpri")
    217224  end
    218 end
    219 
    220 $INTNO_CREISR_VALID.each do |intnoVal|
    221   # 割込み番号intnoに対して登録されたISRのリストの作成
    222   isrParamsList = []
    223   $cfgData[:CRE_ISR].sort.each do |key, params|
    224     if params[:intno] == intnoVal
    225       isrParamsList.push(params)
    226     end
    227   end
    228 
    229   #     割込み番号intnoに対して登録されたISRが存在する場合
    230   if isrParamsList.size > 0
    231     inhnoVal = $toInhnoVal[intnoVal]
    232 
    233     # intnoに対応するinhnoに対してDEF_INHがある場合(E_OBJ)[NGKI3013]
    234     if $cfgData[:DEF_INH].has_key?(inhnoVal)
    235       inhnoParams = $cfgData[:DEF_INH][inhnoVal]
    236       error_ercd("E_OBJ", isrParamsList[0], "%%intno in %apiname " \
    237                                         "is duplicated with inhno #{inhnoParams[:inhno]}")
    238     end
    239 
    240     # intnoに対するCFG_INTがない場合(E_OBJ)[NGKI3012]
    241     if !$cfgData[:CFG_INT].has_key?(intnoVal)
    242       error_ercd("E_OBJ", isrParamsList[0], "%%intno in %apiname " \
     225
     226  # intnoに対応するinhnoに対してDEF_INHがある場合(E_OBJ)[NGKI3013]
     227  inhnoVal = $toInhnoVal[params[:intno].val]
     228  if $cfgData[:DEF_INH].has_key?(inhnoVal)
     229    error_ercd("E_OBJ", params, "%%intno in %apiname is duplicated " \
     230                                        "with inhno #{$cfgData[:DEF_INH][inhnoVal][:inhno]}")
     231  end
     232
     233  # intnoに対するCFG_INTがない場合(E_OBJ)[NGKI3012]
     234  if !$cfgData[:CFG_INT].has_key?(params[:intno])
     235    error_ercd("E_OBJ", params, "%%intno in %apiname " \
    243236                                                                        "is not configured with CFG_INT")
    244     else
    245       intnoParams = $cfgData[:CFG_INT][intnoVal]
    246 
    247       # intnoに対してCFG_INTで設定された割込み優先度がTMIN_INTPRIよりも
    248       # 小さい場合(E_OBJ)[NGKI3014]
    249       if intnoParams[:intpri] < $TMIN_INTPRI
    250         error_ercd("E_OBJ", isrParamsList[0],
    251                                                 "intpri `#{intnoParams[:intpri]}' configured for " \
    252                                                 "%%intno with CFG_INT in higher than TMIN_INTPRI")
    253       end
    254     end
     237  else
     238    intnoParams = $cfgData[:CFG_INT][params[:intno]]
     239
     240    # intnoでカーネル管理外の割込みを指定した場合(E_OBJ)[NGKI3014]
     241    #(intnoに対してCFG_INTで設定された割込み優先度がTMIN_INTPRIよりも小
     242    #  さい場合)
     243    if intnoParams[:intpri] < $TMIN_INTPRI
     244      error_ercd("E_OBJ", params,
     245                                        "intpri `#{intnoParams[:intpri]}' configured for " \
     246                                        "%%intno with CFG_INT in higher than TMIN_INTPRI")
     247    end
     248  end
     249
     250  # ターゲット依存のエラーチェック
     251  if defined? TargetCheckCreIsr()
     252    TargetCheckCreIsr(params)
    255253  end
    256254end
     
    298296  inhnoVal = $toInhnoVal[intnoVal]
    299297
    300   # 次のDEF_INHに相当するデータを生成
     298  # 次の静的APIに相当するデータを生成
    301299  # DEF_INH(inhno, { TA_NULL, _kernel_inthdr_<intno> } );
    302300  $cfgData[:DEF_INH][inhnoVal] = {
     
    306304  }
    307305
    308   # 割込みサービスルーチン用の割込みハンドラ
     306  # 割込みサービスルーチンを呼び出す割込みハンドラの生成[NGKI2941]
    309307  $kernelCfgC.add("void")
    310308  $kernelCfgC.add("_kernel_inthdr_#{intnoVal}(void)")
     
    335333
    336334# 割込みサービスルーチン生成順序テーブルの生成
    337 $kernelCfgC.add("const ID _kernel_isrorder_table[TNUM_SISRID] = { ")
    338 $kernelCfgC.append("\t")
    339 $cfgData[:CRE_ISR].each_with_index do |(key, params), index|
    340   $kernelCfgC.append(", ") if index > 0
    341   $kernelCfgC.append("#{params[:isrid]}")
    342 end
    343 $kernelCfgC.add
    344 $kernelCfgC.add2("};")
     335if $cfgData[:CRE_ISR].size != 0
     336  $kernelCfgC.add("const ID _kernel_isrorder_table[TNUM_SISRID] = { ")
     337  $kernelCfgC.append("\t")
     338  $cfgData[:CRE_ISR].each_with_index do |(_, params), index|
     339    $kernelCfgC.append(", ") if index > 0
     340    $kernelCfgC.append("#{params[:isrid]}")
     341  end
     342  $kernelCfgC.add
     343  $kernelCfgC.add2("};")
     344else
     345  $kernelCfgC.add2("TOPPERS_EMPTY_LABEL(const ID, " \
     346                                                                                "_kernel_isrorder_table);")
     347end
    345348
    346349#
     
    360363    #  割込みハンドラのエントリ
    361364    #
    362     $cfgData[:DEF_INH].each do |key, params|
     365    $cfgData[:DEF_INH].each do |_, params|
    363366      if (params[:inhatr] & $TA_NONKERNEL) == 0
    364367        $kernelCfgC.add("INTHDR_ENTRY(#{params[:inhno]}, " \
     
    372375    #
    373376    $kernelCfgC.add("const INHINIB _kernel_inhinib_table[TNUM_DEF_INHNO] = {")
    374     $cfgData[:DEF_INH].each_with_index do |(key, params), index|
     377    $cfgData[:DEF_INH].each_with_index do |(_, params), index|
    375378      $kernelCfgC.add(",") if index > 0
    376379      if (params[:inhatr] & $TA_NONKERNEL) == 0
     
    407410  if $cfgData[:CFG_INT].size != 0
    408411    $kernelCfgC.add("const INTINIB _kernel_intinib_table[TNUM_CFG_INTNO] = {")
    409     $cfgData[:CFG_INT].each_with_index do |(key, params), index|
     412    $cfgData[:CFG_INT].each_with_index do |(_, params), index|
    410413      $kernelCfgC.add(",") if index > 0
    411414      $kernelCfgC.append("\t{ (#{params[:intno]}), (#{params[:intatr]}), " \
  • EcnlProtoTool/trunk/asp3_dcre/kernel/kernel.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    3838#   の責任を負わない.
    3939#
    40 #   $Id$
     40#   $Id: kernel.trb 1167 2019-02-03 17:06:17Z ertl-hiro $
    4141#
    4242
     
    7575
    7676#
    77 #  インクルードディレクティブ(#include)
     77#  インクルードディレクティブ(#include)の生成
    7878#
    7979$kernelCfgC.comment_header("Include Directives")
    80 $includeFiles.each do |file|
    81   $kernelCfgC.add("#include #{file}")
    82 end
     80GenerateIncludes($kernelCfgC)
    8381$kernelCfgC.add()
    8482
     
    9189  def AllocStack(stack, size)
    9290    # 大きい方に丸めたサイズで確保する[NGKI1050][NGKI3220]
    93     $kernelCfgC.add("/*static*/ STK_T #{stack}[COUNT_STK_T(#{size})];")
     91    $kernelCfgC.add("static STK_T #{stack}[COUNT_STK_T(#{size})];")
    9492    return("ROUND_STK_T(#{size})")
    9593  end
     
    107105    @OBJ_S = obj_s.tr("a-z", "A-Z")
    108106    @objid = (obj + "id").to_sym
     107    @noobj = ("no" + obj).to_sym
    109108    @api = "CRE_#{@OBJ}".to_sym
     109    @aidapi = "AID_#{@OBJ}".to_sym
    110110    @inibList = { "#{@OBJ_S}INIB" => "a#{@obj_s}inib_table"}
    111111  end
     
    114114    # AID_@OBJの処理
    115115    numAutoObjid = 0
    116     $cfgData["AID_#{@OBJ}".to_sym].each do |key, params|
    117       numAutoObjid += params["no#{@obj}".to_sym]
     116    $cfgData[@aidapi].each do |_, params|
     117      numAutoObjid += params[@noobj]
    118118    end
    119119    numObjid = $cfgData[@api].size + numAutoObjid
     
    123123
    124124    # オブジェクトのID番号のマクロ定義の生成
    125     $cfgData[@api].sort.each do |key, params|
     125    $cfgData[@api].sort.each do |_, params|
    126126      $kernelCfgH.add("#define #{params[@objid]}\t#{params[@objid].val}")
    127127    end
     
    130130    # オブジェクトのID番号を保持する変数
    131131    if $USE_EXTERNAL_ID
    132       $cfgData[@api].sort.each do |key, params|
     132      $cfgData[@api].sort.each do |_, params|
    133133        $kernelCfgC.add("const ID #{params[@objid]}_id" \
    134134                                                                                " = #{params[@objid].val};")
     
    203203  nfymode1 = nfymode & 0x0f
    204204  nfymode2 = nfymode & ~0x0f
    205   par1 = params[:par1]
     205  # par1 = params[:par1]
    206206  par2 = params[:par2]
    207207
     
    232232    error_api(params, "too many parameters for nfymode `#{nfymode}' " \
    233233                                                                                        "in %apiname of %#{objid}")
    234   elsif nfymode == $TNFY_HANDLER
     234  elsif nfymode1 == $TNFY_HANDLER && nfymode2 == 0              #[NGKI3721]
    235235    # タイムイベントハンドラの呼出し
    236236    funcname = "(NFYHDR)(#{par2})"
     
    269269
    270270    # イベント通知処理の処理
    271     if nfymode1 == $TNFY_SETVAR && nfymode2 == 0
     271    if nfymode1 == $TNFY_SETVAR && nfymode2 == 0                #[NGKI3721]
    272272      # 変数の設定
    273273      $kernelCfgC.add("\t*((intptr_t *) exinf) = (#{par2});")
    274     elsif nfymode1 == $TNFY_INCVAR && nfymode2 == 0
     274    elsif nfymode1 == $TNFY_INCVAR && nfymode2 == 0             #[NGKI3721]
    275275      # 変数のインクリメント
    276276      $kernelCfgC.add("\t(void) loc_cpu();")
     
    293293      $kernelCfgC.add("\t#{errorCode}psnd_dtq(((ID) exinf), #{par2});")
    294294    else
     295      # nfymodeの値が正しくない場合(E_PAR)[NGKI3730]
    295296      error_illegal_id("E_PAR", params, :nfymode, objid)
    296297    end
    297                        
     298
    298299    if nfymode2 != 0
    299300      # エラー通知処理の処理
    300301      $kernelCfgC.add("\tif (ercd != E_OK) {")
    301 
    302302
    303303      if nfymode2 == $TENFY_SETVAR
     
    326326                                                                                                        " (intptr_t) ercd);")
    327327      else
     328        # nfymodeの値が正しくない場合(E_PAR)[NGKI3730]
    328329        error_illegal_id("E_PAR", params, :nfymode, objid)
    329330      end
     
    360361if $cfgData[:DEF_ICS].size == 0
    361362  # DEF_ICSがない場合のデフォルト値の設定
    362   if $DEFAULT_ISTK.nil?
     363  if !defined?($DEFAULT_ISTK)
    363364    # スタック領域の自動割付け
    364365    istksz = AllocStack("_kernel_istack", "DEFAULT_ISTKSZ")
     
    369370  end
    370371else
    371   # 静的API「DEF_ICS」が複数ある(E_OBJ)[NGKI3216]
     372  # 静的API「DEF_ICS」が複数ある場合(E_OBJ)[NGKI3216]
    372373  if $cfgData[:DEF_ICS].size > 1
    373374    error("E_OBJ: too many DEF_ICS")
     
    375376
    376377  # DEF_ICSがある場合の処理
    377   params = $cfgData[:DEF_ICS][1]
     378  params0 = $cfgData[:DEF_ICS][1]
    378379
    379380  # パラメータが省略された時のデフォルト値の設定
    380   params[:istk] ||= "NULL"
     381  params0[:istk] ||= "NULL"
    381382
    382383  # istkszがターゲット定義の最小値(TARGET_MIN_ISTKSZ,未定義の場合は1)
    383384  # よりも小さい場合(E_PAR)[NGKI3254]
    384   if params[:istksz] < $TARGET_MIN_ISTKSZ
    385     error_wrong("E_PAR", params, :istksz, "too small")
    386   end
    387 
    388   if params[:istk] == "NULL"
     385  if params0[:istksz] < $TARGET_MIN_ISTKSZ
     386    error_wrong("E_PAR", params0, :istksz, "too small")
     387  end
     388
     389  if params0[:istk] == "NULL"
    389390    # スタック領域の自動割付け
    390     istksz = AllocStack("_kernel_istack", params[:istksz])
     391    istksz = AllocStack("_kernel_istack", params0[:istksz])
    391392    istk = "_kernel_istack"
    392393  else
    393     # istkszがスタック領域のサイズとして正しくない場合(E_PAR)[NGKI3222]
    394     if (params[:istksz] & ($CHECK_STKSZ_ALIGN - 1)) != 0
    395       error_wrong("E_PAR", params, :istksz, "not aligned")
    396     end
    397 
    398     istksz = "(#{params[:istksz]})"
    399     istk = "(void *)(#{params[:istk]})"
     394    # istkszがターゲット定義の制約に合致しない場合(E_PAR)[NGKI3222]
     395    if (params0[:istksz] & ($CHECK_STKSZ_ALIGN - 1)) != 0
     396      error_wrong("E_PAR", params0, :istksz, "not aligned")
     397    end
     398
     399    istksz = "(#{params0[:istksz]})"
     400    istk = "(void *)(#{params0[:istk]})"
    400401  end
    401402end
     
    411412
    412413#
    413 #  カーネルが割り付けるメモリ領域
    414 #
    415 $kernelCfgC.comment_header("Memory Area Allocated by Kernel")
    416 
    417 if $cfgData[:DEF_KMM].size == 0
    418   # DEF_KMMがない場合のデフォルト値の設定
    419   kmmsz = "0"
    420   kmm = "NULL"
     414#  カーネルメモリプール領域
     415#
     416$kernelCfgC.comment_header("Kernel Memory Pool Area")
     417
     418if $cfgData[:DEF_MPK].size == 0
     419  # DEF_MPKがない場合のデフォルト値の設定
     420  mpksz = "0"
     421  mpk = "NULL"
    421422else
    422   # 静的API「DEF_KMM」が複数ある(E_OBJ)
    423   if ($cfgData[:DEF_KMM].size > 1)
    424     error("E_OBJ: too many DEF_KMM")
    425   end
    426 
    427   # DEF_KMMがある場合の処理
    428   params = $cfgData[:DEF_KMM][1]
     423  # 静的API「DEF_MPK」が複数ある(E_OBJ)[NGKI5073]
     424  if ($cfgData[:DEF_MPK].size > 1)
     425    error("E_OBJ: too many DEF_MPK")
     426  end
     427
     428  # DEF_MPKがある場合の処理
     429  params0 = $cfgData[:DEF_MPK][1]
    429430
    430431  # パラメータが省略された時のデフォルト値の設定
    431   params[:kmm] ||= "NULL"
    432 
    433   # kmmszが0の場合(E_PAR)
    434   if params[:kmmsz] == 0
    435     error_wrong("E_PAR", params, :kmmsz, "zero")
    436   end
    437 
    438   if params[:kmm] == "NULL"
    439     # カーネルが割り付けるメモリ領域の自動割付け
    440     $kernelCfgC.add("static MB_T _kernel_memory" \
    441                                         "[TOPPERS_COUNT_SZ(#{params[:kmmsz]}, sizeof(MB_T))];")
    442     kmmsz = "TOPPERS_ROUND_SZ(#{params[:kmmsz]}, sizeof(MB_T))"
    443     kmm = "_kernel_memory"
     432  params0[:mpk] ||= "NULL"
     433
     434  # mpkszが0の場合(E_PAR)[NGKI5071]
     435  if params0[:mpksz] == 0
     436    error_wrong("E_PAR", params0, :mpksz, "zero")
     437  end
     438
     439  if params0[:mpk] == "NULL"
     440    # カーネルメモリプール領域の自動割付け
     441    $kernelCfgC.add("static MB_T _kernel_memory_pool" \
     442                                        "[COUNT_MB_T(#{params0[:mpksz]})];")
     443    mpksz = "ROUND_MB_T(#{params0[:mpksz]})"
     444    mpk = "_kernel_memory_pool"
    444445  else
    445     # kmmszがカーネルが割り付けるメモリ領域のサイズとして正しくない場合
    446     # (E_PAR)
    447     if (params[:kmmsz] & ($CHECK_MB_ALIGN - 1)) != 0
    448       error_wrong("E_PAR", params, :kmmsz, "not aligned")
    449     end
    450 
    451     kmmsz = "(#{params[:kmmsz]})"
    452     kmm = "(void *)(#{params[:kmm]})"
     446    # mpkszがターゲット定義の制約に合致しない場合(E_PAR)[NGKI5083]
     447    if (params0[:mpksz] & ($CHECK_MB_ALIGN - 1)) != 0
     448      error_wrong("E_PAR", params0, :mpksz, "not aligned")
     449    end
     450
     451    mpksz = "(#{params0[:mpksz]})"
     452    mpk = "(void *)(#{params0[:mpk]})"
    453453  end
    454454end
    455455
    456456$kernelCfgC.add(<<EOS)
    457 const size_t _kernel_kmmsz = #{kmmsz};
    458 MB_T *const _kernel_kmm = #{kmm};
     457const size_t _kernel_mpksz = #{mpksz};
     458MB_T *const _kernel_mpk = #{mpk};
    459459EOS
    460460
     
    484484#  初期化ルーチン機能
    485485#
     486
     487# kernel_cfg.hの生成
     488$kernelCfgH.add2("#define TNUM_INIRTN\t#{$cfgData[:ATT_INI].size}")
     489
     490# kernel_cfg.cの生成
    486491$kernelCfgC.comment_header("Initialization Routine")
    487492
    488493# エラーチェック
    489 $cfgData[:ATT_INI].each do |key, params|
    490   # iniatrが無効の場合(E_RSATR)[NGKI3241]
     494$cfgData[:ATT_INI].each do |_, params|
     495  # iniatrが無効の場合(E_RSATR)[NGKI3241][NGKI3202][NGKI3203]
    491496  #(TA_NULLでない場合)
    492497  if (params[:iniatr] != $TA_NULL)
     
    495500end
    496501
    497 # 初期化ルーチンの実行関数の生成
    498 $kernelCfgC.append(<<EOS)
    499 void
    500 _kernel_call_inirtn(void)
    501 {
    502 EOS
    503 $cfgData[:ATT_INI].each do |key, params|
    504   $kernelCfgC.add("\t((INIRTN)(#{params[:inirtn]}))" \
    505                                                                 "((intptr_t)(#{params[:exinf]}));")
    506 end
    507 $kernelCfgC.add2("}")
     502# 初期化ルーチンの数の定義
     503$kernelCfgC.add2("const uint_t _kernel_tnum_inirtn = TNUM_INIRTN;");
     504
     505# 初期化ルーチンテーブルの生成
     506if $cfgData[:ATT_INI].size > 0
     507  $kernelCfgC.add("const INIRTNB _kernel_inirtnb_table[TNUM_INIRTN] = {")
     508  $cfgData[:ATT_INI].each_with_index do |(_, params), index|
     509    $kernelCfgC.add(",") if index > 0
     510    $kernelCfgC.append("\t{ (INIRTN)(#{params[:inirtn]}), " \
     511                                                                "(intptr_t)(#{params[:exinf]}) }")
     512  end
     513  $kernelCfgC.add
     514  $kernelCfgC.add2("};")
     515else
     516  $kernelCfgC.add2("TOPPERS_EMPTY_LABEL(const INIRTNB, " \
     517                                                                                "_kernel_inirtnb_table);")
     518end
    508519
    509520#
    510521#  終了処理ルーチン機能
    511522#
     523
     524# kernel_cfg.hの生成
     525$kernelCfgH.add2("#define TNUM_TERRTN\t#{$cfgData[:ATT_TER].size}")
     526
     527# kernel_cfg.cの生成
    512528$kernelCfgC.comment_header("Termination Routine")
    513529
    514530# エラーチェック
    515 $cfgData[:ATT_TER].each do |key, params|
    516   # teratrが無効の場合(E_RSATR)[NGKI3248]
     531$cfgData[:ATT_TER].each do |_, params|
     532  # teratrが無効の場合(E_RSATR)[NGKI3248][NGKI3208][NGKI3209]
    517533  #(TA_NULLでない場合)
    518534  if (params[:teratr] != $TA_NULL)
     
    521537end
    522538
    523 # 終了処理ルーチンの実行関数の生成
    524 $kernelCfgC.append(<<EOS)
    525 void
    526 _kernel_call_terrtn(void)
    527 {
    528 EOS
    529 $cfgData[:ATT_TER].reverse_each do |key, params|
    530   $kernelCfgC.add("\t((TERRTN)(#{params[:terrtn]}))" \
    531                                                                 "((intptr_t)(#{params[:exinf]}));")
    532 end
    533 $kernelCfgC.add2("}")
     539# 終了処理ルーチンの数の定義
     540$kernelCfgC.add2("const uint_t _kernel_tnum_terrtn = TNUM_TERRTN;");
     541
     542# 終了処理ルーチンテーブルの生成
     543if $cfgData[:ATT_TER].size > 0
     544  $kernelCfgC.add("const TERRTNB _kernel_terrtnb_table[TNUM_TERRTN] = {")
     545  $cfgData[:ATT_TER].reverse_each.each_with_index do |(_, params), index|
     546    $kernelCfgC.add(",") if index > 0
     547    $kernelCfgC.append("\t{ (TERRTN)(#{params[:terrtn]}), " \
     548                                                                "(intptr_t)(#{params[:exinf]}) }")
     549  end
     550  $kernelCfgC.add
     551  $kernelCfgC.add2("};")
     552else
     553  $kernelCfgC.add2("TOPPERS_EMPTY_LABEL(const TERRTNB, " \
     554                                                                                "_kernel_terrtnb_table);")
     555end
    534556
    535557#
  • EcnlProtoTool/trunk/asp3_dcre/kernel/kernel_api.def

    r331 r429  
    2323DEF_EXC .excno* { .excatr &exchdr }
    2424DEF_ICS { .istksz &istk? }
    25 DEF_KMM { .kmmsz &kmm? }
     25DEF_MPK { .mpksz &mpk? }
    2626ATT_INI { .iniatr &exinf &inirtn }
    2727ATT_TER { .teratr &exinf &terrtn }
  • EcnlProtoTool/trunk/asp3_dcre/kernel/kernel_check.trb

    r321 r429  
    11# -*- coding: utf-8 -*-
    2 # 
     2#
    33#   TOPPERS/ASP Kernel
    44#       Toyohashi Open Platform for Embedded Real-Time Systems/
     
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010
     
    3838#   の責任を負わない.
    3939#
    40 #   $Id$
     40#   $Id: kernel_check.trb 1167 2019-02-03 17:06:17Z ertl-hiro $
    4141
    4242
     
    4545#
    4646
    47 # 
     47#
    4848#  タイムスタンプファイルの指定
    49 # 
     49#
    5050$timeStampFileName = "check.timestamp"
    5151
     
    5353#  データセクションのLMAからVMAへのコピー
    5454#
    55 if !$lmaList.nil?
     55if defined?($lmaList)
    5656  $lmaList.each do |lma|
    5757    startData = SYMBOL(lma[:START_DATA])
     
    9292    # 通知処理のパラメータが2つの場合
    9393    epar1 = params[:par3]
    94     epar2 = params[:par4]
     94    # epar2 = params[:par4]
    9595  else
    9696    # 通知処理のパラメータが1つの場合
    9797    epar1 = params[:par2]
    98     epar2 = params[:par3]
    99   end
    100 
    101   #     タイムイベントハンドラの先頭番地のチェック[NGKI3693]
     98    # epar2 = params[:par3]
     99  end
     100
     101  # タイムイベントハンドラの先頭番地が,プログラムの先頭番地として正し
     102  # くない場合(E_PAR)[NGKI3693]
    102103  if nfymode == $TNFY_HANDLER
    103104    tmehdr = nfyhdr
     
    112113  end
    113114
    114   #     イベント通知処理の変数の番地とオブジェクトIDのチェック
     115  # イベント通知処理の変数の番地とオブジェクトIDのチェック
    115116  if nfymode1 == $TNFY_SETVAR || nfymode1 == $TNFY_INCVAR
    116117    # 変数の設定/インクリメントによるタイムイベントの通知
     
    119120    params1[:p_var] = par1
    120121
    121     # 変数の番地のチェック[NGKI3699][NGKI3897]
     122    # 通知方法中の変数の番地が,intptr_t型の変数の番地として正しくない
     123    # 場合(E_PAR)[NGKI3699][NGKI3897]
    122124    if (p_var & ($CHECK_INTPTR_ALIGN - 1)) != 0
    123125      error_wrong_id("E_PAR", params1, :p_var, objid, "not aligned")
     
    132134    params1[:tskid] = par1
    133135
    134     # タスクIDのチェック[NGKI3704]
     136    # 通知方法中のタスクIDが有効範囲外の場合(E_ID)[NGKI3704]
    135137    if !($TMIN_TSKID <= tskid && tskid <= $tmax_tskid)
    136138      error_illegal_id("E_ID", params1, :tskid, objid)
     
    142144    params1[:semid] = par1
    143145
    144     # セマフォIDのチェック[NGKI3707]
     146    # 通知方法中のセマフォIDが有効範囲外の場合(E_ID)[NGKI3707]
    145147    if !($TMIN_SEMID <= semid && semid <= $tmax_semid)
    146148      error_illegal_id("E_ID", params1, :semid, objid)
     
    152154    params1[:flgid] = par1
    153155
    154     # イベントフラグIDのチェック[NGKI3710]
     156    # 通知方法中のイベントフラグIDが有効範囲外の場合(E_ID)[NGKI3710]
    155157    if !($TMIN_FLGID <= flgid && flgid <= $tmax_flgid)
    156158      error_illegal_id("E_ID", params1, :flgid, objid)
     
    162164    params1[:dtqid] = par1
    163165
    164     # データキューIDのチェック[NGKI3713]
     166    # 通知方法中のデータキューIDが有効範囲外の場合(E_ID)[NGKI3713]
    165167    if !($TMIN_DTQID <= dtqid && dtqid <= $tmax_dtqid)
    166168      error_illegal_id("E_ID", params1, :dtqid, objid)
     
    175177    params1[:p_var] = epar1
    176178
    177     # 変数の番地のチェック[NGKI3701][NGKI3897]
     179    # 通知方法中の変数の番地が,intptr_t型の変数の番地として正しくない
     180    # 場合(E_PAR)[NGKI3701][NGKI3897]
    178181    if (p_var & ($CHECK_INTPTR_ALIGN - 1)) != 0
    179182      error_wrong_id("E_PAR", params1, :p_var, objid, "not aligned")
     
    188191    params1[:tskid] = epar1
    189192
    190     # タスクIDのチェック[NGKI3704]
     193    # 通知方法中のタスクIDが有効範囲外の場合(E_ID)[NGKI3704]
    191194    if !($TMIN_TSKID <= tskid && tskid <= $tmax_tskid)
    192195      error_illegal_id("E_ID", params1, :tskid, objid)
     
    198201    params1[:semid] = epar1
    199202
    200     # セマフォIDのチェック[NGKI3707]
     203    # 通知方法中のセマフォIDが有効範囲外の場合(E_ID)[NGKI3707]
    201204    if !($TMIN_SEMID <= semid && semid <= $tmax_semid)
    202205      error_illegal_id("E_ID", params1, :semid, objid)
     
    208211    params1[:flgid] = epar1
    209212
    210     # イベントフラグIDのチェック[NGKI3710]
     213    # 通知方法中のイベントフラグIDが有効範囲外の場合(E_ID)[NGKI3710]
    211214    if !($TMIN_FLGID <= flgid && flgid <= $tmax_flgid)
    212215      error_illegal_id("E_ID", params1, :flgid, objid)
     
    218221    params1[:dtqid] = epar1
    219222
    220     # データキューIDのチェック[NGKI3715]
     223    # 通知方法中のデータキューIDが有効範囲外の場合(E_ID)[NGKI3715]
    221224    if !($TMIN_DTQID <= dtqid && dtqid <= $tmax_dtqid)
    222225      error_illegal_id("E_ID", params1, :dtqid, objid)
     
    225228end
    226229
    227 # 
     230#
    228231#  タスクに関するチェック
    229 # 
     232#
    230233tinib = SYMBOL("_kernel_tinib_table")
    231234$cfgData[:CRE_TSK].sort.each do |key, params|
     235  # taskがプログラムの先頭番地として正しくない場合(E_PAR)[NGKI1033]
    232236  task = PEEK(tinib + $offsetof_TINIB_task, $sizeof_TASK)
    233 
    234   # タスクの先頭番地のチェック[NGKI1033]
    235237  if (task & ($CHECK_FUNC_ALIGN - 1)) != 0
    236238    error_wrong_id("E_PAR", params, :task, :tskid, "not aligned")
     
    240242  end
    241243
    242   # タスクのスタック領域の先頭番地のチェック[NGKI1056]
     244  # stkがターゲット定義の制約に合致しない場合(E_PAR)[NGKI1056]
    243245  if $USE_TSKINICTXB
    244246    stk = GetStackTskinictxb(key, params, tinib)
     
    256258end
    257259
    258 # 
     260#
    259261#  固定長メモリプールに関するチェック
    260 # 
     262#
    261263mpfinib = SYMBOL("_kernel_mpfinib_table")
    262 $cfgData[:CRE_MPF].sort.each do |key, params|
     264$cfgData[:CRE_MPF].sort.each do |_, params|
    263265  mpf = PEEK(mpfinib + $offsetof_MPFINIB_mpf, $sizeof_void_ptr)
    264266
    265   # 固定長メモリプール領域の先頭番地のチェック[NGKI2249]
     267  # mpfがターゲット定義の制約に合致しない場合(E_PAR)[NGKI2249]
    266268  if (mpf & ($CHECK_MPF_ALIGN - 1)) != 0
    267269    error_wrong_id("E_PAR", params, :mpf, :mpfid, "not aligned")
     
    274276end
    275277
    276 # 
     278#
    277279#  周期通知に関するチェック
    278 # 
     280#
    279281cycinib = SYMBOL("_kernel_cycinib_table")
    280282$cfgData[:CRE_CYC].sort.each do |key, params|
     
    282284  nfyhdr = PEEK(cycinib + $offsetof_CYCINIB_nfyhdr, $sizeof_NFYHDR)
    283285
    284   #     通知情報のチェック
     286  # 通知情報のチェック
    285287  checkNotifyHandler(key, params, :cycid, exinf, nfyhdr)
    286288
     
    288290end
    289291
    290 # 
     292#
    291293#  アラーム通知に関するチェック
    292 # 
     294#
    293295alminib = SYMBOL("_kernel_alminib_table")
    294296$cfgData[:CRE_ALM].sort.each do |key, params|
     
    296298  nfyhdr = PEEK(alminib + $offsetof_ALMINIB_nfyhdr, $sizeof_NFYHDR)
    297299
    298   #     通知情報のチェック
     300  # 通知情報のチェック
    299301  checkNotifyHandler(key, params, :almid, exinf, nfyhdr)
    300302
     
    306308#
    307309isrinib = SYMBOL("_kernel_isrinib_table")
    308 $cfgData[:CRE_ISR].sort.each do |key, params|
     310$cfgData[:CRE_ISR].sort.each do |_, params|
    309311  isr = PEEK(isrinib + $offsetof_ISRINIB_isr, $sizeof_ISR)
    310312
    311   # 割込みサービスルーチンの先頭番地のチェック[NGKI3004]
     313  # isrがプログラムの先頭番地として正しくない場合[NGKI3004]
    312314  if (isr & ($CHECK_FUNC_ALIGN - 1)) != 0
    313315    error_wrong_id("E_PAR", params, :isr, :isrid, "not aligned")
     
    320322end
    321323
    322 # 
     324#
    323325#  非タスクコンテキスト用のスタック領域に関するチェック
    324 # 
    325 istkAddr = SYMBOL("_kernel_istk")
    326 if !istkAddr.nil?
    327   istk = PEEK(istkAddr, $sizeof_void_ptr)
    328 
    329   # 非タスクコンテキスト用のスタック領域の先頭番地のチェック[NGKI3222]
     326#
     327if $cfgData[:DEF_ICS].size > 0
     328  params0 = $cfgData[:DEF_ICS][1]
     329  istk = PEEK(SYMBOL("_kernel_istk"), $sizeof_void_ptr)
     330
     331  # istkがターゲット定義の制約に合致しない場合(E_PAR)[NGKI3222]
    330332  if (istk & ($CHECK_STACK_ALIGN - 1)) != 0
    331     error_wrong("E_PAR", $cfgData[:DEF_ICS][1], :istk, "not aligned")
     333    error_wrong("E_PAR", params0, :istk, "not aligned")
    332334  end
    333335  if $CHECK_STACK_NONNULL && istk == 0
    334     error_wrong("E_PAR", $cfgData[:DEF_ICS][1], :istk, "null")
    335   end
    336 end
    337 
    338 #
    339 #  カーネルが割り付けるメモリ領域に関するチェック
    340 #
    341 kmmAddr = SYMBOL("_kernel_kmm")
    342 if !kmmAddr.nil?
    343   kmm = PEEK(kmmAddr, $sizeof_void_ptr)
    344 
    345   # カーネルが割り付けるメモリ領域の先頭番地のチェック
    346   if (kmm & ($CHECK_MB_ALIGN - 1)) != 0
    347     error_wrong("E_PAR", $cfgData[:DEF_KMM][1], :kmm, "not aligned")
    348   end
    349 end
     336    error_wrong("E_PAR", params0, :istk, "null")
     337  end
     338end
     339
     340#
     341#  カーネルメモリプール領域に関するチェック
     342#
     343if $cfgData[:DEF_MPK].size > 0
     344  params0 = $cfgData[:DEF_MPK][1]
     345  mpk = PEEK(SYMBOL("_kernel_mpk"), $sizeof_void_ptr)
     346
     347  # mpkがターゲット定義の制約に合致しない場合(E_PAR)[NGKI5083]
     348  if (mpk & ($CHECK_MPK_ALIGN - 1)) != 0
     349    error_wrong("E_PAR", params0, :mpk, "not aligned")
     350  end
     351  if $CHECK_MPK_NONNULL && mpk == 0
     352    error_wrong("E_PAR", params0, :mpk, "null")
     353  end
     354end
     355
     356#
     357#  初期化ルーチンに関するチェック
     358#
     359inirtnb = SYMBOL("_kernel_inirtnb_table")
     360$cfgData[:ATT_INI].each do |_, params|
     361  inirtn = PEEK(inirtnb + $offsetof_INIRTNB_inirtn, $sizeof_INIRTN)
     362
     363  # inirtnがプログラムの先頭番地として正しくない場合(E_PAR)[NGKI3243]
     364  if (inirtn & ($CHECK_FUNC_ALIGN - 1)) != 0
     365    error_wrong("E_PAR", params, :inirtn, "not aligned")
     366  end
     367  if $CHECK_FUNC_NONNULL && inirtn == 0
     368    error_wrong("E_PAR", params, :inirtn, "null")
     369  end
     370
     371  inirtnb += $sizeof_INIRTNB
     372end
     373
     374#
     375#  終了処理ルーチンに関するチェック
     376#
     377terrtnb = SYMBOL("_kernel_terrtnb_table")
     378$cfgData[:ATT_TER].each do |_, params|
     379  terrtn = PEEK(terrtnb + $offsetof_TERRTNB_terrtn, $sizeof_TERRTN)
     380
     381  # terrtnがプログラムの先頭番地として正しくない場合(E_PAR)[NGKI3250]
     382  if (terrtn & ($CHECK_FUNC_ALIGN - 1)) != 0
     383    error_wrong("E_PAR", params, :terrtn, "not aligned")
     384  end
     385  if $CHECK_FUNC_NONNULL && terrtn == 0
     386    error_wrong("E_PAR", params, :terrtn, "null")
     387  end
     388
     389  terrtnb += $sizeof_TERRTNB
     390end
  • EcnlProtoTool/trunk/asp3_dcre/kernel/kernel_impl.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2004-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    7171
    7272/*
    73  *  型キャストを行うマクロの定義
    74  */
    75 #ifndef CAST
    76 #define CAST(type, val)         ((type)(val))
    77 #endif /* CAST */
     73 *  トレースログに関する設定
     74 */
     75#ifdef TOPPERS_ENABLE_TRACE
     76#include "arch/tracelog/trace_log.h"
     77#endif /* TOPPERS_ENABLE_TRACE */
    7878
    7979/*
     
    157157#endif /* TARGET_ISRATR */
    158158
     159#ifndef TARGET_MIN_STKSZ                        /* タスクのスタックサイズの最小値 */
     160#define TARGET_MIN_STKSZ        1U              /* 未定義の場合は0でないことをチェック */
     161#endif /* TARGET_MIN_STKSZ */
     162
    159163/*
    160164 *  ヘッダファイルを持たないモジュールの関数・変数の宣言
     
    173177
    174178/*
    175  *  初期化ルーチンの実行(kernel_cfg.c)
    176  */
    177 extern void     call_inirtn(void);
    178 
    179 /*
    180  *  終了処理ルーチンの実行(kernel_cfg.c)
    181  */
    182 extern void     call_terrtn(void);
     179 *  初期化ルーチン関係の定義(kernel_cfg.c)
     180 */
     181typedef struct initialization_routine_block {
     182        INIRTN          inirtn;                                 /* 初期化ルーチンの先頭番地 */
     183        intptr_t        exinf;                                  /* 初期化ルーチンの拡張情報 */
     184} INIRTNB;
     185
     186extern const uint_t     tnum_inirtn;            /* 初期化ルーチンの数 */
     187
     188extern const INIRTNB inirtnb_table[];   /* 初期化ルーチンブロックテーブル */
     189
     190/*
     191 *  終了処理ルーチン関係の定義(kernel_cfg.c)
     192 */
     193typedef struct termination_routine_block {
     194        TERRTN          terrtn;                                 /* 終了処理ルーチンの先頭番地 */
     195        intptr_t        exinf;                                  /* 終了処理ルーチンの拡張情報 */
     196} TERRTNB;
     197
     198extern const uint_t     tnum_terrtn;            /* 終了処理ルーチンの数 */
     199
     200extern const TERRTNB terrtnb_table[];   /* 終了処理ルーチンブロックテーブル */
    183201
    184202/*
     
    192210
    193211/*
    194  *  カーネルが割り付けるメモリ領域(kernel_cfg.c)
    195  */
    196 extern const size_t     kmmsz;          /* カーネルが割り付けるメモリ領域のサイズ */
    197 extern MB_T *const      kmm;            /* カーネルが割り付けるメモリ領域の先頭番地 */
     212 *  カーネルメモリプール領域(kernel_cfg.c)
     213 */
     214extern const size_t     mpksz;          /* カーネルメモリプール領域のサイズ */
     215extern MB_T *const      mpk;            /* カーネルメモリプール領域の先頭番地 */
    198216
    199217/*
     
    203221
    204222/*
     223 *  カーネルメモリプール領域有効フラグ(startup.c)
     224 */
     225extern bool_t   mpk_valid;
     226
     227/*
    205228 *  カーネルの起動(startup.c)
    206229 */
     
    213236
    214237/*
    215  *  カーネルの割り付けるメモリ領域の管理(startup.c)
    216  */
    217 extern void initialize_kmm(void);
    218 extern void *kernel_malloc(size_t size);
    219 extern void kernel_free(void *ptr);
     238 *  メモリプール領域の管理(startup.c)
     239 */
     240extern bool_t initialize_mempool(MB_T *mempool, size_t size);
     241extern void *malloc_mempool(MB_T *mempool, size_t size);
     242extern void free_mempool(MB_T *mempool, void *ptr);
     243
     244/*
     245 *  カーネルメモリプール領域からのメモリ獲得/解放
     246 */
     247Inline void *
     248malloc_mpk(size_t size)
     249{
     250        if (mpk_valid) {
     251                return(malloc_mempool(mpk, size));
     252        }
     253        else {
     254                return(NULL);
     255        }
     256}
     257
     258Inline void
     259free_mpk(void *ptr)
     260{
     261        if (mpk_valid) {
     262                free_mempool(mpk, ptr);
     263        }
     264}
    220265
    221266/*
     
    225270
    226271/*
    227  *  通知方法のエラーチェック
     272 *  通知方法のエラーチェック(time_manage.c)
    228273 */
    229274extern ER check_nfyinfo(const T_NFYINFO *p_nfyinfo);
    230275
    231276/*
    232  *  通知ハンドラ
     277 *  通知ハンドラ(time_manage.c)
    233278 */
    234279extern void notify_handler(intptr_t exinf);
  • EcnlProtoTool/trunk/asp3_dcre/kernel/kernel_rename.def

    r331 r429  
    11# startup.c
    22kerflg
     3mpk_valid
    34exit_kernel
    4 initialize_kmm
    5 kernel_malloc
    6 kernel_free
     5initialize_mempool
     6malloc_mempool
     7free_mempool
    78
    89# task.c
     
    5152set_hrt_event
    5253tmevtb_register
    53 tmevtb_enqueue
     54tmevtb_enqueue_reltim
    5455tmevtb_dequeue
    5556check_adjtim
     
    124125# kernel_cfg.c
    125126initialize_object
    126 call_inirtn
    127 call_terrtn
     127tnum_inirtn
     128inirtnb_table
     129tnum_terrtn
     130terrtnb_table
    128131tmax_tskid
    129132tmax_stskid
     
    193196istk
    194197istkpt
    195 kmmsz
    196 kmm
     198mpksz
     199mpk
     200
     201# tTraceLog.c
     202log_dsp_enter
     203log_dsp_leave
     204log_inh_enter
     205log_inh_leave
     206log_exc_enter
     207log_exc_leave
    197208
    198209INCLUDE "target"
  • EcnlProtoTool/trunk/asp3_dcre/kernel/kernel_rename.h

    r321 r429  
    88 */
    99#define kerflg                                          _kernel_kerflg
     10#define mpk_valid                                       _kernel_mpk_valid
    1011#define exit_kernel                                     _kernel_exit_kernel
    11 #define initialize_kmm                          _kernel_initialize_kmm
    12 #define kernel_malloc                           _kernel_kernel_malloc
    13 #define kernel_free                                     _kernel_kernel_free
     12#define initialize_mempool                      _kernel_initialize_mempool
     13#define malloc_mempool                          _kernel_malloc_mempool
     14#define free_mempool                            _kernel_free_mempool
    1415
    1516/*
     
    6667#define set_hrt_event                           _kernel_set_hrt_event
    6768#define tmevtb_register                         _kernel_tmevtb_register
    68 #define tmevtb_enqueue                          _kernel_tmevtb_enqueue
     69#define tmevtb_enqueue_reltim           _kernel_tmevtb_enqueue_reltim
    6970#define tmevtb_dequeue                          _kernel_tmevtb_dequeue
    7071#define check_adjtim                            _kernel_check_adjtim
     
    163164 */
    164165#define initialize_object                       _kernel_initialize_object
    165 #define call_inirtn                                     _kernel_call_inirtn
    166 #define call_terrtn                                     _kernel_call_terrtn
     166#define tnum_inirtn                                     _kernel_tnum_inirtn
     167#define inirtnb_table                           _kernel_inirtnb_table
     168#define tnum_terrtn                                     _kernel_tnum_terrtn
     169#define terrtnb_table                           _kernel_terrtnb_table
    167170#define tmax_tskid                                      _kernel_tmax_tskid
    168171#define tmax_stskid                                     _kernel_tmax_stskid
     
    232235#define istk                                            _kernel_istk
    233236#define istkpt                                          _kernel_istkpt
    234 #define kmmsz                                           _kernel_kmmsz
    235 #define kmm                                                     _kernel_kmm
     237#define mpksz                                           _kernel_mpksz
     238#define mpk                                                     _kernel_mpk
     239
     240/*
     241 *  tTraceLog.c
     242 */
     243#define log_dsp_enter                           _kernel_log_dsp_enter
     244#define log_dsp_leave                           _kernel_log_dsp_leave
     245#define log_inh_enter                           _kernel_log_inh_enter
     246#define log_inh_leave                           _kernel_log_inh_leave
     247#define log_exc_enter                           _kernel_log_exc_enter
     248#define log_exc_leave                           _kernel_log_exc_leave
    236249
    237250
  • EcnlProtoTool/trunk/asp3_dcre/kernel/kernel_sym.def

    r331 r429  
    1 USE_EXTERNAL_ID,true,bool,defined(USE_EXTERNAL_ID)
    2 SIL_ENDIAN_BIG,true,bool,defined(SIL_ENDIAN_BIG)
    3 SIL_ENDIAN_LITTLE,true,bool,defined(SIL_ENDIAN_LITTLE)
     1USE_EXTERNAL_ID,true,bool,defined(USE_EXTERNAL_ID),false
    42TA_NULL
    53TA_ACT
     
    4846TMIN_CYCID,,signed
    4947TMIN_ALMID,,signed
    50 USE_TSKINICTXB,true,bool,defined(USE_TSKINICTXB)
    51 OMIT_INITIALIZE_INTERRUPT,true,bool,defined(OMIT_INITIALIZE_INTERRUPT)
    52 USE_INHINIB_TABLE,true,bool,defined(USE_INHINIB_TABLE)
    53 USE_INTINIB_TABLE,true,bool,defined(USE_INTINIB_TABLE)
    54 OMIT_INITIALIZE_EXCEPTION,true,bool,defined(OMIT_INITIALIZE_EXCEPTION)
    55 DEFAULT_ISTK,,,defined(DEFAULT_ISTK)
    56 TARGET_TSKATR,,,defined(TARGET_TSKATR),0
     48USE_TSKINICTXB,true,bool,defined(USE_TSKINICTXB),false
     49OMIT_INITIALIZE_INTERRUPT,true,bool,defined(OMIT_INITIALIZE_INTERRUPT),false
     50USE_INHINIB_TABLE,true,bool,defined(USE_INHINIB_TABLE),false
     51USE_INTINIB_TABLE,true,bool,defined(USE_INTINIB_TABLE),false
     52OMIT_INITIALIZE_EXCEPTION,true,bool,defined(OMIT_INITIALIZE_EXCEPTION),false
     53DEFAULT_ISTK,,intptr,defined(DEFAULT_ISTK)
     54TARGET_TSKATR
    5755TARGET_INTATR,,,defined(TARGET_INTATR),0
    5856TARGET_INHATR,,,defined(TARGET_INHATR),0
    59 TARGET_ISRATR,,,defined(TARGET_ISRATR),0
     57TARGET_ISRATR
    6058TARGET_EXCATR,,,defined(TARGET_EXCATR),0
    61 TARGET_MIN_STKSZ,,,defined(TARGET_MIN_STKSZ),1
     59TARGET_MIN_STKSZ
    6260TARGET_MIN_ISTKSZ,,,defined(TARGET_MIN_ISTKSZ),1
    6361CHECK_STKSZ_ALIGN,,,defined(CHECK_STKSZ_ALIGN),1
    6462CHECK_INTPTR_ALIGN,,,defined(CHECK_INTPTR_ALIGN),1
    65 CHECK_INTPTR_NONNULL,true,bool,defined(CHECK_INTPTR_NONNULL)
     63CHECK_INTPTR_NONNULL,true,bool,defined(CHECK_INTPTR_NONNULL),false
    6664CHECK_FUNC_ALIGN,,,defined(CHECK_FUNC_ALIGN),1
    67 CHECK_FUNC_NONNULL,true,bool,defined(CHECK_FUNC_NONNULL)
     65CHECK_FUNC_NONNULL,true,bool,defined(CHECK_FUNC_NONNULL),false
    6866CHECK_STACK_ALIGN,,,defined(CHECK_STACK_ALIGN),1
    69 CHECK_STACK_NONNULL,true,bool,defined(CHECK_STACK_NONNULL)
     67CHECK_STACK_NONNULL,true,bool,defined(CHECK_STACK_NONNULL),false
    7068CHECK_MPF_ALIGN,,,defined(CHECK_MPF_ALIGN),1
    71 CHECK_MPF_NONNULL,true,bool,defined(CHECK_MPF_NONNULL)
     69CHECK_MPF_NONNULL,true,bool,defined(CHECK_MPF_NONNULL),false
     70CHECK_MPK_ALIGN,,,defined(CHECK_MPK_ALIGN),1
     71CHECK_MPK_NONNULL,true,bool,defined(CHECK_MPK_NONNULL),false
    7272CHECK_MB_ALIGN,,,defined(CHECK_MB_ALIGN),1
    7373sizeof_void_ptr,sizeof(void*)
     
    138138offsetof_ISRINIB_isrpri,"offsetof(ISRINIB,isrpri)"
    139139sizeof_INHINIB,sizeof(INHINIB),,!defined(OMIT_INITIALIZE_INTERRUPT)
    140 offset_INHINIB_inhno,"offsetof(INHINIB,inhno)",,!defined(OMIT_INITIALIZE_INTERRUPT)
    141 offset_INHINIB_inhatr,"offsetof(INHINIB,inhatr)",,!defined(OMIT_INITIALIZE_INTERRUPT),,
    142 offset_INHINIB_int_entry,"offsetof(INHINIB,int_entry)",,!defined(OMIT_INITIALIZE_INTERRUPT),,
     140offsetof_INHINIB_inhno,"offsetof(INHINIB,inhno)",,!defined(OMIT_INITIALIZE_INTERRUPT)
     141offsetof_INHINIB_inhatr,"offsetof(INHINIB,inhatr)",,!defined(OMIT_INITIALIZE_INTERRUPT),,
     142offsetof_INHINIB_int_entry,"offsetof(INHINIB,int_entry)",,!defined(OMIT_INITIALIZE_INTERRUPT),,
    143143sizeof_INTINIB,sizeof(INTINIB),,!defined(OMIT_INITIALIZE_INTERRUPT)
    144 offset_INTINIB_intno,"offsetof(INTINIB,intno)",,!defined(OMIT_INITIALIZE_INTERRUPT)
    145 offset_INTINIB_intatr,"offsetof(INTINIB,intatr)",,!defined(OMIT_INITIALIZE_INTERRUPT)
    146 offset_INTINIB_intpri,"offsetof(INTINIB,intpri)",,!defined(OMIT_INITIALIZE_INTERRUPT)
     144offsetof_INTINIB_intno,"offsetof(INTINIB,intno)",,!defined(OMIT_INITIALIZE_INTERRUPT)
     145offsetof_INTINIB_intatr,"offsetof(INTINIB,intatr)",,!defined(OMIT_INITIALIZE_INTERRUPT)
     146offsetof_INTINIB_intpri,"offsetof(INTINIB,intpri)",,!defined(OMIT_INITIALIZE_INTERRUPT)
    147147sizeof_EXCINIB,sizeof(EXCINIB),,!defined(OMIT_INITIALIZE_EXCEPTION)
    148 offset_EXCINIB_excno,"offsetof(EXCINIB,excno)",,!defined(OMIT_INITIALIZE_EXCEPTION)
    149 offset_EXCINIB_excatr,"offsetof(EXCINIB,excatr)",,!defined(OMIT_INITIALIZE_EXCEPTION)
    150 offset_EXCINIB_exc_entry,"offsetof(EXCINIB,exc_entry)",,!defined(OMIT_INITIALIZE_EXCEPTION)
     148offsetof_EXCINIB_excno,"offsetof(EXCINIB,excno)",,!defined(OMIT_INITIALIZE_EXCEPTION)
     149offsetof_EXCINIB_excatr,"offsetof(EXCINIB,excatr)",,!defined(OMIT_INITIALIZE_EXCEPTION)
     150offsetof_EXCINIB_exc_entry,"offsetof(EXCINIB,exc_entry)",,!defined(OMIT_INITIALIZE_EXCEPTION)
     151sizeof_INIRTNB,sizeof(INIRTNB)
     152offsetof_INIRTNB_inirtn,"offsetof(INIRTNB,inirtn)"
     153offsetof_INIRTNB_exinf,"offsetof(INIRTNB,exinf)"
     154sizeof_TERRTNB,sizeof(TERRTNB)
     155offsetof_TERRTNB_terrtn,"offsetof(TERRTNB,terrtn)"
     156offsetof_TERRTNB_exinf,"offsetof(TERRTNB,exinf)"
  • EcnlProtoTool/trunk/asp3_dcre/kernel/kernel_unrename.h

    r321 r429  
    99 */
    1010#undef kerflg
     11#undef mpk_valid
    1112#undef exit_kernel
    12 #undef initialize_kmm
    13 #undef kernel_malloc
    14 #undef kernel_free
     13#undef initialize_mempool
     14#undef malloc_mempool
     15#undef free_mempool
    1516
    1617/*
     
    6768#undef set_hrt_event
    6869#undef tmevtb_register
    69 #undef tmevtb_enqueue
     70#undef tmevtb_enqueue_reltim
    7071#undef tmevtb_dequeue
    7172#undef check_adjtim
     
    164165 */
    165166#undef initialize_object
    166 #undef call_inirtn
    167 #undef call_terrtn
     167#undef tnum_inirtn
     168#undef inirtnb_table
     169#undef tnum_terrtn
     170#undef terrtnb_table
    168171#undef tmax_tskid
    169172#undef tmax_stskid
     
    233236#undef istk
    234237#undef istkpt
    235 #undef kmmsz
    236 #undef kmm
     238#undef mpksz
     239#undef mpk
     240
     241/*
     242 *  tTraceLog.c
     243 */
     244#undef log_dsp_enter
     245#undef log_dsp_leave
     246#undef log_inh_enter
     247#undef log_inh_leave
     248#undef log_exc_enter
     249#undef log_exc_leave
    237250
    238251
  • EcnlProtoTool/trunk/asp3_dcre/kernel/mempfix.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    226226        p_mpfmb = pk_cmpf->mpfmb;
    227227
    228         CHECK_RSATR(mpfatr, TA_TPRI);
     228        CHECK_VALIDATR(mpfatr, TA_TPRI);
    229229        CHECK_PAR(blkcnt != 0);
    230230        CHECK_PAR(blksz != 0);
     
    242242        else {
    243243                if (mpf == NULL) {
    244                         mpf = kernel_malloc(ROUND_MPF_T(blksz) * blkcnt);
     244                        mpf = malloc_mpk(ROUND_MPF_T(blksz) * blkcnt);
    245245                        mpfatr |= TA_MEMALLOC;
    246246                }
     
    250250                else {
    251251                        if (p_mpfmb == NULL) {
    252                                 p_mpfmb = kernel_malloc(sizeof(MPFMB) * blkcnt);
     252                                p_mpfmb = malloc_mpk(sizeof(MPFMB) * blkcnt);
    253253                                mpfatr |= TA_MBALLOC;
    254254                        }
    255255                        if (p_mpfmb == NULL) {
    256                                 if (mpf == NULL) {
    257                                         kernel_free(mpf);
     256                                if (pk_cmpf->mpf == NULL) {
     257                                        free_mpk(mpf);
    258258                                }
    259259                                ercd = E_NOMEM;
     
    313313                p_mpfinib = (MPFINIB *)(p_mpfcb->p_mpfinib);
    314314                if ((p_mpfinib->mpfatr & TA_MEMALLOC) != 0U) {
    315                         kernel_free(p_mpfinib->mpf);
     315                        free_mpk(p_mpfinib->mpf);
    316316                }
    317317                if ((p_mpfinib->mpfatr & TA_MBALLOC) != 0U) {
    318                         kernel_free(p_mpfinib->p_mpfmb);
     318                        free_mpk(p_mpfinib->p_mpfmb);
    319319                }
    320320                p_mpfinib->mpfatr = TA_NOEXS;
     
    342342get_mpf(ID mpfid, void **p_blk)
    343343{
    344         MPFCB   *p_mpfcb;
    345         WINFO_MPF winfo_mpf;
    346         ER              ercd;
     344        MPFCB           *p_mpfcb;
     345        WINFO_MPF       winfo_mpf;
     346        ER                      ercd;
    347347
    348348        LOG_GET_MPF_ENTER(mpfid, p_blk);
     
    363363        }
    364364        else {
    365                 p_runtsk->tstat = TS_WAITING_MPF;
    366                 wobj_make_wait((WOBJCB *) p_mpfcb, (WINFO_WOBJ *) &winfo_mpf);
     365                wobj_make_wait((WOBJCB *) p_mpfcb, TS_WAITING_MPF,
     366                                                                                        (WINFO_WOBJ *) &winfo_mpf);
    367367                dispatch();
    368368                ercd = winfo_mpf.winfo.wercd;
     
    424424tget_mpf(ID mpfid, void **p_blk, TMO tmout)
    425425{
    426         MPFCB   *p_mpfcb;
    427         WINFO_MPF winfo_mpf;
    428         TMEVTB  tmevtb;
    429         ER              ercd;
     426        MPFCB           *p_mpfcb;
     427        WINFO_MPF       winfo_mpf;
     428        TMEVTB          tmevtb;
     429        ER                      ercd;
    430430
    431431        LOG_TGET_MPF_ENTER(mpfid, p_blk, tmout);
     
    450450        }
    451451        else {
    452                 p_runtsk->tstat = TS_WAITING_MPF;
    453                 wobj_make_wait_tmout((WOBJCB *) p_mpfcb, (WINFO_WOBJ *) &winfo_mpf,
    454                                                                                                                 &tmevtb, tmout);
     452                wobj_make_wait_tmout((WOBJCB *) p_mpfcb, TS_WAITING_MPF,
     453                                                                (WINFO_WOBJ *) &winfo_mpf, &tmevtb, tmout);
    455454                dispatch();
    456455                ercd = winfo_mpf.winfo.wercd;
  • EcnlProtoTool/trunk/asp3_dcre/kernel/mempfix.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5555    params[:mpfmb] ||= "NULL"
    5656
    57     # mpfatrが無効の場合(E_RSATR)[NGKI2225]
     57    # mpfatrが無効の場合(E_RSATR)[NGKI2225][NGKI2218]
    5858    #(TA_TPRI以外のビットがセットされている場合)
    5959    if (params[:mpfatr] & ~($TA_TPRI)) != 0
  • EcnlProtoTool/trunk/asp3_dcre/kernel/mutex.c

    r321 r429  
    44 *      Advanced Standard Profile Kernel
    55 *
    6  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     6 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    77 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    88 *
     
    378378        }
    379379        else {
    380                 CHECK_RSATR(mtxatr, TA_TPRI);                   /*[NGKI2025]*/
     380                CHECK_VALIDATR(mtxatr, TA_TPRI);                /*[NGKI2025]*/
    381381        }
    382382
     
    473473loc_mtx(ID mtxid)
    474474{
    475         MTXCB   *p_mtxcb;
    476         WINFO_MTX winfo_mtx;
    477         ER              ercd;
     475        MTXCB           *p_mtxcb;
     476        WINFO_MTX       winfo_mtx;
     477        ER                      ercd;
    478478
    479479        LOG_LOC_MTX_ENTER(mtxid);
     
    506506        }
    507507        else {
    508                 p_runtsk->tstat = TS_WAITING_MTX;
    509                 wobj_make_wait((WOBJCB *) p_mtxcb, (WINFO_WOBJ *) &winfo_mtx);
     508                wobj_make_wait((WOBJCB *) p_mtxcb, TS_WAITING_MTX,
     509                                                                                        (WINFO_WOBJ *) &winfo_mtx);
    510510                dispatch();
    511511                ercd = winfo_mtx.winfo.wercd;
     
    576576tloc_mtx(ID mtxid, TMO tmout)
    577577{
    578         MTXCB   *p_mtxcb;
    579         WINFO_MTX winfo_mtx;
    580         TMEVTB  tmevtb;
    581         ER              ercd;
     578        MTXCB           *p_mtxcb;
     579        WINFO_MTX       winfo_mtx;
     580        TMEVTB          tmevtb;
     581        ER                      ercd;
    582582
    583583        LOG_TLOC_MTX_ENTER(mtxid, tmout);
     
    614614        }
    615615        else {
    616                 p_runtsk->tstat = TS_WAITING_MTX;
    617                 wobj_make_wait_tmout((WOBJCB *) p_mtxcb, (WINFO_WOBJ *) &winfo_mtx,
    618                                                                                                                 &tmevtb, tmout);
     616                wobj_make_wait_tmout((WOBJCB *) p_mtxcb, TS_WAITING_MTX,
     617                                                                (WINFO_WOBJ *) &winfo_mtx, &tmevtb, tmout);
    619618                dispatch();
    620619                ercd = winfo_mtx.winfo.wercd;
  • EcnlProtoTool/trunk/asp3_dcre/kernel/mutex.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5151
    5252  def prepare(key, params)
    53     # mtxatrが無効の場合(E_RSATR)[NGKI2025]
    54     # (TA_NULL,TA_TPRI,TA_CEILINGのいずれでもない場合)
     53    # mtxatrが無効の場合(E_RSATR)[NGKI2025][NGKI2010]
     54    #(TA_NULL,TA_TPRI,TA_CEILINGのいずれでもない場合)
    5555    if !(params[:mtxatr] == $TA_NULL || params[:mtxatr] == $TA_TPRI \
    5656                                                                                || params[:mtxatr] == $TA_CEILING)
     
    6060    if params[:mtxatr] == $TA_CEILING
    6161      # 優先度上限ミューテックスの場合
    62       # ceilpriが未指定の場合はエラーとする
    63       if params[:ceilpri].nil?
     62      # ceilpriの記述が省略されている場合[NGKI2035]
     63      if !params.has_key?(:ceilpri)
    6464        error_api(params, "ceilpri must be specified in %apiname of %mtxid")
    6565
    66       # (TMIN_TPRI <= ceilpri && ceilpri <= TMAX_TPRI)でない場合(E_PAR)
    67       # [NGKI2037]
     66      # ceilpriが有効範囲外の場合(E_PAR)[NGKI2037]
     67      #(TMIN_TPRI <= ceilpri && ceilpri <= TMAX_TPRIでない場合)
    6868      elsif !($TMIN_TPRI <= params[:ceilpri] && params[:ceilpri] <= $TMAX_TPRI)
    6969        error_illegal_id("E_PAR", params, :ceilpri, :mtxid)
     
    7171    else
    7272      # 優先度上限ミューテックスでない場合
    73       # ceilpriが指定されている場合は警告メッセージを出す
    74       if !params[:ceilpri].nil?
     73      # ceilpriが記述されている場合は警告メッセージを出す
     74      if params.has_key?(:ceilpri)
    7575        warning_api(params, "%%ceilpri is ignored in %apiname of %mtxid")
    7676      end
  • EcnlProtoTool/trunk/asp3_dcre/kernel/pridataq.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    335335        p_pdqmb = pk_cpdq->pdqmb;
    336336
    337         CHECK_RSATR(pdqatr, TA_TPRI);
     337        CHECK_VALIDATR(pdqatr, TA_TPRI);
    338338        CHECK_PAR(VALID_DPRI(maxdpri));
     339        if (p_pdqmb != NULL) {
     340                CHECK_PAR(MB_ALIGN(p_pdqmb));
     341        }
    339342
    340343        lock_cpu();
     
    344347        else {
    345348                if (pdqcnt != 0 && p_pdqmb == NULL) {
    346                         p_pdqmb = kernel_malloc(sizeof(PDQMB) * pdqcnt);
     349                        p_pdqmb = malloc_mpk(sizeof(PDQMB) * pdqcnt);
    347350                        pdqatr |= TA_MBALLOC;
    348351                }
     
    405408                p_pdqinib = (PDQINIB *)(p_pdqcb->p_pdqinib);
    406409                if ((p_pdqinib->pdqatr & TA_MBALLOC) != 0U) {
    407                         kernel_free(p_pdqinib->p_pdqmb);
     410                        free_mpk(p_pdqinib->p_pdqmb);
    408411                }
    409412                p_pdqinib->pdqatr = TA_NOEXS;
     
    431434snd_pdq(ID pdqid, intptr_t data, PRI datapri)
    432435{
    433         PDQCB   *p_pdqcb;
    434         WINFO_SPDQ winfo_spdq;
    435         ER              ercd;
     436        PDQCB           *p_pdqcb;
     437        WINFO_SPDQ      winfo_spdq;
     438        ER                      ercd;
    436439
    437440        LOG_SND_PDQ_ENTER(pdqid, data, datapri);
     
    460463                winfo_spdq.data = data;
    461464                winfo_spdq.datapri = datapri;
    462                 p_runtsk->tstat = TS_WAITING_SPDQ;
    463                 wobj_make_wait((WOBJCB *) p_pdqcb, (WINFO_WOBJ *) &winfo_spdq);
     465                wobj_make_wait((WOBJCB *) p_pdqcb, TS_WAITING_SPDQ,
     466                                                                                        (WINFO_WOBJ *) &winfo_spdq);
    464467                dispatch();
    465468                ercd = winfo_spdq.winfo.wercd;
     
    504507                        }
    505508                        else {
    506                                 request_dispatch();
     509                                request_dispatch_retint();
    507510                        }
    508511                }
     
    529532tsnd_pdq(ID pdqid, intptr_t data, PRI datapri, TMO tmout)
    530533{
    531         PDQCB   *p_pdqcb;
    532         WINFO_SPDQ winfo_spdq;
    533         TMEVTB  tmevtb;
    534         ER              ercd;
     534        PDQCB           *p_pdqcb;
     535        WINFO_SPDQ      winfo_spdq;
     536        TMEVTB          tmevtb;
     537        ER                      ercd;
    535538
    536539        LOG_TSND_PDQ_ENTER(pdqid, data, datapri, tmout);
     
    563566                winfo_spdq.data = data;
    564567                winfo_spdq.datapri = datapri;
    565                 p_runtsk->tstat = TS_WAITING_SPDQ;
    566                 wobj_make_wait_tmout((WOBJCB *) p_pdqcb, (WINFO_WOBJ *) &winfo_spdq,
    567                                                                                                                 &tmevtb, tmout);
     568                wobj_make_wait_tmout((WOBJCB *) p_pdqcb, TS_WAITING_SPDQ,
     569                                                                (WINFO_WOBJ *) &winfo_spdq, &tmevtb, tmout);
    568570                dispatch();
    569571                ercd = winfo_spdq.winfo.wercd;
     
    586588rcv_pdq(ID pdqid, intptr_t *p_data, PRI *p_datapri)
    587589{
    588         PDQCB   *p_pdqcb;
    589         WINFO_RPDQ winfo_rpdq;
    590         ER              ercd;
     590        PDQCB           *p_pdqcb;
     591        WINFO_RPDQ      winfo_rpdq;
     592        ER                      ercd;
    591593
    592594        LOG_RCV_PDQ_ENTER(pdqid, p_data, p_datapri);
     
    609611        }
    610612        else {
    611                 p_runtsk->tstat = TS_WAITING_RPDQ;
    612                 make_wait(&(winfo_rpdq.winfo));
     613                make_wait(TS_WAITING_RPDQ, &(winfo_rpdq.winfo));
    613614                queue_insert_prev(&(p_pdqcb->rwait_queue), &(p_runtsk->task_queue));
    614615                winfo_rpdq.p_pdqcb = p_pdqcb;
     
    676677trcv_pdq(ID pdqid, intptr_t *p_data, PRI *p_datapri, TMO tmout)
    677678{
    678         PDQCB   *p_pdqcb;
    679         WINFO_RPDQ winfo_rpdq;
    680         TMEVTB  tmevtb;
    681         ER              ercd;
     679        PDQCB           *p_pdqcb;
     680        WINFO_RPDQ      winfo_rpdq;
     681        TMEVTB          tmevtb;
     682        ER                      ercd;
    682683
    683684        LOG_TRCV_PDQ_ENTER(pdqid, p_data, p_datapri, tmout);
     
    704705        }
    705706        else {
    706                 p_runtsk->tstat = TS_WAITING_RPDQ;
    707                 make_wait_tmout(&(winfo_rpdq.winfo), &tmevtb, tmout);
     707                make_wait_tmout(TS_WAITING_RPDQ, &(winfo_rpdq.winfo), &tmevtb, tmout);
    708708                queue_insert_prev(&(p_pdqcb->rwait_queue), &(p_runtsk->task_queue));
    709709                winfo_rpdq.p_pdqcb = p_pdqcb;
  • EcnlProtoTool/trunk/asp3_dcre/kernel/pridataq.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5454    params[:pdqmb] ||= "NULL"
    5555
    56     # pdqatrが無効の場合(E_RSATR)[NGKI1804]
     56    # pdqatrが無効の場合(E_RSATR)[NGKI1804][NGKI1795]
    5757    #(TA_TPRI以外のビットがセットされている場合)
    5858    if (params[:pdqatr] & ~($TA_TPRI)) != 0
     
    6060    end
    6161
    62     # (TMIN_DPRI <= maxdpri && maxdpri <= TMAX_DPRI)でない場合(E_PAR)
    63     # [NGKI1819]
     62        # maxdpriが有効範囲外の場合(E_PAR)[NGKI1819]
     63    #(TMIN_DPRI <= maxdpri && maxdpri <= TMAX_DPRIでない場合)
    6464    if !($TMIN_DPRI <= params[:maxdpri] && params[:maxdpri] <= $TMAX_DPRI)
    6565      error_illegal_id("E_PAR", params, :maxdpri, :pdqid)
  • EcnlProtoTool/trunk/asp3_dcre/kernel/semaphore.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    186186        maxsem = pk_csem->maxsem;
    187187
    188         CHECK_RSATR(sematr, TA_TPRI);
     188        CHECK_VALIDATR(sematr, TA_TPRI);
    189189        CHECK_PAR(0 <= isemcnt && isemcnt <= maxsem);
    190190        CHECK_PAR(1 <= maxsem && maxsem <= TMAX_MAXSEM);
     
    286286                        }
    287287                        else {
    288                                 request_dispatch();
     288                                request_dispatch_retint();
    289289                        }
    290290                }
     
    315315wai_sem(ID semid)
    316316{
    317         SEMCB   *p_semcb;
    318         WINFO_SEM winfo_sem;
    319         ER              ercd;
     317        SEMCB           *p_semcb;
     318        WINFO_SEM       winfo_sem;
     319        ER                      ercd;
    320320
    321321        LOG_WAI_SEM_ENTER(semid);
     
    336336        }
    337337        else {
    338                 p_runtsk->tstat = TS_WAITING_SEM;
    339                 wobj_make_wait((WOBJCB *) p_semcb, (WINFO_WOBJ *) &winfo_sem);
     338                wobj_make_wait((WOBJCB *) p_semcb, TS_WAITING_SEM,
     339                                                                                        (WINFO_WOBJ *) &winfo_sem);
    340340                dispatch();
    341341                ercd = winfo_sem.winfo.wercd;
     
    394394twai_sem(ID semid, TMO tmout)
    395395{
    396         SEMCB   *p_semcb;
    397         WINFO_SEM winfo_sem;
    398         TMEVTB  tmevtb;
    399         ER              ercd;
     396        SEMCB           *p_semcb;
     397        WINFO_SEM       winfo_sem;
     398        TMEVTB          tmevtb;
     399        ER                      ercd;
    400400
    401401        LOG_TWAI_SEM_ENTER(semid, tmout);
     
    420420        }
    421421        else {
    422                 p_runtsk->tstat = TS_WAITING_SEM;
    423                 wobj_make_wait_tmout((WOBJCB *) p_semcb, (WINFO_WOBJ *) &winfo_sem,
    424                                                                                                                 &tmevtb, tmout);
     422                wobj_make_wait_tmout((WOBJCB *) p_semcb, TS_WAITING_SEM,
     423                                                                (WINFO_WOBJ *) &winfo_sem, &tmevtb, tmout);
    425424                dispatch();
    426425                ercd = winfo_sem.winfo.wercd;
  • EcnlProtoTool/trunk/asp3_dcre/kernel/semaphore.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5151
    5252  def prepare(key, params)
    53     # sematrが無効の場合(E_RSATR)[NGKI1456]
     53    # sematrが無効の場合(E_RSATR)[NGKI1456][NGKI1448]
    5454    #(TA_TPRI以外のビットがセットされている場合)
    5555    if (params[:sematr] & ~($TA_TPRI)) != 0
     
    5757    end
    5858
    59     # (1 <= maxsem && maxsem <= TMAX_MAXSEM)でない場合(E_PAR)[NGKI1468]
     59    # maxsemが有効範囲外の場合(E_PAR)[NGKI1468]
     60    #(1 <= maxsem && maxsem <= TMAX_MAXSEMでない場合)
    6061    if !(1 <= params[:maxsem] && params[:maxsem] <= $TMAX_MAXSEM)
    6162      error_illegal_id("E_PAR", params, :maxsem, :semid)
    6263    end
    6364
    64     # (0 <= isemcnt && isemcnt <= maxsem)でない場合(E_PAR)[NGKI1466]
     65    # isemcntが有効範囲外の場合(E_PAR)[NGKI1466]
     66    #(0 <= isemcnt && isemcnt <= maxsemでない場合)
    6567    if !(0 <= params[:isemcnt] && params[:isemcnt] <= params[:maxsem])
    6668      error_wrong_id("E_PAR", params, :isemcnt, :semid, "too large")
  • EcnlProtoTool/trunk/asp3_dcre/kernel/startup.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    7979
    8080/*
     81 *  カーネルメモリプール領域有効フラグ
     82 */
     83bool_t  mpk_valid;
     84
     85/*
    8186 *  カーネルの起動
    8287 */
     
    8489sta_ker(void)
    8590{
     91        uint_t  i;
     92
    8693        /*
    8794         *  TECSの初期化
     
    102109         *  する必要がある.
    103110         */
    104         initialize_kmm();
     111        if (mpk != NULL) {
     112                mpk_valid = initialize_mempool(mpk, mpksz);
     113        }
     114        else {
     115                mpk_valid = false;
     116        }
    105117        initialize_tmevt();                                                             /*[ASPD1061]*/
    106118        initialize_object();
     
    109121         *  初期化ルーチンの実行
    110122         */
    111         call_inirtn();
     123        for (i = 0; i < tnum_inirtn; i++) {
     124                (*(inirtnb_table[i].inirtn))(inirtnb_table[i].exinf);
     125        }
    112126
    113127        /*
     
    172186exit_kernel(void)
    173187{
     188        uint_t  i;
     189
    174190        /*
    175191         *  終了処理ルーチンの実行
    176192         */
    177         call_terrtn();
     193        for (i = 0; i < tnum_terrtn; i++) {
     194                (*(terrtnb_table[i].terrtn))(terrtnb_table[i].exinf);
     195        }
    178196
    179197        /*
     
    187205
    188206/*
    189  *  カーネルの割り付けるメモリ領域の管理
     207 *  デフォルトのメモリプール管理機能
    190208 *
    191  *  メモリ領域を先頭から順に割り当て,解放されたメモリ領域を再利用しな
    192  *  いメモリ管理モジュール.
     209 *  メモリプール領域の先頭から順に割り当てを行い,すべてのメモリ領域が
     210 *  解放されるまで解放されたメモリ領域を再利用しないメモリプール管理機
     211 *  能.
    193212 */
    194213#ifdef TOPPERS_kermem
    195 #ifndef OMIT_KMM_ALLOCONLY
    196 
    197 static void     *kmm_brk;
    198 
    199 void
    200 initialize_kmm(void)
    201 {
    202         kmm_brk = ((char *) kmm) + kmmsz;
     214#ifndef OMIT_MEMPOOL_DEFAULT
     215
     216typedef struct {
     217        void    *brk;           /* メモリプール領域の未使用領域の先頭番地 */
     218        void    *limit;         /* メモリプール領域の上限 */
     219        uint_t  count;          /* 割り当てたメモリ領域の数 */
     220} MEMPOOLCB;
     221
     222bool_t
     223initialize_mempool(MB_T *mempool, size_t size)
     224{
     225        MEMPOOLCB       *p_mempoolcb = ((MEMPOOLCB *) mempool);
     226
     227        if (size >= sizeof(MEMPOOLCB)) {
     228                p_mempoolcb->brk = ((char *) mempool) + sizeof(MEMPOOLCB);
     229                p_mempoolcb->limit = ((char *) mempool) + size;
     230                p_mempoolcb->count = 0;
     231                return(true);
     232        }
     233        else {
     234                return(false);
     235        }
    203236}
    204237
    205238void *
    206 kernel_malloc(size_t size)
    207 {
    208         if (((char *) kmm_brk) - ((char *) kmm) >= size) {
    209                 kmm_brk = ((char *) kmm_brk) - size;
    210                 return(kmm_brk);
     239malloc_mempool(MB_T *mempool, size_t size)
     240{
     241        MEMPOOLCB       *p_mempoolcb = ((MEMPOOLCB *) mempool);
     242        void            *brk;
     243
     244        brk = ((MEMPOOLCB *) mempool)->brk;
     245        if (((char *)(p_mempoolcb->limit)) - ((char *) brk) >= size) {
     246                p_mempoolcb->brk = ((char *) brk) + size;
     247                p_mempoolcb->count += 1;
     248                return(brk);
    211249        }
    212250        else {
     
    216254
    217255void
    218 kernel_free(void *ptr)
    219 {
    220 }
    221 
    222 #endif /* OMIT_KMM_ALLOCONLY */
     256free_mempool(MB_T *mempool, void *ptr)
     257{
     258        MEMPOOLCB       *p_mempoolcb = ((MEMPOOLCB *) mempool);
     259
     260        p_mempoolcb->count -= 1;
     261        if (p_mempoolcb->count == 0) {
     262                p_mempoolcb->brk = ((char *) mempool) + sizeof(MEMPOOLCB);
     263        }
     264}
     265
     266#endif /* OMIT_MEMPOOL_DEFAULT */
    223267#endif /* TOPPERS_kermem */
  • EcnlProtoTool/trunk/asp3_dcre/kernel/sys_manage.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    184184                }
    185185                else {
    186                         request_dispatch();
     186                        request_dispatch_retint();
    187187                }
    188188        }
     
    205205get_tid(ID *p_tskid)
    206206{
     207        bool_t lock;
    207208        ER              ercd;
    208209
    209210        LOG_GET_TID_ENTER(p_tskid);
    210         CHECK_UNL();                                                            /*[NGKI2707]*/
    211 
    212         lock_cpu();
     211        //CHECK_UNL();                                                          /*[NGKI2707]*/
     212        lock = sense_lock();
     213
     214        if (!lock)
     215                lock_cpu();
    213216        *p_tskid = (p_runtsk == NULL) ? TSK_NONE : TSKID(p_runtsk);
    214         ercd = E_OK;
    215         unlock_cpu();
     217        ercd = E_OK;                                                            /*[NGKI2710][NGKI2709]*/
     218        if (!lock)
     219                unlock_cpu();
    216220
    217221  error_exit:
     
    399403        enadsp = true;
    400404        if (t_get_ipm() == TIPM_ENAALL) {
    401                 dspflg = true;
    402                 p_schedtsk = search_schedtsk();
     405                set_dspflg();
    403406                if (p_runtsk->raster && p_runtsk->enater) {
    404407                        task_terminate(p_runtsk);
  • EcnlProtoTool/trunk/asp3_dcre/kernel/task.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2014 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2017 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    113113                p_tcb->actque = false;
    114114                make_dormant(p_tcb);
     115                p_tcb->p_lastmtx = NULL;
    115116                if ((p_tcb->p_tinib->tskatr & TA_ACT) != 0U) {
    116117                        make_active(p_tcb);
     
    232233 *
    233234 *  実行すべきタスクを更新するのは,実行できるタスクがなかった場合と,
    234  *  p_tcbの優先度が実行すべきタスクの優先度よりも高い場合である.
     235 *  p_tcbで指定されるタスクの優先度が実行すべきタスクの優先度よりも高
     236 *  い場合である.
    235237 */
    236238#ifdef TOPPERS_tskrun
     
    256258 *  実行できる状態から他の状態への遷移
    257259 *
    258  *  実行すべきタスクを更新するのは,p_tcbが実行すべきタスクであった場合
    259  *  である.p_tcbと同じ優先度のタスクが他にある場合は,p_tcbの次のタス
    260  *  クが実行すべきタスクになる.そうでない場合は,レディキューをサーチ
    261  *  する必要がある.
     260 *  実行すべきタスクを更新するのは,p_tcbで指定されるタスクが実行すべ
     261 *  きタスクであった場合である.p_tcbで指定されるタスクと同じ優先度の
     262 *  タスクが他にある場合は,そのタスクの次のタスクが実行すべきタスクに
     263 *  なる.そうでない場合は,レディキューをサーチする必要がある.
     264 *
     265 *  自タスクに対してこの関数が呼ばれるのは,タスクディスパッチ可能状態
     266 *  に限られる.またこの関数は,非タスクコンテキストから呼ばれることは
     267 *  ないため,p_runtskとp_schedtskは必ず一致している.そのため,p_tcb
     268 *  とp_schedtskが一致するときは,必ずタスクディスパッチ可能状態である.
    262269 */
    263270#ifdef TOPPERS_tsknrun
     
    325332 *  タスクの優先度の変更
    326333 *
    327  *  タスクが実行できる状態の場合には,レディキューの中での位置を変更す
    328  *  る.オブジェクトの待ちキューの中で待ち状態になっている場合には,待
    329  *  ちキューの中での位置を変更する.
    330  *
    331  *  実行すべきタスクを更新するのは,(1) p_tcbが実行すべきタスクであって,
    332  *  その優先度を下げた場合,(2) p_tcbが実行すべきタスクではなく,変更後
    333  *  の優先度が実行すべきタスクの優先度よりも高い場合である.(1)の場合に
    334  *  は,レディキューをサーチする必要がある.
     334 *  p_tcbで指定されるタスクが実行できる状態の場合には,レディキューの
     335 *  中での位置を変更する.オブジェクトの待ちキューの中で待ち状態になっ
     336 *  ている場合には,待ちキューの中での位置を変更する.
     337 *
     338 *  実行すべきタスクを更新するのは,(1) p_tcbで指定されるタスクが実行
     339 *  すべきタスクであった場合には,優先度を下げた(または優先度が変わら
     340 *  なかった)時,(2) p_tcbで指定されるタスクが実行すべきタスクでなかっ
     341 *  た場合には,変更後の優先度が実行すべきタスクの優先度よりも高いか同
     342 *  じ時(同じ場合に更新が必要になるのは,実際には,mtxmodeがtrueの場
     343 *  合のみ)である.(1)の場合には,レディキューをサーチする必要がある.
    335344 */
    336345#ifdef TOPPERS_tskpri
     
    367376                        }
    368377                        else {
    369                                 if (mtxmode ? newpri <= p_schedtsk->priority
    370                                                         : newpri < p_schedtsk->priority) {
    371                                         p_schedtsk = p_tcb;
     378                                if (newpri <= p_schedtsk->priority) {
     379                                        p_schedtsk = (TCB *)(ready_queue[newpri].p_next);
    372380                                }
    373381                        }
  • EcnlProtoTool/trunk/asp3_dcre/kernel/task.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2017 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    186186 *  が,実行効率が悪くなるために採用していない.他のオブジェクトについ
    187187 *  ても同様に扱う.
    188  *
    189  *  タスク初期化ブロックには,DEF_TEXで定義されるタスク例外処理ルーチ
    190  *  ンに関する情報も含む.
    191188 */
    192189typedef struct task_initialization_block {
     
    239236        BIT_FIELD_UINT  tstat : 8;              /* タスク状態(内部表現)*/
    240237        BIT_FIELD_UINT  bpriority : 8;  /* ベース優先度(内部表現)*/
    241         BIT_FIELD_UINT  priority : 8    /* 現在の優先度(内部表現)*/;
     238        BIT_FIELD_UINT  priority : 8;   /* 現在の優先度(内部表現)*/
    242239#endif /* UINT8_MAX */
    243240        BIT_FIELD_BOOL  actque : 1;             /* 起動要求キューイング */
     
    380377 *  実行できる状態への遷移
    381378 *
    382  *  p_tcbで指定されるタスクをレディキューに挿入する.レディキューに挿入
    383  *  したタスクの優先度が,実行すべきタスクの優先度よりも高い場合は,実
    384  *  行すべきタスクを更新する.
     379 *  p_tcbで指定されるタスクをレディキューに挿入する.また,必要な場合
     380 *  には,実行すべきタスクを更新する.
    385381 */
    386382extern void     make_runnable(TCB *p_tcb);
     
    396392
    397393/*
     394 *  タスクディスパッチ可能状態への遷移
     395 *
     396 *  タスクディスパッチ可能状態であることを示すフラグ(dspflg)をtrueに
     397 *  し,実行すべきタスクを更新する.
     398 */
     399Inline void
     400set_dspflg(void)
     401{
     402        dspflg = true;
     403        p_schedtsk = search_schedtsk();
     404}
     405
     406/*
    398407 *  休止状態への遷移
    399408 *
     
    417426 *  必要な場合には,実行すべきタスクを更新する.
    418427 *
    419  *  p_tcbで指定されるタスクの優先順位は,優先度が同じタスクの中で,
    420  *  mtxmodeがfalseの時は最低,mtxmodeがtrueの時は最高とする.
     428 *  p_tcbで指定されるタスクが実行できる状態である場合,その優先順位は,
     429 *  優先度が同じタスクの中で,mtxmodeがfalseの時は最低,mtxmodeがtrue
     430 *  の時は最高とする.
    421431 */
    422432extern void     change_priority(TCB *p_tcb, uint_t newpri, bool_t mtxmode);
     
    425435 *  レディキューの回転
    426436 *
    427  *  レディキュー中の,p_queueで指定されるタスクキューを回転させる.また,
    428  *  必要な場合には,実行すべきタスクを更新する.
     437 *  レディキュー中の,p_queueで指定されるタスクキューを回転させる.ま
     438 *  た,必要な場合には,実行すべきタスクを更新する.
    429439 */
    430440extern void     rotate_ready_queue(QUEUE *p_queue);
  • EcnlProtoTool/trunk/asp3_dcre/kernel/task.trb

    r321 r429  
    66#
    77#   Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    8 #   Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8#   Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99#               Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    5454    params[:stk] ||= "NULL"
    5555
    56     # tskatrが無効の場合(E_RSATR)[NGKI1028]
     56    # tskatrが無効の場合(E_RSATR)[NGKI1028][NGKI3526][ASPS0009]
     57    # [NGKI1016]
    5758    #(TA_ACT,TA_NOACTQUE,TARGET_TSKATR以外のビットがセットされている場合)
    5859    if (params[:tskatr] & ~($TA_ACT|$TA_NOACTQUE|$TARGET_TSKATR)) != 0
     
    6061    end
    6162
    62     # (TMIN_TPRI <= itskpri && itskpri <= TMAX_TPRI)でない場合[NGKI1034]
     63    # itskpriが有効範囲外の場合(E_PAR)[NGKI1034]
     64    #(TMIN_TPRI <= itskpri && itskpri <= TMAX_TPRIでない場合)
    6365    if !($TMIN_TPRI <= params[:itskpri] && params[:itskpri] <= $TMAX_TPRI)
    6466      error_illegal_id("E_PAR", params, :itskpri, :tskid)
     
    6668
    6769    # stkszがターゲット定義の最小値(TARGET_MIN_STKSZ,未定義の場合は1)
    68     # よりも小さい場合[NGKI1042]
     70    # よりも小さい場合(E_PAR)[NGKI1042]
    6971    if params[:stksz] < $TARGET_MIN_STKSZ
    7072      error_wrong_id("E_PAR", params, :stksz, :tskid, "too small")
     
    7880      params[:tinib_stk] = stkName
    7981    else
    80       # stkszがスタック領域のサイズとして正しくない場合[NGKI1056]
     82      # stkszがターゲット定義の制約に合致しない場合(E_PAR)[NGKI1056]
    8183      if (params[:stksz] & ($CHECK_STKSZ_ALIGN - 1)) != 0
    8284        error_wrong_id("E_PAR", params, :stksz, :tskid, "not aligned")
     
    8587      params[:tinib_stksz] = params[:stksz]
    8688      params[:tinib_stk] = "(void *)(#{params[:stk]})"
     89    end
     90
     91    # ターゲット依存の処理(ターゲット依存のエラーチェックを含む)
     92    if defined? TargetTaskPrepare()
     93      TargetTaskPrepare(key, params)
    8794    end
    8895  end
     
    100107end
    101108
     109# タスクが1つも登録されていない場合[NGKI0033]
     110if $cfgData[:CRE_TSK].size() == 0
     111  error("no task is registered")
     112end
     113
    102114#
    103115#  タスク管理に関する情報の生成
    104116#
    105117$kernelCfgC.comment_header("Task Management Functions")
    106 if $cfgData[:CRE_TSK].size() == 0
    107   error("no task is registered")
    108 end
    109118TaskObject.new.generate()
    110119
     
    112121$kernelCfgC.add("const ID _kernel_torder_table[TNUM_STSKID] = { ")
    113122$kernelCfgC.append("\t")
    114 $cfgData[:CRE_TSK].each_with_index do |(key, params), index|
     123$cfgData[:CRE_TSK].each_with_index do |(_, params), index|
    115124  $kernelCfgC.append(", ") if index > 0
    116125  $kernelCfgC.append("#{params[:tskid]}")
  • EcnlProtoTool/trunk/asp3_dcre/kernel/task_manage.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2017 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    126126#ifdef TOPPERS_acre_tsk
    127127
    128 #ifndef TARGET_MIN_STKSZ
    129 #define TARGET_MIN_STKSZ        1U              /* 未定義の場合は0でないことをチェック */
    130 #endif /* TARGET_MIN_STKSZ */
    131 
    132128ER_UINT
    133129acre_tsk(const T_CTSK *pk_ctsk)
     
    151147        stk = pk_ctsk->stk;
    152148
    153         CHECK_RSATR(tskatr, TA_ACT|TA_NOACTQUE|TARGET_TSKATR);
     149        CHECK_VALIDATR(tskatr, TA_ACT|TA_NOACTQUE|TARGET_TSKATR);
    154150        CHECK_PAR(FUNC_ALIGN(task));
    155151        CHECK_PAR(FUNC_NONNULL(task));
     
    168164                if (stk == NULL) {
    169165                        stksz = ROUND_STK_T(stksz);
    170                         stk = kernel_malloc(stksz);
     166                        stk = malloc_mpk(stksz);
    171167                        tskatr |= TA_MEMALLOC;
    172168                }
     
    189185
    190186                        p_tcb->actque = false;
     187                        p_tcb->p_lastmtx = NULL;
    191188                        make_dormant(p_tcb);
    192189                        if ((p_tcb->p_tinib->tskatr & TA_ACT) != 0U) {
    193190                                make_active(p_tcb);
     191                                if (p_runtsk != p_schedtsk) {
     192                                        dispatch();
     193                                }
    194194                        }
    195195                        ercd = TSKID(p_tcb);
     
    235235#else /* USE_TSKINICTXB */
    236236                if ((p_tinib->tskatr & TA_MEMALLOC) != 0U) {    /*[NGKI1109]*/
    237                         kernel_free(p_tinib->stk);
     237                        free_mpk(p_tinib->stk);
    238238                }
    239239#endif /* USE_TSKINICTXB */
     
    283283                        }
    284284                        else {
    285                                 request_dispatch();
     285                                request_dispatch_retint();
    286286                        }
    287287                }
     
    423423        }
    424424        if (tskpri == TPRI_INI) {
     425                /*
     426                 *  以下の代入文は,対象タスクが未登録の場合に無効なフィールド
     427                 *  を参照するが,その場合はnewbpriの値を使わないので,問題な
     428                 *  い.
     429                 */
    425430                newbpri = p_tcb->p_tinib->ipriority;    /*[NGKI1199]*/
    426431        }
  • EcnlProtoTool/trunk/asp3_dcre/kernel/task_refer.c

    r321 r429  
    44 *      Advanced Standard Profile Kernel
    55 *
    6  *  Copyright (C) 2005-2014 by Embedded and Real-Time Systems Laboratory
     6 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    77 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    88 *
     
    6767
    6868/*
    69  *  タスクの状態参照
     69 *  タスクの状態参照[NGKI1217]
    7070 */
    7171#ifdef TOPPERS_ref_tsk
     
    7979
    8080        LOG_REF_TSK_ENTER(tskid, pk_rtsk);
    81         CHECK_TSKCTX_UNL();
     81        CHECK_TSKCTX_UNL();                                                     /*[NGKI1218][NGKI1219]*/
    8282        if (tskid == TSK_SELF) {
    83                 p_tcb = p_runtsk;
     83                p_tcb = p_runtsk;                                               /*[NGKI1248]*/
    8484        }
    8585        else {
    86                 CHECK_ID(VALID_TSKID(tskid));
     86                CHECK_ID(VALID_TSKID(tskid));                   /*[NGKI1220]*/
    8787                p_tcb = get_tcb(tskid);
    8888        }
     
    9090        lock_cpu();
    9191        if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
    92                 ercd = E_NOEXS;
     92                ercd = E_NOEXS;                                                 /*[NGKI1221]*/
    9393        }
    9494        else {
     
    9696                if (TSTAT_DORMANT(tstat)) {
    9797                        /*
    98                          *  対象タスクが休止状態の場合
     98                         *  対象タスクが休止状態の場合[NGKI1225]
    9999                         */
    100100                        pk_rtsk->tskstat = TTS_DMT;
     
    102102                else {
    103103                        /*
    104                          *  タスク状態の取出し
     104                         *  タスク状態の取出し[NGKI1225]
    105105                         */
    106106                        if (TSTAT_SUSPENDED(tstat)) {
     
    123123
    124124                        /*
    125                          *  現在優先度とベース優先度の取出し
     125                         *  現在優先度とベース優先度の取出し[NGKI1227]
    126126                         */
    127127                        pk_rtsk->tskpri = EXT_TSKPRI(p_tcb->priority);
     
    130130                        if (TSTAT_WAITING(tstat)) {
    131131                                /*
    132                                  *  待ち要因と待ち対象のオブジェクトのIDの取出し
     132                                 *  待ち要因と待ち対象のオブジェクトのIDの取出し[NGKI1229]
     133                                 *  [NGKI1231]
    133134                                 */
    134                                 switch (tstat) {
     135                                switch (tstat & TS_WAITING_MASK) {
    135136                                case TS_WAITING_SLP:
    136137                                        pk_rtsk->tskwait = TTW_SLP;
     
    185186                                 */
    186187                                if (p_tcb->p_winfo->p_tmevtb != NULL) {
    187                                         pk_rtsk->lefttmo
     188                                        pk_rtsk->lefttmo                        /*[NGKI1233][NGKI1235]*/
    188189                                                        = (TMO) tmevt_lefttim(p_tcb->p_winfo->p_tmevtb);
    189190                                }
    190191                                else {
    191                                         pk_rtsk->lefttmo = TMO_FEVR;
    192                                 }
    193                         }
    194 
    195                         /*
    196                          *  起床要求キューイング数の取出し
     192                                        pk_rtsk->lefttmo = TMO_FEVR;    /*[NGKI1234]*/
     193                                }
     194                        }
     195
     196                        /*
     197                         *  起床要求キューイング数の取出し[NGKI1239]
    197198                         */
    198199                        pk_rtsk->wupcnt = p_tcb->wupque ? 1U : 0U;
    199200
    200201                        /*
    201                          *  タスク終了要求状態の取出し
     202                         *  タスク終了要求状態の取出し[NGKI3467]
    202203                         */
    203204                        pk_rtsk->raster = p_tcb->raster;
    204205
    205206                        /*
    206                          *  タスク終了禁止状態の取出し
     207                         *  タスク終了禁止状態の取出し[NGKI3468]
    207208                         */
    208209                        pk_rtsk->dister = !(p_tcb->enater);
     
    210211
    211212                /*
    212                  *  起動要求キューイング数の取出し
     213                 *  起動要求キューイング数の取出し[NGKI1238]
    213214                 */
    214215                pk_rtsk->actcnt = p_tcb->actque ? 1U : 0U;
  • EcnlProtoTool/trunk/asp3_dcre/kernel/task_sync.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    118118
    119119/*
    120  *  起床待ち
     120 *  起床待ち[NGKI1252]
    121121 */
    122122#ifdef TOPPERS_slp_tsk
     
    129129
    130130        LOG_SLP_TSK_ENTER();
    131         CHECK_DISPATCH();
     131        CHECK_DISPATCH();                                                       /*[NGKI1254]*/
    132132
    133133        lock_cpu_dsp();
    134134        if (p_runtsk->raster) {
    135                 ercd = E_RASTER;
     135                ercd = E_RASTER;                                                /*[NGKI3455]*/
    136136        }
    137137        else if (p_runtsk->wupque) {
    138                 p_runtsk->wupque = false;
    139                 ercd = E_OK;
    140         }
    141         else {
    142                 p_runtsk->tstat = TS_WAITING_SLP;
    143                 make_wait(&winfo);
     138                p_runtsk->wupque = false;                               /*[NGKI1259]*/
     139                ercd = E_OK;
     140        }
     141        else {
     142                make_wait(TS_WAITING_SLP, &winfo);              /*[NGKI1260]*/
    144143                LOG_TSKSTAT(p_runtsk);
    145144                dispatch();
     
    156155
    157156/*
    158  *  起床待ち(タイムアウトあり)
     157 *  起床待ち(タイムアウトあり)[NGKI1253]
    159158 */
    160159#ifdef TOPPERS_tslp_tsk
     
    168167
    169168        LOG_TSLP_TSK_ENTER(tmout);
    170         CHECK_DISPATCH();
    171         CHECK_PAR(VALID_TMOUT(tmout));
     169        CHECK_DISPATCH();                                                       /*[NGKI1254]*/
     170        CHECK_PAR(VALID_TMOUT(tmout));                          /*[NGKI1256]*/
    172171
    173172        lock_cpu_dsp();
    174173        if (p_runtsk->raster) {
    175                 ercd = E_RASTER;
     174                ercd = E_RASTER;                                                /*[NGKI3455]*/
    176175        }
    177176        else if (p_runtsk->wupque) {
    178                 p_runtsk->wupque = false;
     177                p_runtsk->wupque = false;                               /*[NGKI1259]*/
    179178                ercd = E_OK;
    180179        }
    181180        else if (tmout == TMO_POL) {
    182                 ercd = E_TMOUT;
    183         }
    184         else {
    185                 p_runtsk->tstat = TS_WAITING_SLP;
    186                 make_wait_tmout(&winfo, &tmevtb, tmout);
     181                ercd = E_TMOUT;                                                 /*[NGKI1257]*/
     182        }
     183        else {                                                                          /*[NGKI1260]*/
     184                make_wait_tmout(TS_WAITING_SLP, &winfo, &tmevtb, tmout);
    187185                LOG_TSKSTAT(p_runtsk);
    188186                dispatch();
     
    199197
    200198/*
    201  *  タスクの起床
     199 *  タスクの起床[NGKI3531]
    202200 */
    203201#ifdef TOPPERS_wup_tsk
     
    210208
    211209        LOG_WUP_TSK_ENTER(tskid);
    212         CHECK_UNL();
     210        CHECK_UNL();                                                            /*[NGKI1265]*/
    213211        if (tskid == TSK_SELF && !sense_context()) {
    214                 p_tcb = p_runtsk;
    215         }
    216         else {
    217                 CHECK_ID(VALID_TSKID(tskid));
     212                p_tcb = p_runtsk;                                               /*[NGKI1275]*/
     213        }
     214        else {
     215                CHECK_ID(VALID_TSKID(tskid));                   /*[NGKI1267]*/
    218216                p_tcb = get_tcb(tskid);
    219217        }
     
    221219        lock_cpu();
    222220        if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
    223                 ercd = E_NOEXS;
     221                ercd = E_NOEXS;                                                 /*[NGKI1268]*/
    224222        }
    225223        else if (TSTAT_DORMANT(p_tcb->tstat)) {
    226                 ercd = E_OBJ;
     224                ercd = E_OBJ;                                                   /*[NGKI1270]*/
    227225        }
    228226        else if (TSTAT_WAIT_SLP(p_tcb->tstat)) {
    229                 wait_complete(p_tcb);
     227                wait_complete(p_tcb);                                   /*[NGKI1271]*/
    230228                if (p_runtsk != p_schedtsk) {
    231229                        if (!sense_context()) {
     
    233231                        }
    234232                        else {
    235                                 request_dispatch();
     233                                request_dispatch_retint();
    236234                        }
    237235                }
     
    239237        }
    240238        else if (!(p_tcb->wupque)) {
    241                 p_tcb->wupque = true;
    242                 ercd = E_OK;
    243         }
    244         else {
    245                 ercd = E_QOVR;
     239                p_tcb->wupque = true;                                   /*[NGKI1273]*/
     240                ercd = E_OK;
     241        }
     242        else {
     243                ercd = E_QOVR;                                                  /*[NGKI1274]*/
    246244        }
    247245        unlock_cpu();
     
    255253
    256254/*
    257  *  タスク起床要求のキャンセル
     255 *  タスク起床要求のキャンセル[NGKI1276]
    258256 */
    259257#ifdef TOPPERS_can_wup
     
    266264
    267265        LOG_CAN_WUP_ENTER(tskid);
    268         CHECK_TSKCTX_UNL();
     266        CHECK_TSKCTX_UNL();                                                     /*[NGKI1277][NGKI1278]*/
    269267        if (tskid == TSK_SELF) {
    270                 p_tcb = p_runtsk;
    271         }
    272         else {
    273                 CHECK_ID(VALID_TSKID(tskid));
     268                p_tcb = p_runtsk;                                               /*[NGKI1285]*/
     269        }
     270        else {
     271                CHECK_ID(VALID_TSKID(tskid));                   /*[NGKI1280]*/
    274272                p_tcb = get_tcb(tskid);
    275273        }
     
    277275        lock_cpu();
    278276        if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
    279                 ercd = E_NOEXS;
     277                ercd = E_NOEXS;                                                 /*[NGKI1281]*/
    280278        }
    281279        else if (TSTAT_DORMANT(p_tcb->tstat)) {
    282                 ercd = E_OBJ;
    283         }
    284         else {
    285                 ercd = p_tcb->wupque ? 1 : 0;
    286                 p_tcb->wupque = false;
     280                ercd = E_OBJ;                                                   /*[NGKI1283]*/
     281        }
     282        else {
     283                ercd = p_tcb->wupque ? 1 : 0;                   /*[NGKI1284]*/
     284                p_tcb->wupque = false;                                  /*[NGKI1284]*/
    287285        }
    288286        unlock_cpu();
     
    296294
    297295/*
    298  *  待ち状態の強制解除
     296 *  待ち状態の強制解除[NGKI3532]
    299297 */
    300298#ifdef TOPPERS_rel_wai
     
    307305
    308306        LOG_REL_WAI_ENTER(tskid);
    309         CHECK_UNL();
    310         CHECK_ID(VALID_TSKID(tskid));
     307        CHECK_UNL();                                                            /*[NGKI1290]*/
     308        CHECK_ID(VALID_TSKID(tskid));                           /*[NGKI1292]*/
    311309        p_tcb = get_tcb(tskid);
    312310
    313311        lock_cpu();
    314312        if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
    315                 ercd = E_NOEXS;
     313                ercd = E_NOEXS;                                                 /*[NGKI1293]*/
    316314        }
    317315        else if (!TSTAT_WAITING(p_tcb->tstat)) {
    318                 ercd = E_OBJ;
    319         }
    320         else {
    321                 wait_dequeue_wobj(p_tcb);
     316                ercd = E_OBJ;                                                   /*[NGKI1295]*/
     317        }
     318        else {
     319                wait_dequeue_wobj(p_tcb);                               /*[NGKI1296]*/
    322320                wait_dequeue_tmevtb(p_tcb);
    323                 p_tcb->p_winfo->wercd = E_RLWAI;
     321                p_tcb->p_winfo->wercd = E_RLWAI;                /*[NGKI1297]*/
    324322                make_non_wait(p_tcb);
    325323                if (p_runtsk != p_schedtsk) {
     
    328326                        }
    329327                        else {
    330                                 request_dispatch();
     328                                request_dispatch_retint();
    331329                        }
    332330                }
     
    409407
    410408/*
    411  *  強制待ち状態からの再開
     409 *  強制待ち状態からの再開[NGKI1312]
    412410 */
    413411#ifdef TOPPERS_rsm_tsk
     
    420418
    421419        LOG_RSM_TSK_ENTER(tskid);
    422         CHECK_TSKCTX_UNL();
    423         CHECK_ID(VALID_TSKID(tskid));
     420        CHECK_TSKCTX_UNL();                                                     /*[NGKI1313][NGKI1314]*/
     421        CHECK_ID(VALID_TSKID(tskid));                           /*[NGKI1316]*/
    424422        p_tcb = get_tcb(tskid);
    425423
    426424        lock_cpu();
    427425        if (p_tcb->p_tinib->tskatr == TA_NOEXS) {
    428                 ercd = E_NOEXS;
     426                ercd = E_NOEXS;                                                 /*[NGKI1317]*/
    429427        }
    430428        else if (!TSTAT_SUSPENDED(p_tcb->tstat)) {
    431                 ercd = E_OBJ;
    432         }
    433         else if (!TSTAT_WAITING(p_tcb->tstat)) {
     429                ercd = E_OBJ;                                                   /*[NGKI1319]*/
     430        }
     431        else {
    434432                /*
    435                  *  強制待ち状態から実行できる状態への遷移
     433                 *  強制待ちからの再開[NGKI1320]
    436434                 */
    437                 p_tcb->tstat = TS_RUNNABLE;
    438                 LOG_TSKSTAT(p_tcb);
    439                 make_runnable(p_tcb);
    440                 if (p_runtsk != p_schedtsk) {
    441                         dispatch();
     435                if (!TSTAT_WAITING(p_tcb->tstat)) {
     436                        p_tcb->tstat = TS_RUNNABLE;
     437                        LOG_TSKSTAT(p_tcb);
     438                        make_runnable(p_tcb);
     439                        if (p_runtsk != p_schedtsk) {
     440                                dispatch();
     441                        }
    442442                }
    443                 ercd = E_OK;
    444         }
    445         else {
    446                 /*
    447                  *  二重待ち状態から待ち状態への遷移
    448                  */
    449                 p_tcb->tstat &= ~TS_SUSPENDED;
    450                 LOG_TSKSTAT(p_tcb);
     443                else {
     444                        p_tcb->tstat &= ~TS_SUSPENDED;
     445                        LOG_TSKSTAT(p_tcb);
     446                }
    451447                ercd = E_OK;
    452448        }
     
    461457
    462458/*
    463  *  自タスクの遅延
     459 *  自タスクの遅延[NGKI1348]
    464460 */
    465461#ifdef TOPPERS_dly_tsk
     
    473469
    474470        LOG_DLY_TSK_ENTER(dlytim);
    475         CHECK_DISPATCH();
    476         CHECK_PAR(VALID_RELTIM(dlytim));
     471        CHECK_DISPATCH();                                                       /*[NGKI1349]*/
     472        CHECK_PAR(VALID_RELTIM(dlytim));                        /*[NGKI1351]*/
    477473
    478474        lock_cpu_dsp();
    479475        if (p_runtsk->raster) {
    480                 ercd = E_RASTER;
    481         }
    482         else {
    483                 p_runtsk->tstat = TS_WAITING_DLY;
     476                ercd = E_RASTER;                                                /*[NGKI3456]*/
     477        }
     478        else {
     479                p_runtsk->tstat = TS_WAITING_DLY;               /*[NGKI1353]*/
    484480                make_non_runnable(p_runtsk);
    485481                p_runtsk->p_winfo = &winfo;
     
    487483                tmevtb.callback = (CBACK) wait_tmout_ok;
    488484                tmevtb.arg = (void *) p_runtsk;
    489                 tmevtb_enqueue(&tmevtb, dlytim);
     485                tmevtb_enqueue_reltim(&tmevtb, dlytim);
    490486                LOG_TSKSTAT(p_runtsk);
    491487                dispatch();
  • EcnlProtoTool/trunk/asp3_dcre/kernel/task_term.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2014 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2017 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    109109ext_tsk(void)
    110110{
    111         PRI             intpri;
    112111        ER              ercd;
    113112
     
    126125        }
    127126
    128         intpri = t_get_ipm();
    129         if (!enadsp || intpri != TIPM_ENAALL) {
     127        if (!dspflg) {
    130128                if (!enadsp) {
    131129                        /*
     
    135133                        enadsp = true;
    136134                }
    137                 if (intpri != TIPM_ENAALL) {
     135                if (t_get_ipm() != TIPM_ENAALL) {
    138136                        /*
    139137                         *  割込み優先度マスク(IPM)がTIPM_ENAALL以外の状態で
     
    143141                        t_set_ipm(TIPM_ENAALL);
    144142                }
    145                 dspflg = true;
    146                 p_schedtsk = search_schedtsk();
     143                set_dspflg();
    147144        }
    148145
  • EcnlProtoTool/trunk/asp3_dcre/kernel/time_event.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    4949
    5050/*
     51 *  TCYC_HRTCNTの定義のチェック
     52 */
     53#if defined(USE_64BIT_HRTCNT) && defined(TCYC_HRTCNT)
     54#error TCYC_HRTCNT must not be defined when USE_64BIT_HRTCNT.
     55#endif
     56
     57/*
    5158 *  TSTEP_HRTCNTの範囲チェック
    5259 */
     
    5663
    5764/*
    58  *  HRTCNT_BOUNDの範囲チェック
    59  */
     65 *  HRTCNT_BOUNDの定義のチェック
     66 */
     67#ifndef USE_64BIT_HRTCNT
     68
    6069#if HRTCNT_BOUND >= 4294000000U
    6170#error HRTCNT_BOUND is too large.
     
    6776#endif /* HRTCNT_BOUND >= TCYC_HRTCNT */
    6877#endif /* TCYC_HRTCNT */
     78
     79#else /* USE_64BIT_HRTCNT */
     80
     81#ifdef HRTCNT_BOUND
     82#error USE_64BIT_HRTCNT is not supported on this target.
     83#endif /* HRTCNT_BOUND */
     84
     85#endif /* USE_64BIT_HRTCNT */
    6986
    7087/*
     
    367384        }
    368385#endif /* TCYC_HRTCNT */
     386        current_hrtcnt = new_hrtcnt;                                    /*[ASPD1016]*/
    369387
    370388        previous_evttim = current_evttim;
    371389        current_evttim += (EVTTIM) hrtcnt_advance;              /*[ASPD1015]*/
    372         current_hrtcnt = new_hrtcnt;                                    /*[ASPD1016]*/
    373390        boundary_evttim = current_evttim - BOUNDARY_MARGIN;     /*[ASPD1011]*/
    374391
     
    407424
    408425        if (p_last_tmevtn < p_top_tmevtn) {
     426                /*
     427                 *  タイムイベントがない場合
     428                 */
     429#ifdef USE_64BIT_HRTCNT
     430                target_hrt_clear_event();
     431#else /* USE_64BIT_HRTCNT */
    409432                target_hrt_set_event(HRTCNT_BOUND);                     /*[ASPD1007]*/
     433#endif /* USE_64BIT_HRTCNT */
    410434        }
    411435        else if (EVTTIM_LE(top_evttim, current_evttim)) {
     
    414438        else {
    415439                hrtcnt = (HRTCNT)(top_evttim - current_evttim);
     440#ifdef USE_64BIT_HRTCNT
     441                target_hrt_set_event(hrtcnt);
     442#else /* USE_64BIT_HRTCNT */
    416443                if (hrtcnt > HRTCNT_BOUND) {
    417444                        target_hrt_set_event(HRTCNT_BOUND);             /*[ASPD1006]*/
     
    420447                        target_hrt_set_event(hrtcnt);                   /*[ASPD1002]*/
    421448                }
     449#endif /* USE_64BIT_HRTCNT */
    422450        }
    423451}
     
    442470 * 
    443471 */
    444 #ifdef TOPPERS_tmeenq
     472#ifdef TOPPERS_tmeenqrel
    445473
    446474void
    447 tmevtb_enqueue(TMEVTB *p_tmevtb, RELTIM time)
     475tmevtb_enqueue_reltim(TMEVTB *p_tmevtb, RELTIM time)
    448476{
    449477        /*
     
    467495}
    468496
    469 #endif /* TOPPERS_tmeenq */
     497#endif /* TOPPERS_tmeenqrel */
    470498
    471499/*
     
    502530
    503531bool_t
    504 check_adjtim(int_t adjtim)
     532check_adjtim(int32_t adjtim)
    505533{
    506534        if (adjtim > 0) {
    507535                return(p_last_tmevtn >= p_top_tmevtn    /*[NGKI3588]*/
    508                                         && EVTTIM_LE(top_evttim, current_evttim - TMAX_ADJTIM));
     536                                        && EVTTIM_LE(top_evttim + TMAX_ADJTIM, current_evttim));
    509537        }
    510538        else if (adjtim < 0) {                                          /*[NGKI3589]*/
     
    559587        TMEVTB  *p_tmevtb;
    560588        bool_t  callflag;
     589#ifndef TOPPERS_OMIT_SYSLOG
     590        uint_t  nocall = 0;
     591#endif /* TOPPERS_OMIT_SYSLOG */
    561592
    562593        assert(sense_context());
     
    587618                        (*(p_tmevtb->callback))(p_tmevtb->arg);
    588619                        callflag = true;
     620#ifndef TOPPERS_OMIT_SYSLOG
     621                        nocall += 1;
     622#endif /* TOPPERS_OMIT_SYSLOG */
    589623                }
    590624        } while (callflag);                                                             /*[ASPD1020]*/
    591625
     626#ifndef TOPPERS_OMIT_SYSLOG
     627        /*
     628         *  タイムイベントが処理されなかった場合.
     629         */
     630        if (nocall == 0) {
     631                syslog_0(LOG_NOTICE, "no time event is processed in hrt interrupt.");
     632        }
     633#endif /* TOPPERS_OMIT_SYSLOG */
     634
    592635        /*
    593636         *  高分解能タイマ割込みの発生タイミングを設定する[ASPD1025].
  • EcnlProtoTool/trunk/asp3_dcre/kernel/time_event.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    162162 *  の発生時刻,コールバック関数,コールバック関数へ渡す引数は,
    163163 *  p_tmevtbが指すタイムイベントブロック中に設定しておく.
     164 *
     165 *  高分解能タイマ割込みの発生タイミングの設定を行わないため,カーネル
     166 *  の初期化時か,高分解能タイマ割込みの処理中で,それが必要ない場合に
     167 *  のみ使用する.
    164168 */
    165169extern void             tmevtb_register(TMEVTB *p_tmevtb);
     
    173177 *  ントブロック中に設定しておく.
    174178 */
    175 extern void             tmevtb_enqueue(TMEVTB *p_tmevtb, RELTIM time);
     179extern void             tmevtb_enqueue_reltim(TMEVTB *p_tmevtb, RELTIM time);
    176180
    177181/*
     
    187191 *  ベント時刻を取得した後に呼び出すことを想定している.
    188192 */
    189 extern bool_t   check_adjtim(int_t adjtim);
     193extern bool_t   check_adjtim(int32_t adjtim);
    190194
    191195/*
  • EcnlProtoTool/trunk/asp3_dcre/kernel/time_manage.c

    r321 r429  
    5353#include "time_event.h"
    5454#include "target_timer.h"
     55#include <sil.h>
    5556
    5657/*
     
    9899{
    99100        ER              ercd;
     101        bool_t lock;
    100102
    101103        LOG_SET_TIM_ENTER(systim);
    102         CHECK_TSKCTX_UNL();                                                     /*[NGKI3564][NGKI3565]*/
    103 
    104         lock_cpu();
     104        //CHECK_TSKCTX_UNL();                                                   /*[NGKI3564][NGKI3565]*/
     105        CHECK_TSKCTX();
     106        lock = sense_lock();
     107
     108        if (!lock)
     109                lock_cpu();
    105110        update_current_evttim();                                        /*[ASPD1059]*/
    106111        systim_offset = systim - monotonic_evttim;      /*[ASPD1060]*/
    107112        ercd = E_OK;
    108         unlock_cpu();
     113        if (!lock)
     114                unlock_cpu();
    109115
    110116  error_exit:
     
    124130{
    125131        ER              ercd;
     132        bool_t lock;
    126133
    127134        LOG_GET_TIM_ENTER(p_systim);
    128         CHECK_TSKCTX_UNL();                                                     /*[NGKI2350][NGKI2351]*/
    129 
    130         lock_cpu();
     135        //CHECK_TSKCTX_UNL();                                                   /*[NGKI2350][NGKI2351]*/
     136        CHECK_TSKCTX();
     137        lock = sense_lock();
     138
     139        if (!lock)
     140                lock_cpu();
    131141        update_current_evttim();                                        /*[ASPD1057]*/
    132142        *p_systim = systim_offset + monotonic_evttim;   /*[ASPD1058]*/
    133143        ercd = E_OK;
    134         unlock_cpu();
     144        if (!lock)
     145                unlock_cpu();
    135146
    136147  error_exit:
     
    176187                }
    177188
    178                 set_hrt_event();                                                /*[ASPD1056]*/
     189                if (!in_signal_time) {
     190                        set_hrt_event();                                        /*[ASPD1056]*/
     191                }
    179192                ercd = E_OK;
    180193        }
  • EcnlProtoTool/trunk/asp3_dcre/kernel/wait.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5454
    5555void
    56 make_wait_tmout(WINFO *p_winfo, TMEVTB *p_tmevtb, TMO tmout)
     56make_wait_tmout(uint_t tstat, WINFO *p_winfo, TMEVTB *p_tmevtb, TMO tmout)
    5757{
     58        p_runtsk->tstat = tstat;
    5859        make_non_runnable(p_runtsk);
    5960        p_runtsk->p_winfo = p_winfo;
     
    6667                p_tmevtb->callback = (CBACK) wait_tmout;
    6768                p_tmevtb->arg = (void *) p_runtsk;
    68                 tmevtb_enqueue(p_tmevtb, (RELTIM) tmout);
     69                tmevtb_enqueue_reltim(p_tmevtb, (RELTIM) tmout);
    6970        }
    7071}
     
    99100        make_non_wait(p_tcb);
    100101        if (p_runtsk != p_schedtsk) {
    101                 request_dispatch();
     102                request_dispatch_retint();
    102103        }
    103104
     
    119120        make_non_wait(p_tcb);
    120121        if (p_runtsk != p_schedtsk) {
    121                 request_dispatch();
     122                request_dispatch_retint();
    122123        }
    123124
     
    155156
    156157void
    157 wobj_make_wait(WOBJCB *p_wobjcb, WINFO_WOBJ *p_winfo_wobj)
     158wobj_make_wait(WOBJCB *p_wobjcb, uint_t tstat, WINFO_WOBJ *p_winfo_wobj)
    158159{
    159         make_wait(&(p_winfo_wobj->winfo));
     160        make_wait(tstat, &(p_winfo_wobj->winfo));
    160161        wobj_queue_insert(p_wobjcb);
    161162        p_winfo_wobj->p_wobjcb = p_wobjcb;
     
    167168
    168169void
    169 wobj_make_wait_tmout(WOBJCB *p_wobjcb, WINFO_WOBJ *p_winfo_wobj,
    170                                                                 TMEVTB *p_tmevtb, TMO tmout)
     170wobj_make_wait_tmout(WOBJCB *p_wobjcb, uint_t tstat,
     171                                                WINFO_WOBJ *p_winfo_wobj, TMEVTB *p_tmevtb, TMO tmout)
    171172{
    172         make_wait_tmout(&(p_winfo_wobj->winfo), p_tmevtb, tmout);
     173        make_wait_tmout(tstat, &(p_winfo_wobj->winfo), p_tmevtb, tmout);
    173174        wobj_queue_insert(p_wobjcb);
    174175        p_winfo_wobj->p_wobjcb = p_wobjcb;
  • EcnlProtoTool/trunk/asp3_dcre/kernel/wait.h

    r321 r429  
    66 *  Copyright (C) 2000 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2014 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    7777 *  待ち状態への遷移
    7878 *
    79  *  実行中のタスクを待ち状態に遷移させる.具体的には,実行中のタスクを
    80  *  レディキューから削除し,TCBのp_winfoフィールド,WINFOのp_tmevtbフィー
    81  *  ルドを設定する.
    82  */
    83 Inline void
    84 make_wait(WINFO *p_winfo)
    85 {
     79 *  実行中のタスクを待ち状態に遷移させる.具体的には,実行中のタスクの
     80 *  タスク状態をtstatにしてレディキューから削除し,TCBのp_winfoフィー
     81 *  ルド,WINFOのp_tmevtbフィールドを設定する.
     82 */
     83Inline void
     84make_wait(uint_t tstat, WINFO *p_winfo)
     85{
     86        p_runtsk->tstat = tstat;
    8687        make_non_runnable(p_runtsk);
    8788        p_runtsk->p_winfo = p_winfo;
     
    9394 *
    9495 *  実行中のタスクを,タイムアウト指定付きで待ち状態に遷移させる.具体
    95  *  的には,実行中のタスクをレディキューから削除し,TCBのp_winfoフィー
    96  *  ルド,WINFOのp_tmevtbフィールドを設定する.また,タイムイベントブ
    97  *  ロックを登録する.
    98  */
    99 extern void     make_wait_tmout(WINFO *p_winfo, TMEVTB *p_tmevtb, TMO tmout);
     96 *  的には,実行中のタスクのタスク状態をtstatにしてレディキューから削
     97 *  除し,TCBのp_winfoフィールド,WINFOのp_tmevtbフィールドを設定する.
     98 *  また,タイムイベントブロックを登録する.
     99 */
     100extern void     make_wait_tmout(uint_t tstat, WINFO *p_winfo,
     101                                                                        TMEVTB *p_tmevtb, TMO tmout);
    100102
    101103/*
     
    246248 *  wobj_make_wait_tmoutは,タイムイベントブロックの登録も行う.
    247249 */
    248 extern void     wobj_make_wait(WOBJCB *p_wobjcb, WINFO_WOBJ *p_winfo);
    249 extern void     wobj_make_wait_tmout(WOBJCB *p_wobjcb, WINFO_WOBJ *p_winfo,
    250                                                                                         TMEVTB *p_tmevtb, TMO tmout);
     250extern void     wobj_make_wait(WOBJCB *p_wobjcb, uint_t tstat,
     251                                                                                        WINFO_WOBJ *p_winfo_wobj);
     252extern void     wobj_make_wait_tmout(WOBJCB *p_wobjcb, uint_t tstat,
     253                                                WINFO_WOBJ *p_winfo_wobj, TMEVTB *p_tmevtb, TMO tmout);
    251254
    252255/*
  • EcnlProtoTool/trunk/asp3_dcre/library/log_output.c

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    174174                syslog_printf((const char *)(p_syslog->logpar[0]),
    175175                                                                &(p_syslog->logpar[1]), putc);
     176                (*putc)('\n');
    176177                break;
    177178        case LOG_TYPE_ASSERT:
    178179                syslog_printf("%s:%u: Assertion `%s' failed.",
    179180                                                                &(p_syslog->logpar[0]), putc);
     181                (*putc)('\n');
    180182                break;
    181183        default:
  • EcnlProtoTool/trunk/asp3_dcre/library/t_perror.c

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2004-2006 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    4848#include <t_stdlib.h>
    4949
     50#ifndef TOPPERS_OMIT_SYSLOG
     51
     52static const char       message[] = "%s (%d) reported by `%s' in line %d of `%s'.";
     53
    5054void
    51 t_perror(uint_t prio, const char *file, int_t line, const char *expr, ER ercd)
     55tt_perror(SYSLOG *p_logbuf, const char *file, int_t line,
     56                                                                                        const char *expr, ER ercd)
    5257{
    53         syslog_5(prio, "%s (%d) reported by `%s' in line %d of `%s'.",
    54                                                 itron_strerror(ercd), SERCD(ercd), expr, line, file);
     58        p_logbuf->logtype = LOG_TYPE_COMMENT;
     59        p_logbuf->logpar[0] = (LOGPAR) message;
     60        p_logbuf->logpar[1] = (LOGPAR) itron_strerror(ercd);
     61        p_logbuf->logpar[2] = (LOGPAR) SERCD(ercd);
     62        p_logbuf->logpar[3] = (LOGPAR) expr;
     63        p_logbuf->logpar[4] = (LOGPAR) line;
     64        p_logbuf->logpar[5] = (LOGPAR) file;
     65}
    5566
    56 }
     67#endif /* TOPPERS_OMIT_SYSLOG */
  • EcnlProtoTool/trunk/asp3_dcre/library/vasyslog.c

    r321 r429  
    55 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    66 *                              Toyohashi Univ. of Technology, JAPAN
    7  *  Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    88 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    99 *
     
    5151
    5252void
    53 vsyslog(uint_t prio, const char *format, va_list ap)
     53tt_syslog(SYSLOG *p_logbuf, const char *format, va_list ap)
    5454{
    55         SYSLOG  logbuf;
    5655        uint_t  i;
    5756        char    sz;
    5857        char    c;
    5958
    60         logbuf.logtype = LOG_TYPE_COMMENT;
    61         logbuf.logpar[0] = (LOGPAR) format;
     59        p_logbuf->logtype = LOG_TYPE_COMMENT;
     60        p_logbuf->logpar[0] = (LOGPAR) format;
    6261        i = 1U;
    6362
     
    7877                switch (c) {
    7978                case 'd':
    80                         logbuf.logpar[i++] = (sz == 'l') ? (LOGPAR) va_arg(ap, long_t)
    81                                                            : (sz == 't') ? (LOGPAR) va_arg(ap, int32_t)
    82                                                            : (sz == 'T') ? (LOGPAR) va_arg(ap, SYSTIM)
    83                                                            : (LOGPAR) va_arg(ap, int_t);
     79                        p_logbuf->logpar[i++] = (sz == 'l') ? (LOGPAR) va_arg(ap, long_t)
     80                                                                  : (sz == 't') ? (LOGPAR) va_arg(ap, int32_t)
     81                                                                  : (sz == 'T') ? (LOGPAR) va_arg(ap, SYSTIM)
     82                                                                  : (LOGPAR) va_arg(ap, int_t);
    8483                        break;
    8584                case 'u':
    8685                case 'x':
    8786                case 'X':
    88                         logbuf.logpar[i++] = (sz == 'l') ? (LOGPAR) va_arg(ap, ulong_t)
    89                                                            : (sz == 't') ? (LOGPAR) va_arg(ap, uint32_t)
    90                                                            : (sz == 'T') ? (LOGPAR) va_arg(ap, SYSTIM)
    91                                                            : (LOGPAR) va_arg(ap, uint_t);
     87                        p_logbuf->logpar[i++] = (sz == 'l') ? (LOGPAR) va_arg(ap, ulong_t)
     88                                                                  : (sz == 't') ? (LOGPAR) va_arg(ap, uint32_t)
     89                                                                  : (sz == 'T') ? (LOGPAR) va_arg(ap, SYSTIM)
     90                                                                  : (LOGPAR) va_arg(ap, uint_t);
    9291                        break;
    9392                case 'p':
    94                         logbuf.logpar[i++] = (LOGPAR) va_arg(ap, void *);
     93                        p_logbuf->logpar[i++] = (LOGPAR) va_arg(ap, void *);
    9594                        break;
    9695                case 'c':
    97                         logbuf.logpar[i++] = (LOGPAR) va_arg(ap, int);
     96                        p_logbuf->logpar[i++] = (LOGPAR) va_arg(ap, int);
    9897                        break;
    9998                case 's':
    100                         logbuf.logpar[i++] = (LOGPAR) va_arg(ap, const char *);
     99                        p_logbuf->logpar[i++] = (LOGPAR) va_arg(ap, const char *);
    101100                        break;
    102101                case '\0':
     
    107106                }
    108107        }
    109         (void) tSysLog_eSysLog_write(prio, &logbuf);
    110 }
    111 
    112 void
    113 syslog(uint_t prio, const char *format, ...)
    114 {
    115         va_list ap;
    116         va_start(ap, format);
    117         vsyslog(prio, format, ap);
    118         va_end(ap);
    119 }
    120 
    121 /* mbed weak error function */
    122 void
    123 error(const char* format, ...) {
    124         va_list arg;
    125         va_start(arg, format);
    126         vsyslog(LOG_ERROR, format, arg);
    127         va_end(arg);
    128         ext_ker();
    129108}
    130109
  • EcnlProtoTool/trunk/asp3_dcre/mbed/Makefile.mbed

    r321 r429  
    1414#
    1515INCLUDES := $(INCLUDES)\
    16         -I$(MBEDDIR)/api\
     16        -I$(MBEDDIR)\
     17        -I$(MBEDDIR)/cmsis\
     18        -I$(MBEDDIR)/cmsis/TARGET_CORTEX_A\
    1719        -I$(MBEDDIR)/hal\
    18         -I$(MBEDDIR)/targets/cmsis\
    19         -I$(MBEDDIR)/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H\
    20         -I$(MBEDDIR)/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/inc\
    21         -I$(MBEDDIR)/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/inc/iodefines\
    22         -I$(MBEDDIR)/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H\
    23         -I$(MBEDDIR)/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/TARGET_MBED_MBRZA1H
     20        -I$(MBEDDIR)/platform\
     21        -I$(MBEDDIR)/targets/TARGET_RENESAS\
     22        -I$(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX\
     23        -I$(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H\
     24        -I$(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/TARGET_MBED_MBRZA1H\
     25        -I$(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/device\
     26        -I$(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/device/inc\
     27        -I$(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/device/inc/iobitmasks\
     28        -I$(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/device/inc/iodefines\
     29        -I$(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/common\
     30        -I$(MBEDDIR)/rtos/TARGET_CORTEX
    2431COPTS := $(COPTS)\
    2532  -mthumb\
     
    3946  -mno-unaligned-access
    4047CDEFS := $(CDEFS)\
    41         -DTARGET_RZ_A1H\
    42         -DTARGET_MBRZA1H\
    43         -DTOOLCHAIN_GCC_ARM\
    44         -DTOOLCHAIN_GCC\
    45         -DTARGET_CORTEX_A\
    46         -DMBED_BUILD_TIMESTAMP=1460441486.52\
    47         -DTARGET_RENESAS\
    48         -D__FPU_PRESENT
     48        -DARM_MATH_CA9 \
     49        -DDEVICE_ANALOGIN=1 \
     50        -DDEVICE_CAN=1 \
     51        -DDEVICE_EMAC=1 \
     52        -DDEVICE_ETHERNET=1 \
     53        -DDEVICE_FLASH=1 \
     54        -DDEVICE_I2C=1 \
     55        -DDEVICE_I2CSLAVE=1 \
     56        -DDEVICE_I2C_ASYNCH=1 \
     57        -DDEVICE_INTERRUPTIN=1 \
     58        -DDEVICE_LPTICKER=1 \
     59        -DDEVICE_PORTIN=1 \
     60        -DDEVICE_PORTINOUT=1 \
     61        -DDEVICE_PORTOUT=1 \
     62        -DDEVICE_PWMOUT=1 \
     63        -DDEVICE_RTC=1 \
     64        -DDEVICE_SEMIHOST=1 \
     65        -DDEVICE_SERIAL=1 \
     66        -DDEVICE_SERIAL_ASYNCH=1 \
     67        -DDEVICE_SERIAL_FC=1 \
     68        -DDEVICE_SLEEP=1 \
     69        -DDEVICE_SPI=1 \
     70        -DDEVICE_SPISLAVE=1 \
     71        -DDEVICE_SPI_ASYNCH=1 \
     72        -DDEVICE_STDIO_MESSAGES=1 \
     73        -DDEVICE_USTICKER=1 \
     74        -DMBED_BUILD_TIMESTAMP=1550103323.92 \
     75        -DTARGET_A9 \
     76        -DTARGET_CORTEX \
     77        -DTARGET_CORTEX_A \
     78        -DTARGET_FF_ARDUINO \
     79        -DTARGET_LIKE_CORTEX_A9 \
     80        -DTARGET_LIKE_MBED \
     81        -DTARGET_MBRZA1H \
     82        -DTARGET_RELEASE \
     83        -DTARGET_RENESAS \
     84        -DTARGET_RZA1H \
     85        -DTARGET_RZ_A1H \
     86        -DTARGET_RZ_A1XX \
     87        -DTARGET_RZ_A1_EMAC \
     88        -DTOOLCHAIN_GCC \
     89        -DTOOLCHAIN_GCC_ARM \
     90        -DTOOLCHAIN_object \
     91        -D__CMSIS_RTOS \
     92        -D__CORTEX_A9 \
     93        -D__EVAL \
     94        -D__FPU_PRESENT=1 \
     95        -D__MBED_CMSIS_RTOS_CA9 \
     96        -D__MBED__=1 \
     97        -DIRQ_GIC_LINE_COUNT=587 \
     98        #-DDEVICE_STDIO_MESSAGES=1
    4999
    50100#
     
    52102#
    53103SYSSVC_DIRS := $(SYSSVC_DIRS)\
    54         $(MBEDDIR)/common\
    55         $(MBEDDIR)/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H\
    56         $(MBEDDIR)/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/TOOLCHAIN_GCC_ARM\
    57         $(MBEDDIR)/targets/cmsis/TOOLCHAIN_GCC/TARGET_CORTEX_A\
    58         $(MBEDDIR)/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H
    59 SYSSVC_ASMOBJS := $(SYSSVC_ASMOBJS)\
    60         cache.o
    61 START_OBJS = startup_RZ1AH.o
     104        $(MBEDDIR)\
     105        $(MBEDDIR)/hal\
     106        $(MBEDDIR)/platform\
     107        $(MBEDDIR)/cmsis/TARGET_CORTEX_A\
     108        $(MBEDDIR)/targets/TARGET_RENESAS\
     109        $(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX\
     110        $(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H\
     111        $(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/TARGET_MBED_MBRZA1H\
     112        $(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/device\
     113        $(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/device/TOOLCHAIN_GCC_ARM\
     114        $(MBEDDIR)/targets/TARGET_RENESAS/TARGET_RZA1XX/common
     115SYSSVC_ASMOBJS := $(SYSSVC_ASMOBJS)
     116START_OBJS := startup_RZ1AH.o
     117START_OBJS := $(addprefix $(OBJDIR)/, $(START_OBJS))
    62118SYSSVC_COBJS := $(SYSSVC_COBJS)\
    63         assert.o board.o gpio.o lp_ticker_api.o mbed_interface.o\
    64         pinmap_common.o rtc_time.o semihost_api.o ticker_api.o us_ticker_api.o\
    65         RZ_A1_Init.o cmsis_nvic.o gic.o mbed_sf_boot.o mmu_Renesas_RZ_A1.o\
    66         nvic_wrapper.o pl310.o rza_io_regrw.o system_MBRZA1H.o\
    67         analogin_api.o can_api.o ethernet_api.o gpio_api.o gpio_irq_api.o i2c_api.o\
    68         pinmap.o port_api.o pwmout_api.o rtc_api.o serial_api.o spi_api.o
    69         #wait_api.o us_ticker.o
    70 CFG_DMY := cfg_dmy.o mmu_Renesas_RZ_A1.o mbed_sf_boot.o RZ_A1_Init.o system_MBRZA1H.o cache.o pl310.o gic.o
     119        mbed_critical_section_api.o mbed_flash_api.o mbed_gpio.o mbed_lp_ticker_api.o\
     120        mbed_lp_ticker_wrapper.o mbed_pinmap_common.o mbed_sleep_manager.o mbed_mktime.o\
     121        mbed_ticker_api.o mbed_us_ticker_api.o mbed_assert.o mbed_board.o\
     122        mbed_critical.o mbed_error.o mbed_error_hist.o mbed_interface.o\
     123        mbed_rtc_time.o mbed_semihost_api.o mbed_stats.o\
     124        PeripheralPins.o RZ_A1_Init.o mbed_sf_boot.o mmu_RZ_A1H.o\
     125        system_RZ_A1H.o trng_api_esp32.o analogin_api.o can_api.o cmsis_nvic.o\
     126        irq_ctrl_gic.o nvic_wrapper.o rza_io_regrw.o ethernet_api.o flash_api.o\
     127        gpio_api.o gpio_irq_api.o i2c_api.o lp_ticker.o mtu2.o pinmap.o port_api.o\
     128        pwmout_api.o rtc_api.o serial_api.o sleep.o spi_api.o trng_api.o us_ticker.o
     129        #mbed_wait_api_no_rtos.o
     130CFG_DMY := cfg_dmy.o mmu_RZ_A1H.o mbed_sf_boot.o RZ_A1_Init.o system_RZ_A1H.o irq_ctrl_gic.o
    71131
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/analogin_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    2528#endif
    2629
     30/** Analogin hal structure. analogin_s is declared in the target's hal
     31 */
    2732typedef struct analogin_s analogin_t;
    2833
    29 void     analogin_init    (analogin_t *obj, PinName pin);
    30 float    analogin_read    (analogin_t *obj);
     34/**
     35 * \defgroup hal_analogin Analogin hal functions
     36 * @{
     37 */
     38
     39/** Initialize the analogin peripheral
     40 *
     41 * Configures the pin used by analogin.
     42 * @param obj The analogin object to initialize
     43 * @param pin The analogin pin name
     44 */
     45void analogin_init(analogin_t *obj, PinName pin);
     46
     47/** Read the input voltage, represented as a float in the range [0.0, 1.0]
     48 *
     49 * @param obj The analogin object
     50 * @return A floating value representing the current input voltage
     51 */
     52float analogin_read(analogin_t *obj);
     53
     54/** Read the value from analogin pin, represented as an unsigned 16bit value
     55 *
     56 * @param obj The analogin object
     57 * @return An unsigned 16bit value representing the current input voltage
     58 */
    3159uint16_t analogin_read_u16(analogin_t *obj);
     60
     61/**@}*/
    3262
    3363#ifdef __cplusplus
     
    3868
    3969#endif
     70
     71/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/analogout_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    2528#endif
    2629
     30/** Analogout hal structure. dac_s is declared in the target's hal
     31 */
    2732typedef struct dac_s dac_t;
    2833
    29 void     analogout_init     (dac_t *obj, PinName pin);
    30 void     analogout_free     (dac_t *obj);
    31 void     analogout_write    (dac_t *obj, float value);
    32 void     analogout_write_u16(dac_t *obj, uint16_t value);
    33 float    analogout_read     (dac_t *obj);
    34 uint16_t analogout_read_u16 (dac_t *obj);
     34/**
     35 * \defgroup hal_analogout Analogout hal functions
     36 * @{
     37 */
     38
     39/** Initialize the analogout peripheral
     40 *
     41 * Configures the pin used by analogout.
     42 * @param obj The analogout object to initialize
     43 * @param pin The analogout pin name
     44 */
     45void analogout_init(dac_t *obj, PinName pin);
     46
     47/** Release the analogout object
     48 *
     49 * Note: This is not currently used in the mbed-drivers
     50 * @param obj The analogout object
     51 */
     52void analogout_free(dac_t *obj);
     53
     54/** Set the output voltage, specified as a percentage (float)
     55 *
     56 * @param obj The analogin object
     57 * @param value The floating-point output voltage to be set
     58 */
     59void analogout_write(dac_t *obj, float value);
     60
     61/** Set the output voltage, specified as unsigned 16-bit
     62 *
     63 * @param obj The analogin object
     64 * @param value The unsigned 16-bit output voltage to be set
     65 */
     66void analogout_write_u16(dac_t *obj, uint16_t value);
     67
     68/** Read the current voltage value on the pin
     69 *
     70 * @param obj The analogin object
     71 * @return A floating-point value representing the current voltage on the pin,
     72 *     measured as a percentage
     73 */
     74float analogout_read(dac_t *obj);
     75
     76/** Read the current voltage value on the pin, as a normalized unsigned 16bit value
     77 *
     78 * @param obj The analogin object
     79 * @return An unsigned 16-bit value representing the current voltage on the pin
     80 */
     81uint16_t analogout_read_u16(dac_t *obj);
     82
     83/**@}*/
    3584
    3685#ifdef __cplusplus
     
    4190
    4291#endif
     92
     93/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/buffer.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2014-2015 ARM Limited
     
    2932
    3033#endif
     34
     35/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/can_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    2  * Copyright (c) 2006-2013 ARM Limited
     5 * Copyright (c) 2006-2016 ARM Limited
    36 *
    47 * Licensed under the Apache License, Version 2.0 (the "License");
     
    2326#include "PinNames.h"
    2427#include "PeripheralNames.h"
    25 #include "can_helper.h"
     28#include "hal/can_helper.h"
    2629
    2730#ifdef __cplusplus
     
    5659
    5760void          can_init     (can_t *obj, PinName rd, PinName td);
     61void          can_init_freq(can_t *obj, PinName rd, PinName td, int hz);
    5862void          can_free     (can_t *obj);
    5963int           can_frequency(can_t *obj, int hz);
     
    7983
    8084#endif
     85
     86/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/dma_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2014-2015 ARM Limited
     
    4447
    4548#endif
     49
     50/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/ethernet_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    4245int ethernet_send(void);
    4346
    44 // recieve from ethernet buffer, returning packet size, or 0 if no packet
     47// receive from ethernet buffer, returning packet size, or 0 if no packet
    4548int ethernet_receive(void);
    4649
     
    6669#endif
    6770
     71
     72/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/gpio_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    1720#define MBED_GPIO_API_H
    1821
     22#include <stdint.h>
    1923#include "device.h"
    2024
     
    2327#endif
    2428
    25 /* Set the given pin as GPIO
     29/**
     30 * \defgroup hal_gpio GPIO HAL functions
     31 * @{
     32 */
     33
     34/** Set the given pin as GPIO
     35 *
    2636 * @param pin The pin to be set as GPIO
    2737 * @return The GPIO port mask for this pin
    2838 **/
    2939uint32_t gpio_set(PinName pin);
    30 
    3140/* Checks if gpio object is connected (pin was not initialized with NC)
    3241 * @param pin The pin to be set as GPIO
     
    3544int gpio_is_connected(const gpio_t *obj);
    3645
    37 /* GPIO object */
     46/** Initialize the GPIO pin
     47 *
     48 * @param obj The GPIO object to initialize
     49 * @param pin The GPIO pin to initialize
     50 */
    3851void gpio_init(gpio_t *obj, PinName pin);
    3952
    40 void gpio_mode (gpio_t *obj, PinMode mode);
    41 void gpio_dir  (gpio_t *obj, PinDirection direction);
     53/** Set the input pin mode
     54 *
     55 * @param obj  The GPIO object
     56 * @param mode The pin mode to be set
     57 */
     58void gpio_mode(gpio_t *obj, PinMode mode);
    4259
     60/** Set the pin direction
     61 *
     62 * @param obj       The GPIO object
     63 * @param direction The pin direction to be set
     64 */
     65void gpio_dir(gpio_t *obj, PinDirection direction);
     66
     67/** Set the output value
     68 *
     69 * @param obj   The GPIO object
     70 * @param value The value to be set
     71 */
    4372void gpio_write(gpio_t *obj, int value);
    44 int  gpio_read (gpio_t *obj);
    4573
    46 // the following set of functions are generic and are implemented in the common gpio.c file
     74/** Read the input value
     75 *
     76 * @param obj The GPIO object
     77 * @return An integer value 1 or 0
     78 */
     79int gpio_read(gpio_t *obj);
     80
     81// the following functions are generic and implemented in the common gpio.c file
     82// TODO: fix, will be moved to the common gpio header file
     83
     84/** Init the input pin and set mode to PullDefault
     85 *
     86 * @param gpio The GPIO object
     87 * @param pin The pin name
     88 */
    4789void gpio_init_in(gpio_t* gpio, PinName pin);
     90
     91/** Init the input pin and set the mode
     92 *
     93 * @param gpio  The GPIO object
     94 * @param pin  The pin name
     95 * @param mode The pin mode to be set
     96 */
    4897void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode);
     98
     99/** Init the output pin as an output, with predefined output value 0
     100 *
     101 * @param gpio The GPIO object
     102 * @param pin The pin name
     103 * @return An integer value 1 or 0
     104 */
    49105void gpio_init_out(gpio_t* gpio, PinName pin);
     106
     107/** Init the pin as an output and set the output value
     108 *
     109 * @param gpio  The GPIO object
     110 * @param pin   The pin name
     111 * @param value The value to be set
     112 */
    50113void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value);
     114
     115/** Init the pin to be in/out
     116 *
     117 * @param gpio      The GPIO object
     118 * @param pin       The pin name
     119 * @param direction The pin direction to be set
     120 * @param mode      The pin mode to be set
     121 * @param value     The value to be set for an output pin
     122 */
    51123void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value);
     124
     125/**@}*/
    52126
    53127#ifdef __cplusplus
     
    56130
    57131#endif
     132
     133/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/gpio_irq_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    2528#endif
    2629
     30/** GPIO IRQ events
     31 */
    2732typedef enum {
    2833    IRQ_NONE,
     
    3136} gpio_irq_event;
    3237
     38/** GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL
     39 */
    3340typedef struct gpio_irq_s gpio_irq_t;
    3441
    3542typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
    3643
    37 int  gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
     44/**
     45 * \defgroup hal_gpioirq GPIO IRQ HAL functions
     46 * @{
     47 */
     48
     49/** Initialize the GPIO IRQ pin
     50 *
     51 * @param obj     The GPIO object to initialize
     52 * @param pin     The GPIO pin name
     53 * @param handler The handler to be attached to GPIO IRQ
     54 * @param id      The object ID (id != 0, 0 is reserved)
     55 * @return -1 if pin is NC, 0 otherwise
     56 */
     57int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
     58
     59/** Release the GPIO IRQ PIN
     60 *
     61 * @param obj The gpio object
     62 */
    3863void gpio_irq_free(gpio_irq_t *obj);
    39 void gpio_irq_set (gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
     64
     65/** Enable/disable pin IRQ event
     66 *
     67 * @param obj    The GPIO object
     68 * @param event  The GPIO IRQ event
     69 * @param enable The enable flag
     70 */
     71void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
     72
     73/** Enable GPIO IRQ
     74 *
     75 * This is target dependent, as it might enable the entire port or just a pin
     76 * @param obj The GPIO object
     77 */
    4078void gpio_irq_enable(gpio_irq_t *obj);
     79
     80/** Disable GPIO IRQ
     81 *
     82 * This is target dependent, as it might disable the entire port or just a pin
     83 * @param obj The GPIO object
     84 */
    4185void gpio_irq_disable(gpio_irq_t *obj);
     86
     87/**@}*/
    4288
    4389#ifdef __cplusplus
     
    4894
    4995#endif
     96
     97/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/i2c_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2015 ARM Limited
     
    1821
    1922#include "device.h"
    20 #include "buffer.h"
     23#include "hal/buffer.h"
     24
     25#if DEVICE_I2C_ASYNCH
     26#include "hal/dma_api.h"
     27#endif
    2128
    2229#if DEVICE_I2C
    2330
    2431/**
    25  * @defgroup I2CEvents I2C Events Macros
     32 * @defgroup hal_I2CEvents I2C Events Macros
    2633 *
    2734 * @{
     
    3643
    3744#if DEVICE_I2C_ASYNCH
    38 /** Asynch i2c hal structure
     45/** Asynch I2C HAL structure
    3946 */
    4047typedef struct {
    41     struct i2c_s    i2c;     /**< Target specific i2c structure */
     48    struct i2c_s    i2c;     /**< Target specific I2C structure */
    4249    struct buffer_s tx_buff; /**< Tx buffer */
    4350    struct buffer_s rx_buff; /**< Rx buffer */
     
    4552
    4653#else
    47 /** Non-asynch i2c hal structure
     54/** Non-asynch I2C HAL structure
    4855 */
    4956typedef struct i2c_s i2c_t;
     
    6168
    6269/**
    63  * \defgroup GeneralI2C I2C Configuration Functions
     70 * \defgroup hal_GeneralI2C I2C Configuration Functions
    6471 * @{
    6572 */
    6673
    6774/** Initialize the I2C peripheral. It sets the default parameters for I2C
    68  *  peripheral, and configure its specifieds pins.
    69  *  @param obj  The i2c object
     75 *  peripheral, and configures its specifieds pins.
     76 * 
     77 *  @param obj  The I2C object
    7078 *  @param sda  The sda pin
    7179 *  @param scl  The scl pin
     
    7381void i2c_init(i2c_t *obj, PinName sda, PinName scl);
    7482
    75 /** Configure the I2C frequency.
    76  *  @param obj The i2c object
     83/** Configure the I2C frequency
     84 *
     85 *  @param obj The I2C object
    7786 *  @param hz  Frequency in Hz
    7887 */
    7988void i2c_frequency(i2c_t *obj, int hz);
    8089
    81 /** Send START command.
    82  *  @param obj The i2c object
     90/** Send START command
     91 *
     92 *  @param obj The I2C object
    8393 */
    8494int  i2c_start(i2c_t *obj);
    8595
    86 /** Send STOP command.
    87  *  @param obj The i2c object
     96/** Send STOP command
     97 *
     98 *  @param obj The I2C object
    8899 */
    89100int  i2c_stop(i2c_t *obj);
    90101
    91 /** Blocking reading data.
    92  *  @param obj     The i2c object
     102/** Blocking reading data
     103 *
     104 *  @param obj     The I2C object
    93105 *  @param address 7-bit address (last bit is 1)
    94106 *  @param data    The buffer for receiving
     
    97109 *  @return Number of read bytes
    98110 */
    99 int  i2c_read(i2c_t *obj, int address, char *data, int length, int stop);
    100 
    101 /** Blocking sending data.
    102  *  @param obj     The i2c object
     111int i2c_read(i2c_t *obj, int address, char *data, int length, int stop);
     112
     113/** Blocking sending data
     114 *
     115 *  @param obj     The I2C object
    103116 *  @param address 7-bit address (last bit is 0)
    104117 *  @param data    The buffer for sending
    105  *  @param length  Number of bytes to wrte
     118 *  @param length  Number of bytes to write
    106119 *  @param stop    Stop to be generated after the transfer is done
    107  *  @return Number of written bytes
    108  */
    109 int  i2c_write(i2c_t *obj, int address, const char *data, int length, int stop);
    110 
    111 /** Reset I2C peripheral. TODO: The action here. Most of the implementation sends stop().
    112  *  @param obj The i2c object
     120 *  @return
     121 *      zero or non-zero - Number of written bytes
     122 *      negative - I2C_ERROR_XXX status
     123 */
     124int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop);
     125
     126/** Reset I2C peripheral. TODO: The action here. Most of the implementation sends stop()
     127 *
     128 *  @param obj The I2C object
    113129 */
    114130void i2c_reset(i2c_t *obj);
    115131
    116 /** Read one byte.
    117  *  @param obj The i2c object
     132/** Read one byte
     133 *
     134 *  @param obj The I2C object
    118135 *  @param last Acknoledge
    119136 *  @return The read byte
    120137 */
    121 int  i2c_byte_read(i2c_t *obj, int last);
    122 
    123 /** Write one byte.
    124  *  @param obj The i2c object
     138int i2c_byte_read(i2c_t *obj, int last);
     139
     140/** Write one byte
     141 *
     142 *  @param obj The I2C object
    125143 *  @param data Byte to be written
    126  *  @return 1 if NAK was received, 0 if ACK was received, 2 for timeout.
    127  */
    128 int  i2c_byte_write(i2c_t *obj, int data);
     144 *  @return 0 if NAK was received, 1 if ACK was received, 2 for timeout.
     145 */
     146int i2c_byte_write(i2c_t *obj, int data);
    129147
    130148/**@}*/
     
    139157/** Configure I2C as slave or master.
    140158 *  @param obj The I2C object
     159 *  @param enable_slave Enable i2c hardware so you can receive events with ::i2c_slave_receive
    141160 *  @return non-zero if a value is available
    142161 */
     
    152171/** Configure I2C as slave or master.
    153172 *  @param obj The I2C object
     173 *  @param data    The buffer for receiving
     174 *  @param length  Number of bytes to read
    154175 *  @return non-zero if a value is available
    155176 */
     
    158179/** Configure I2C as slave or master.
    159180 *  @param obj The I2C object
     181 *  @param data    The buffer for sending
     182 *  @param length  Number of bytes to write
    160183 *  @return non-zero if a value is available
    161184 */
     
    177200
    178201/**
    179  * \defgroup AsynchI2C Asynchronous I2C Hardware Abstraction Layer
    180  * @{
    181  */
    182 
    183 /** Start i2c asynchronous transfer.
     202 * \defgroup hal_AsynchI2C Asynchronous I2C Hardware Abstraction Layer
     203 * @{
     204 */
     205
     206/** Start I2C asynchronous transfer
     207 *
    184208 *  @param obj       The I2C object
    185  *  @param tx        The buffer to send
    186  *  @param tx_length The number of words to transmit
    187  *  @param rx        The buffer to receive
    188  *  @param rx_length The number of words to receive
    189  *  @param address   The address to be set - 7bit or 9 bit
     209 *  @param tx        The transmit buffer
     210 *  @param tx_length The number of bytes to transmit
     211 *  @param rx        The receive buffer
     212 *  @param rx_length The number of bytes to receive
     213 *  @param address   The address to be set - 7bit or 9bit
    190214 *  @param stop      If true, stop will be generated after the transfer is done
    191215 *  @param handler   The I2C IRQ handler to be set
     216 *  @param event     Event mask for the transfer. See \ref hal_I2CEvents
    192217 *  @param hint      DMA hint usage
    193218 */
     
    195220
    196221/** The asynchronous IRQ handler
     222 *
    197223 *  @param obj The I2C object which holds the transfer information
    198  *  @return event flags if a transfer termination condition was met or 0 otherwise.
     224 *  @return Event flags if a transfer termination condition was met, otherwise return 0.
    199225 */
    200226uint32_t i2c_irq_handler_asynch(i2c_t *obj);
    201227
    202 /** Attempts to determine if I2C peripheral is already in use.
    203  *  @param obj The I2C object
    204  *  @return non-zero if the I2C module is active or zero if it is not
     228/** Attempts to determine if the I2C peripheral is already in use
     229 *
     230 *  @param obj The I2C object
     231 *  @return Non-zero if the I2C module is active or zero if it is not
    205232 */
    206233uint8_t i2c_active(i2c_t *obj);
    207234
    208 /** Abort ongoing asynchronous transaction.
     235/** Abort asynchronous transfer
     236 *
     237 *  This function does not perform any check - that should happen in upper layers.
    209238 *  @param obj The I2C object
    210239 */
     
    222251
    223252#endif
     253
     254/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/lp_ticker_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2015 ARM Limited
     
    1922#include "device.h"
    2023
    21 #if DEVICE_LOWPOWERTIMER
    22 
    23 #include "ticker_api.h"
     24#if DEVICE_LPTICKER
     25
     26#include "hal/ticker_api.h"
    2427
    2528#ifdef __cplusplus
     
    2831
    2932/**
    30  * \defgroup LpTicker Low Power Ticker Functions
     33 * \defgroup hal_lp_ticker Low Power Ticker
     34 * Low level interface to the low power ticker of a target
     35 *
     36 * # Defined behavior
     37 * * Has a reported frequency between 4KHz and 64KHz - verified by ::lp_ticker_info_test
     38 * * Has a counter that is at least 12 bits wide - verified by ::lp_ticker_info_test
     39 * * Continues operating in deep sleep mode - verified by ::lp_ticker_deepsleep_test
     40 * * All behavior defined by the @ref hal_ticker_shared "ticker specification"
     41 *
     42 * # Undefined behavior
     43 * * See the @ref hal_ticker_shared "ticker specification"
     44 * * Calling any function other than lp_ticker_init after calling lp_ticker_free
     45 *
     46 * # Potential bugs
     47 * * Glitches due to ripple counter - Verified by ::lp_ticker_glitch_test
     48 *
     49 * @see hal_lp_ticker_tests
     50 *
    3151 * @{
    3252 */
    3353
     54/**
     55 * \defgroup hal_lp_ticker_tests Low Power Ticker tests
     56 * Tests to validate the proper implementation of the low power ticker
     57 *
     58 * To run the low power ticker hal tests use the command:
     59 *
     60 *     mbed test -t <toolchain> -m <target> -n tests-mbed_hal-common_ticker*,tests-mbed_hal-lp_ticker*
     61 *
     62 */
     63
     64typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
     65
     66/** Set low power ticker IRQ handler
     67 *
     68 * @param ticker_irq_handler IRQ handler to be connected
     69 *
     70 * @return previous ticker IRQ handler
     71 *
     72 * @note by default IRQ handler is set to ::ticker_irq_handler
     73 * @note this function is primarily for testing purposes and it's not required part of HAL implementation
     74 *
     75 */
     76ticker_irq_handler_type set_lp_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler);
     77
    3478/** Get low power ticker's data
    3579 *
    3680 * @return The low power ticker data
    3781 */
    38 const ticker_data_t* get_lp_ticker_data(void);
     82const ticker_data_t *get_lp_ticker_data(void);
    3983
    4084/** The wrapper for ticker_irq_handler, to pass lp ticker's data
     
    4791/** Initialize the low power ticker
    4892 *
     93 * Initialize or re-initialize the ticker. This resets all the
     94 * clocking and prescaler registers, along with disabling
     95 * the compare interrupt.
     96 *
     97 * Pseudo Code:
     98 * @code
     99 * void lp_ticker_init()
     100 * {
     101 *     // Enable clock gate so processor can read LPTMR registers
     102 *     POWER_CTRL |= POWER_CTRL_LPTMR_Msk;
     103 *
     104 *     // Disable the timer and ensure it is powered down
     105 *     LPTMR_CTRL &= ~(LPTMR_CTRL_ENABLE_Msk | LPTMR_CTRL_COMPARE_ENABLE_Msk);
     106 *
     107 *     // Configure divisors - no division necessary
     108 *     LPTMR_PRESCALE = 0;
     109 *     LPTMR_CTRL |= LPTMR_CTRL_ENABLE_Msk;
     110 *
     111 *     // Install the interrupt handler
     112 *     NVIC_SetVector(LPTMR_IRQn, (uint32_t)lp_ticker_irq_handler);
     113 *     NVIC_EnableIRQ(LPTMR_IRQn);
     114 * }
     115 * @endcode
    49116 */
    50117void lp_ticker_init(void);
    51118
    52 /** Read the current counter
    53  *
    54  * @return The current timer's counter value in microseconds
     119/** Deinitialize the lower power ticker
     120 *
     121 * Powerdown the lp ticker in preparation for sleep, powerdown, or reset.
     122 *
     123 * After calling this function no other ticker functions should be called except
     124 * lp_ticker_init(). Calling any function other than init after freeing is
     125 * undefined.
     126 *
     127 * @note This function stops the ticker from counting.
     128 */
     129void lp_ticker_free(void);
     130
     131/** Read the current tick
     132 *
     133 * If no rollover has occurred, the seconds passed since lp_ticker_init()
     134 * was called can be found by dividing the ticks returned by this function
     135 * by the frequency returned by ::lp_ticker_get_info.
     136 *
     137 * @return The current timer's counter value in ticks
     138 *
     139 * Pseudo Code:
     140 * @code
     141 * uint32_t lp_ticker_read()
     142 * {
     143 *     uint16_t count;
     144 *     uint16_t last_count;
     145 *
     146 *     // Loop until the same tick is read twice since this
     147 *     // is ripple counter on a different clock domain.
     148 *     count = LPTMR_COUNT;
     149 *     do {
     150 *         last_count = count;
     151 *         count = LPTMR_COUNT;
     152 *     } while (last_count != count);
     153 *
     154 *     return count;
     155 * }
     156 * @endcode
    55157 */
    56158uint32_t lp_ticker_read(void);
     
    58160/** Set interrupt for specified timestamp
    59161 *
    60  * @param timestamp The time in microseconds to be set
     162 * @param timestamp The time in ticks to be set
     163 *
     164 * @note no special handling needs to be done for times in the past
     165 * as the common timer code will detect this and call
     166 * lp_ticker_fire_interrupt() if this is the case
     167 *
     168 * @note calling this function with timestamp of more than the supported
     169 * number of bits returned by ::lp_ticker_get_info results in undefined
     170 * behavior.
     171 *
     172 * Pseudo Code:
     173 * @code
     174 * void lp_ticker_set_interrupt(timestamp_t timestamp)
     175 * {
     176 *     LPTMR_COMPARE = timestamp;
     177 *     LPTMR_CTRL |= LPTMR_CTRL_COMPARE_ENABLE_Msk;
     178 * }
     179 * @endcode
    61180 */
    62181void lp_ticker_set_interrupt(timestamp_t timestamp);
     
    64183/** Disable low power ticker interrupt
    65184 *
     185 * Pseudo Code:
     186 * @code
     187 * void lp_ticker_disable_interrupt(void)
     188 * {
     189 *     // Disable the compare interrupt
     190 *     LPTMR_CTRL &= ~LPTMR_CTRL_COMPARE_ENABLE_Msk;
     191 * }
     192 * @endcode
    66193 */
    67194void lp_ticker_disable_interrupt(void);
     
    69196/** Clear the low power ticker interrupt
    70197 *
     198 * Pseudo Code:
     199 * @code
     200 * void lp_ticker_clear_interrupt(void)
     201 * {
     202 *     // Write to the ICR (interrupt clear register) of the LPTMR
     203 *     LPTMR_ICR = LPTMR_ICR_COMPARE_Msk;
     204 * }
     205 * @endcode
    71206 */
    72207void lp_ticker_clear_interrupt(void);
     208
     209/** Set pending interrupt that should be fired right away.
     210 *
     211 * Pseudo Code:
     212 * @code
     213 * void lp_ticker_fire_interrupt(void)
     214 * {
     215 *     NVIC_SetPendingIRQ(LPTMR_IRQn);
     216 * }
     217 * @endcode
     218 */
     219void lp_ticker_fire_interrupt(void);
     220
     221/** Get frequency and counter bits of this ticker.
     222 *
     223 * Pseudo Code:
     224 * @code
     225 * const ticker_info_t* lp_ticker_get_info()
     226 * {
     227 *     static const ticker_info_t info = {
     228 *         32768,      // 32KHz
     229 *         16          // 16 bit counter
     230 *     };
     231 *     return &info;
     232 * }
     233 * @endcode
     234 */
     235const ticker_info_t *lp_ticker_get_info(void);
    73236
    74237/**@}*/
     
    81244
    82245#endif
     246
     247/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/pinmap.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    4447
    4548#endif
     49
     50/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/port_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    2528#endif
    2629
     30/** Port HAL structure. port_s is declared in the target's HAL
     31 */
    2732typedef struct port_s port_t;
    2833
     34/**
     35 * \defgroup hal_port Port HAL functions
     36 * @{
     37 */
     38
     39/** Get the pin name from the port's pin number
     40 *
     41 * @param port  The port name
     42 * @param pin_n The pin number within the specified port
     43 * @return The pin name for the port's pin number
     44 */
    2945PinName port_pin(PortName port, int pin_n);
    3046
    31 void port_init (port_t *obj, PortName port, int mask, PinDirection dir);
    32 void port_mode (port_t *obj, PinMode mode);
    33 void port_dir  (port_t *obj, PinDirection dir);
     47/** Initilize the port
     48 *
     49 * @param obj  The port object to initialize
     50 * @param port The port name
     51 * @param mask The bitmask to identify which bits in the port should be included (0 - ignore)
     52 * @param dir  The port direction
     53 */
     54void port_init(port_t *obj, PortName port, int mask, PinDirection dir);
     55
     56/** Set the input port mode
     57 *
     58 * @param obj  The port object
     59 * @param mode THe port mode to be set
     60 */
     61void port_mode(port_t *obj, PinMode mode);
     62
     63/** Set port direction (in/out)
     64 *
     65 * @param obj The port object
     66 * @param dir The port direction to be set
     67 */
     68void port_dir(port_t *obj, PinDirection dir);
     69
     70/** Write value to the port
     71 *
     72 * @param obj   The port object
     73 * @param value The value to be set
     74 */
    3475void port_write(port_t *obj, int value);
    35 int  port_read (port_t *obj);
     76
     77/** Read the current value on the port
     78 *
     79 * @param obj The port object
     80 * @return An integer with each bit corresponding to an associated port pin setting
     81 */
     82int port_read(port_t *obj);
     83
     84/**@}*/
    3685
    3786#ifdef __cplusplus
     
    4190
    4291#endif
     92
     93/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/pwmout_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    2528#endif
    2629
     30/** Pwmout hal structure. pwmout_s is declared in the target's hal
     31 */
    2732typedef struct pwmout_s pwmout_t;
    2833
    29 void pwmout_init         (pwmout_t* obj, PinName pin);
    30 void pwmout_free         (pwmout_t* obj);
     34/**
     35 * \defgroup hal_pwmout Pwmout hal functions
     36 * @{
     37 */
    3138
    32 void  pwmout_write       (pwmout_t* obj, float percent);
    33 float pwmout_read        (pwmout_t* obj);
     39/** Initialize the pwm out peripheral and configure the pin
     40 *
     41 * @param obj The pwmout object to initialize
     42 * @param pin The pwmout pin to initialize
     43 */
     44void pwmout_init(pwmout_t *obj, PinName pin);
    3445
    35 void pwmout_period       (pwmout_t* obj, float seconds);
    36 void pwmout_period_ms    (pwmout_t* obj, int ms);
    37 void pwmout_period_us    (pwmout_t* obj, int us);
     46/** Deinitialize the pwmout object
     47 *
     48 * @param obj The pwmout object
     49 */
     50void pwmout_free(pwmout_t *obj);
    3851
    39 void pwmout_pulsewidth   (pwmout_t* obj, float seconds);
    40 void pwmout_pulsewidth_ms(pwmout_t* obj, int ms);
    41 void pwmout_pulsewidth_us(pwmout_t* obj, int us);
     52/** Set the output duty-cycle in range <0.0f, 1.0f>
     53 *
     54 * Value 0.0f represents 0 percentage, 1.0f represents 100 percent.
     55 * @param obj     The pwmout object
     56 * @param percent The floating-point percentage number
     57 */
     58void pwmout_write(pwmout_t *obj, float percent);
     59
     60/** Read the current float-point output duty-cycle
     61 *
     62 * @param obj The pwmout object
     63 * @return A floating-point output duty-cycle
     64 */
     65float pwmout_read(pwmout_t *obj);
     66
     67/** Set the PWM period specified in seconds, keeping the duty cycle the same
     68 *
     69 * Periods smaller than microseconds (the lowest resolution) are set to zero.
     70 * @param obj     The pwmout object
     71 * @param seconds The floating-point seconds period
     72 */
     73void pwmout_period(pwmout_t *obj, float seconds);
     74
     75/** Set the PWM period specified in miliseconds, keeping the duty cycle the same
     76 *
     77 * @param obj The pwmout object
     78 * @param ms  The milisecond period
     79 */
     80void pwmout_period_ms(pwmout_t *obj, int ms);
     81
     82/** Set the PWM period specified in microseconds, keeping the duty cycle the same
     83 *
     84 * @param obj The pwmout object
     85 * @param us  The microsecond period
     86 */
     87void pwmout_period_us(pwmout_t *obj, int us);
     88
     89/** Set the PWM pulsewidth specified in seconds, keeping the period the same.
     90 *
     91 * @param obj     The pwmout object
     92 * @param seconds The floating-point pulsewidth in seconds
     93 */
     94void pwmout_pulsewidth(pwmout_t *obj, float seconds);
     95
     96/** Set the PWM pulsewidth specified in miliseconds, keeping the period the same.
     97 *
     98 * @param obj The pwmout object
     99 * @param ms  The floating-point pulsewidth in miliseconds
     100 */
     101void pwmout_pulsewidth_ms(pwmout_t *obj, int ms);
     102
     103/** Set the PWM pulsewidth specified in microseconds, keeping the period the same.
     104 *
     105 * @param obj The pwmout object
     106 * @param us  The floating-point pulsewidth in microseconds
     107 */
     108void pwmout_pulsewidth_us(pwmout_t *obj, int us);
     109
     110/**@}*/
    42111
    43112#ifdef __cplusplus
     
    48117
    49118#endif
     119
     120/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/rtc_api.h

    r321 r429  
    1414 * limitations under the License.
    1515 */
     16
     17/** \addtogroup hal */
     18/** @{*/
     19
    1620#ifndef MBED_RTC_API_H
    1721#define MBED_RTC_API_H
    1822
    1923#include "device.h"
    20 
    21 #if DEVICE_RTC
    2224
    2325#include <time.h>
     
    2729#endif
    2830
     31/**
     32 * \defgroup hal_rtc RTC hal
     33 *
     34 * The RTC hal provides a low level interface to the Real Time Counter (RTC) of a
     35 * target.
     36 *
     37 * # Defined behaviour
     38 * * The function ::rtc_init is safe to call repeatedly - Verified by test ::rtc_init_test.
     39 * * RTC accuracy is at least 10% - Verified by test ::rtc_accuracy_test.
     40 * * Init/free doesn't stop RTC from counting - Verified by test ::rtc_persist_test.
     41 * * Software reset doesn't stop RTC from counting - Verified by test ::rtc_reset_test.
     42 * * Sleep modes don't stop RTC from counting - Verified by test ::rtc_sleep_test.
     43 * * Shutdown mode doesn't stop RTC from counting - Not verified.
     44 * * The functions ::rtc_write/::rtc_read provides availability to set/get RTC time
     45 * - Verified by test ::rtc_write_read_test.
     46 * * The functions ::rtc_isenabled returns 1 if the RTC is counting and the time has been set,
     47 * 0 otherwise - Verified by test ::rtc_enabled_test.
     48 *
     49 * # Undefined behaviour
     50 * * Calling any function other than ::rtc_init before the initialisation of the RTC
     51 *
     52 * # Potential bugs
     53 * * Incorrect overflow handling - Verified by ::rtc_range_test
     54 * * Glitches due to ripple counter - Verified by ::rtc_glitch_test
     55 *
     56 * @see hal_rtc_tests
     57 *
     58 * @{
     59 */
     60
     61/**
     62 * \defgroup hal_rtc_tests RTC hal tests
     63 * The RTC test validate proper implementation of the RTC hal.
     64 *
     65 * To run the RTC hal tests use the command:
     66 *
     67 *     mbed test -t <toolchain> -m <target> -n tests-mbed_hal-rtc*
     68 */
     69
     70
     71/** Initialize the RTC peripheral
     72 *
     73 * Powerup the RTC in perpetration for access. This function must be called
     74 * before any other RTC functions ares called. This does not change the state
     75 * of the RTC. It just enables access to it.
     76 *
     77 * @note This function is safe to call repeatedly - Tested by ::rtc_init_test
     78 *
     79 * Example Implementation Pseudo Code:
     80 * @code
     81 * void rtc_init()
     82 * {
     83 *     // Enable clock gate so processor can read RTC registers
     84 *     POWER_CTRL |= POWER_CTRL_RTC_Msk;
     85 *
     86 *     // See if the RTC is already setup
     87 *     if (!(RTC_STATUS & RTC_STATUS_COUNTING_Msk)) {
     88 *
     89 *         // Setup the RTC clock source
     90 *         RTC_CTRL |= RTC_CTRL_CLK32_Msk;
     91 *     }
     92 * }
     93 * @endcode
     94 */
    2995void rtc_init(void);
     96
     97/** Deinitialize RTC
     98 *
     99 * Powerdown the RTC in preparation for sleep, powerdown or reset. That should only
     100 * affect the CPU domain and not the time keeping logic.
     101 * After this function is called no other RTC functions should be called
     102 * except for ::rtc_init.
     103 *
     104 * @note This function does not stop the RTC from counting - Tested by ::rtc_persist_test
     105 *
     106 * Example Implementation Pseudo Code:
     107 * @code
     108 * void rtc_free()
     109 * {
     110 *     // Disable clock gate since processor no longer needs to read RTC registers
     111 *     POWER_CTRL &= ~POWER_CTRL_RTC_Msk;
     112 * }
     113 * @endcode
     114 */
    30115void rtc_free(void);
     116
     117/** Check if the RTC has the time set and is counting
     118 *
     119 * @retval 0 The time reported by the RTC is not valid
     120 * @retval 1 The time has been set the RTC is counting
     121 *
     122 * Example Implementation Pseudo Code:
     123 * @code
     124 * int rtc_isenabled()
     125 * {
     126 *     if (RTC_STATUS & RTC_STATUS_COUNTING_Msk) {
     127 *         return 1;
     128 *     } else {
     129 *         return 0;
     130 *     }
     131 * }
     132 * @endcode
     133 */
    31134int rtc_isenabled(void);
    32135
     136/** Get the current time from the RTC peripheral
     137 *
     138 * @return The current time in seconds
     139 *
     140 * @note Some RTCs are not synchronized with the main clock. If
     141 * this is the case with your RTC then you must read the RTC time
     142 * in a loop to prevent reading the wrong time due to a glitch.
     143 * The test ::rtc_glitch_test is intended to catch this bug.
     144 *
     145 * Example implementation for an unsynchronized ripple counter:
     146 * @code
     147 * time_t rtc_read()
     148 * {
     149 *     uint32_t val;
     150 *     uint32_t last_val;
     151 *
     152 *     // Loop until the same value is read twice
     153 *     val = RTC_SECONDS;
     154 *     do {
     155 *         last_val = val;
     156 *         val = RTC_SECONDS;
     157 *     } while (last_val != val);
     158 *
     159 *     return (time_t)val;
     160 * }
     161 * @endcode
     162 */
    33163time_t rtc_read(void);
     164
     165/** Write the current time in seconds to the RTC peripheral
     166 *
     167 * @param t The current time to be set in seconds.
     168 *
     169 * Example Implementation Pseudo Code:
     170 * @code
     171 * void rtc_write(time_t t)
     172 * {
     173 *     RTC_SECONDS = t;
     174 * }
     175 * @endcode
     176 */
    34177void rtc_write(time_t t);
     178
     179/**@}*/
    35180
    36181#ifdef __cplusplus
     
    40185#endif
    41186
    42 #endif
     187/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/serial_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    1821
    1922#include "device.h"
    20 #include "buffer.h"
    21 #include "dma_api.h"
     23#include "hal/buffer.h"
     24#include "hal/dma_api.h"
    2225
    2326#if DEVICE_SERIAL
     
    8184
    8285#if DEVICE_SERIAL_ASYNCH
    83 /** Asynch serial hal structure
     86/** Asynch serial HAL structure
    8487 */
    8588typedef struct {
    8689    struct serial_s serial;  /**< Target specific serial structure */
    87     struct buffer_s tx_buff; /**< Tx buffer */
    88     struct buffer_s rx_buff; /**< Rx buffer */
     90    struct buffer_s tx_buff; /**< TX buffer */
     91    struct buffer_s rx_buff; /**< RX buffer */
    8992    uint8_t char_match;      /**< Character to be matched */
    9093    uint8_t char_found;      /**< State of the matched character */
     
    9295
    9396#else
    94 /** Non-asynch serial hal structure
     97/** Non-asynch serial HAL structure
    9598 */
    9699typedef struct serial_s serial_t;
     
    103106
    104107/**
    105  * \defgroup GeneralSerial Serial Configuration Functions
     108 * \defgroup hal_GeneralSerial Serial Configuration Functions
    106109 * @{
    107110 */
    108111
    109112/** Initialize the serial peripheral. It sets the default parameters for serial
    110  *  peripheral, and configure its specifieds pins.
    111  *
    112  * @param obj The serial object
    113  * @param tx  The TX pin
    114  * @param rx  The RX pin
     113 *  peripheral, and configures its specifieds pins.
     114 *
     115 * @param obj The serial object
     116 * @param tx  The TX pin name
     117 * @param rx  The RX pin name
    115118 */
    116119void serial_init(serial_t *obj, PinName tx, PinName rx);
     
    139142void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits);
    140143
    141 /** The serial interrupt handler registration.
     144/** The serial interrupt handler registration
    142145 *
    143146 * @param obj     The serial object
    144  * @param handler The interrupt handler which will be invoked when interrupt fires.
     147 * @param handler The interrupt handler which will be invoked when the interrupt fires
    145148 * @param id      The SerialBase object
    146149 */
     
    161164int  serial_getc(serial_t *obj);
    162165
    163 /** Put a character. This is a blocking call, waiting for a peripheral to be available
     166/** Send a character. This is a blocking call, waiting for a peripheral to be available
    164167 *  for writing
    165168 *
     
    172175 *
    173176 * @param obj The serial object
    174  * @return Non-zero value if a character can be read, 0 if nothing to read.
     177 * @return Non-zero value if a character can be read, 0 if nothing to read
    175178 */
    176179int  serial_readable(serial_t *obj);
     
    203206/** Configure the TX pin for UART function.
    204207 *
    205  * @param tx The pin used for TX
     208 * @param tx The pin name used for TX
    206209 */
    207210void serial_pinout_tx(PinName tx);
     
    212215 * @param obj    The serial object
    213216 * @param type   The type of the flow control. Look at the available FlowControl types.
    214  * @param rxflow The tx pin
    215  * @param txflow The rx pin
     217 * @param rxflow The TX pin name
     218 * @param txflow The RX pin name
    216219 */
    217220void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow);
     
    222225
    223226/**
    224  * \defgroup AsynchSerial Asynchronous Serial Hardware Abstraction Layer
     227 * \defgroup hal_AsynchSerial Asynchronous Serial Hardware Abstraction Layer
    225228 * @{
    226229 */
     
    230233 *
    231234 * @param obj       The serial object
    232  * @param tx        The buffer for sending
    233  * @param tx_length The number of words to transmit
    234  * @param tx_width  The bit width of buffer word
     235 * @param tx        The transmit buffer
     236 * @param tx_length The number of bytes to transmit
     237 * @param tx_width  Deprecated argument
    235238 * @param handler   The serial handler
    236239 * @param event     The logical OR of events to be registered
    237240 * @param hint      A suggestion for how to use DMA with this transfer
    238  * @return Returns number of data transfered, or 0 otherwise
     241 * @return Returns number of data transfered, otherwise returns 0
    239242 */
    240243int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint);
     
    244247 *
    245248 * @param obj        The serial object
    246  * @param rx         The buffer for sending
    247  * @param rx_length  The number of words to transmit
    248  * @param rx_width   The bit width of buffer word
     249 * @param rx         The receive buffer
     250 * @param rx_length  The number of bytes to receive
     251 * @param rx_width   Deprecated argument
    249252 * @param handler    The serial handler
    250253 * @param event      The logical OR of events to be registered
     
    272275 *
    273276 * @param obj The serial object
    274  * @return Returns event flags if a RX transfer termination condition was met or 0 otherwise
     277 * @return Returns event flags if an RX transfer termination condition was met; otherwise returns 0
    275278 */
    276279int serial_irq_handler_asynch(serial_t *obj);
    277280
    278281/** Abort the ongoing TX transaction. It disables the enabled interupt for TX and
    279  *  flush TX hardware buffer if TX FIFO is used
     282 *  flushes the TX hardware buffer if TX FIFO is used
    280283 *
    281284 * @param obj The serial object
     
    283286void serial_tx_abort_asynch(serial_t *obj);
    284287
    285 /** Abort the ongoing RX transaction It disables the enabled interrupt for RX and
    286  *  flush RX hardware buffer if RX FIFO is used
     288/** Abort the ongoing RX transaction. It disables the enabled interrupt for RX and
     289 *  flushes the RX hardware buffer if RX FIFO is used
    287290 *
    288291 * @param obj The serial object
     
    301304
    302305#endif
     306
     307/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/sleep_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    2528#endif
    2629
     30/**
     31 * \defgroup hal_sleep sleep hal requirements
     32 * Low level interface to the sleep mode of a target.
     33 *
     34 * # Defined behaviour
     35 *
     36 * * Sleep mode
     37 *   * wake-up time should be less than 10 us - Verified by sleep_usticker_test().
     38 *   * the processor can be woken up by any internal peripheral interrupt  - Verified by sleep_usticker_test().
     39 *   * all peripherals operate as in run mode - not verified.
     40 *   * the processor can be woken up by external pin interrupt - not verified.
     41 * * Deep sleep
     42 *   * the wake-up time should be less than 10 ms - Verified by deepsleep_lpticker_test().
     43 *   * lp ticker should wake up a target from this mode - Verified by deepsleep_lpticker_test().
     44 *   * RTC should wake up a target from this mode - not verified.
     45 *   * an external interrupt on a pin should wake up a target from this mode - not verified.
     46 *   * a watchdog timer should wake up a target from this mode - not verified.
     47 *   * High-speed clocks are turned off - Verified by deepsleep_high_speed_clocks_turned_off_test().
     48 *   * RTC keeps time - Verified by rtc_sleep_test().
     49 *
     50 * # Undefined behaviour
     51 *
     52 * * peripherals aside from RTC, GPIO and lp ticker result in undefined behaviour in deep sleep.
     53 * @{
     54 */
     55
     56/**
     57 * \defgroup hal_sleep_tests sleep hal tests
     58 * The sleep HAL tests ensure driver conformance to defined behaviour.
     59 *
     60 * To run the sleep hal tests use the command:
     61 *
     62 *     mbed test -t <toolchain> -m <target> -n tests-mbed_hal-sleep*
     63 *
     64 */
     65
    2766/** Send the microcontroller to sleep
    2867 *
    29  * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
     68 * The processor is setup ready for sleep, and sent to sleep. In this mode, the
    3069 * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
    3170 * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
     
    3473 * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
    3574 *
    36  * @note
    37  *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
    38  * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
    39  * able to access the LocalFileSystem
     75 * The wake-up time shall be less than 10 us.
     76 *
    4077 */
    41 void sleep(void);
     78void hal_sleep(void);
    4279
    4380/** Send the microcontroller to deep sleep
    4481 *
    4582 * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
    46  * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
    47  * is still maintained.
     83 * has the same sleep features as sleep plus it powers down peripherals and high frequency clocks.
     84 * All state is still maintained.
    4885 *
    49  * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
     86 * The processor can only be woken up by low power ticker, RTC, an external interrupt on a pin or a watchdog timer.
    5087 *
    51  * @note
    52  *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
    53  * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
    54  * able to access the LocalFileSystem
     88 * The wake-up time shall be less than 10 ms.
    5589 */
    56 void deepsleep(void);
     90void hal_deepsleep(void);
     91
     92/**@}*/
    5793
    5894#ifdef __cplusplus
     
    6399
    64100#endif
     101
     102/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/spi_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2013 ARM Limited
     
    1821
    1922#include "device.h"
    20 #include "dma_api.h"
    21 #include "buffer.h"
     23#include "hal/dma_api.h"
     24#include "hal/buffer.h"
    2225
    2326#if DEVICE_SPI
     
    2831#define SPI_EVENT_ALL         (SPI_EVENT_ERROR | SPI_EVENT_COMPLETE | SPI_EVENT_RX_OVERFLOW)
    2932
    30 #define SPI_EVENT_INTERNAL_TRANSFER_COMPLETE (1 << 30) // internal flag to report an event occurred
     33#define SPI_EVENT_INTERNAL_TRANSFER_COMPLETE (1 << 30) // Internal flag to report that an event occurred
    3134
    3235#define SPI_FILL_WORD         (0xFFFF)
     36#define SPI_FILL_CHAR         (0xFF)
    3337
    3438#if DEVICE_SPI_ASYNCH
    35 /** Asynch spi hal structure
     39/** Asynch SPI HAL structure
    3640 */
    3741typedef struct {
    38     struct spi_s spi;        /**< Target specific spi structure */
     42    struct spi_s spi;        /**< Target specific SPI structure */
    3943    struct buffer_s tx_buff; /**< Tx buffer */
    4044    struct buffer_s rx_buff; /**< Rx buffer */
     
    4246
    4347#else
    44 /** Non-asynch spi hal structure
     48/** Non-asynch SPI HAL structure
    4549 */
    4650typedef struct spi_s spi_t;
     
    5357
    5458/**
    55  * \defgroup GeneralSPI SPI Configuration Functions
     59 * \defgroup hal_GeneralSPI SPI Configuration Functions
    5660 * @{
    5761 */
     
    8286/** Configure the SPI format
    8387 *
    84  * Set the number of bits per frame, configure clock polarity and phase, shift order and master/slave mode
     88 * Set the number of bits per frame, configure clock polarity and phase, shift order and master/slave mode.
     89 * The default bit order is MSB.
    8590 * @param[in,out] obj   The SPI object to configure
    8691 * @param[in]     bits  The number of bits per frame
     
    113118int  spi_master_write(spi_t *obj, int value);
    114119
     120/** Write a block out in master mode and receive a value
     121 *
     122 *  The total number of bytes sent and received will be the maximum of
     123 *  tx_length and rx_length. The bytes written will be padded with the
     124 *  value 0xff.
     125 *
     126 * @param[in] obj        The SPI peripheral to use for sending
     127 * @param[in] tx_buffer  Pointer to the byte-array of data to write to the device
     128 * @param[in] tx_length  Number of bytes to write, may be zero
     129 * @param[in] rx_buffer  Pointer to the byte-array of data to read from the device
     130 * @param[in] rx_length  Number of bytes to read, may be zero
     131 * @param[in] write_fill Default data transmitted while performing a read
     132 * @returns
     133 *      The number of bytes written and read from the device. This is
     134 *      maximum of tx_length and rx_length.
     135 */
     136int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, char write_fill);
     137
    115138/** Check if a value is available to read
    116139 *
     
    160183/** Begin the SPI transfer. Buffer pointers and lengths are specified in tx_buff and rx_buff
    161184 *
    162  * @param[in] obj       The SPI object which holds the transfer information
    163  * @param[in] tx        The buffer to send
    164  * @param[in] tx_length The number of words to transmit
    165  * @param[in] rx        The buffer to receive
    166  * @param[in] rx_length The number of words to receive
     185 * @param[in] obj       The SPI object that holds the transfer information
     186 * @param[in] tx        The transmit buffer
     187 * @param[in] tx_length The number of bytes to transmit
     188 * @param[in] rx        The receive buffer
     189 * @param[in] rx_length The number of bytes to receive
    167190 * @param[in] bit_width The bit width of buffer words
    168191 * @param[in] event     The logical OR of events to be registered
     
    176199 * Reads the received values out of the RX FIFO, writes values into the TX FIFO and checks for transfer termination
    177200 * conditions, such as buffer overflows or transfer complete.
    178  * @param[in] obj     The SPI object which holds the transfer information
    179  * @return event flags if a transfer termination condition was met or 0 otherwise.
     201 * @param[in] obj     The SPI object that holds the transfer information
     202 * @return Event flags if a transfer termination condition was met; otherwise 0.
    180203 */
    181204uint32_t spi_irq_handler_asynch(spi_t *obj);
    182205
    183 /** Attempts to determine if the SPI peripheral is already in use.
     206/** Attempts to determine if the SPI peripheral is already in use
    184207 *
    185208 * If a temporary DMA channel has been allocated, peripheral is in use.
     
    190213 * there are any bytes in the FIFOs.
    191214 * @param[in] obj The SPI object to check for activity
    192  * @return non-zero if the SPI port is active or zero if it is not.
     215 * @return Non-zero if the SPI port is active or zero if it is not.
    193216 */
    194217uint8_t spi_active(spi_t *obj);
     
    212235
    213236#endif // MBED_SPI_API_H
     237
     238/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/ticker_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2015 ARM Limited
     
    1720#define MBED_TICKER_API_H
    1821
     22#include <stdint.h>
     23#include <stdbool.h>
    1924#include "device.h"
    2025
     26/**
     27 * Legacy format representing a timestamp in us.
     28 * Given it is modeled as a 32 bit integer, this type can represent timestamp
     29 * up to 4294 seconds (71 minutes).
     30 * Prefer using us_timestamp_t which store timestamp as 64 bits integer.
     31 */
    2132typedef uint32_t timestamp_t;
    2233
     34/**
     35 * A us timestamp stored in a 64 bit integer.
     36 * Can store timestamp up to 584810 years.
     37 */
     38typedef uint64_t us_timestamp_t;
     39
    2340/** Ticker's event structure
    2441 */
    2542typedef struct ticker_event_s {
    26     timestamp_t            timestamp; /**< Event's timestamp */
     43    us_timestamp_t         timestamp; /**< Event's timestamp */
    2744    uint32_t               id;        /**< TimerEvent object */
    2845    struct ticker_event_s *next;      /**< Next event in the queue */
     
    3047
    3148typedef void (*ticker_event_handler)(uint32_t id);
     49
     50/** Information about the ticker implementation
     51 */
     52typedef struct {
     53    uint32_t frequency;                           /**< Frequency in Hz this ticker runs at */
     54    uint32_t bits;                                /**< Number of bits this ticker supports */
     55} ticker_info_t;
     56
    3257
    3358/** Ticker's interface structure - required API for a ticker
     
    3964    void (*clear_interrupt)(void);                /**< Clear interrupt function */
    4065    void (*set_interrupt)(timestamp_t timestamp); /**< Set interrupt function */
     66    void (*fire_interrupt)(void);                 /**< Fire interrupt right-away */
     67    void (*free)(void);                           /**< Disable function */
     68    const ticker_info_t *(*get_info)(void);       /**< Return info about this ticker's implementation */
    4169} ticker_interface_t;
    4270
    43 /** Tickers events queue structure
     71/** Ticker's event queue structure
    4472 */
    4573typedef struct {
    4674    ticker_event_handler event_handler; /**< Event handler */
    4775    ticker_event_t *head;               /**< A pointer to head */
     76    uint32_t frequency;                 /**< Frequency of the timer in Hz */
     77    uint32_t bitmask;                   /**< Mask to be applied to time values read */
     78    uint32_t max_delta;                 /**< Largest delta in ticks that can be used when scheduling */
     79    uint64_t max_delta_us;              /**< Largest delta in us that can be used when scheduling */
     80    uint32_t tick_last_read;            /**< Last tick read */
     81    uint64_t tick_remainder;            /**< Ticks that have not been added to base_time */
     82    us_timestamp_t present_time;        /**< Store the timestamp used for present time */
     83    bool initialized;                   /**< Indicate if the instance is initialized */
     84    bool dispatching;                   /**< The function ticker_irq_handler is dispatching */
     85    bool suspended;                     /**< Indicate if the instance is suspended */
     86    uint8_t frequency_shifts;           /**< If frequency is a value of 2^n, this is n, otherwise 0 */
    4887} ticker_event_queue_t;
    4988
    50 /** Tickers data structure
     89/** Ticker's data structure
    5190 */
    5291typedef struct {
    5392    const ticker_interface_t *interface; /**< Ticker's interface */
    54     ticker_event_queue_t *queue;         /**< Ticker's events queue */
     93    ticker_event_queue_t *queue;         /**< Ticker's event queue */
    5594} ticker_data_t;
    5695
     
    5998#endif
    6099
    61 /** Initialize a ticker and sets the event handler
    62  *
    63  * @param data    The ticker's data
     100/**
     101 * \defgroup hal_ticker Ticker HAL functions
     102 * @{
     103 */
     104
     105/** Initialize a ticker and set the event handler
     106 *
     107 * @param ticker The ticker object.
    64108 * @param handler A handler to be set
    65109 */
    66 void ticker_set_handler(const ticker_data_t *const data, ticker_event_handler handler);
    67 
    68 /** Irq handler which goes through the events to trigger events in the past.
    69  *
    70  * @param data    The ticker's data
    71  */
    72 void ticker_irq_handler(const ticker_data_t *const data);
     110void ticker_set_handler(const ticker_data_t *const ticker, ticker_event_handler handler);
     111
     112/** IRQ handler that goes through the events to trigger overdue events.
     113 *
     114 * @param ticker The ticker object.
     115 */
     116void ticker_irq_handler(const ticker_data_t *const ticker);
    73117
    74118/** Remove an event from the queue
    75119 *
    76  * @param data The ticker's data
    77  * @param obj  The event's queue to be removed
    78  */
    79 void ticker_remove_event(const ticker_data_t *const data, ticker_event_t *obj);
    80 
    81 /** Insert an event from the queue
    82  *
    83  * @param data      The ticker's data
    84  * @param obj       The event's queue to be removed
     120 * @param ticker The ticker object.
     121 * @param obj  The event object to be removed from the queue
     122 */
     123void ticker_remove_event(const ticker_data_t *const ticker, ticker_event_t *obj);
     124
     125/** Insert an event to the queue
     126 *
     127 * The event will be executed in timestamp - ticker_read().
     128 *
     129 * @warning This function does not consider timestamp in the past. If an event
     130 * is inserted with a timestamp less than the current timestamp then the event
     131 * will be executed in timestamp - ticker_read() us.
     132 * The internal counter wrap very quickly it is hard to decide weither an
     133 * event is in the past or in 1 hour.
     134 *
     135 * @note prefer the use of ticker_insert_event_us which allows registration of
     136 * absolute timestamp.
     137 *
     138 * @param ticker    The ticker object.
     139 * @param obj       The event object to be inserted to the queue
    85140 * @param timestamp The event's timestamp
    86141 * @param id        The event object
    87142 */
    88 void ticker_insert_event(const ticker_data_t *const data, ticker_event_t *obj, timestamp_t timestamp, uint32_t id);
    89 
    90 /** Read the current ticker's timestamp
    91  *
    92  * @param data The ticker's data
     143void ticker_insert_event(const ticker_data_t *const ticker, ticker_event_t *obj, timestamp_t timestamp, uint32_t id);
     144
     145/** Insert an event to the queue
     146 *
     147 * The event will be executed in timestamp - ticker_read_us() us.
     148 *
     149 * @note If an event is inserted with a timestamp less than the current
     150 * timestamp then the event will be scheduled immediately resulting in
     151 * an instant call to event handler.
     152 *
     153 * @param ticker    The ticker object.
     154 * @param obj       The event object to be inserted to the queue
     155 * @param timestamp The event's timestamp
     156 * @param id        The event object
     157 */
     158void ticker_insert_event_us(const ticker_data_t *const ticker, ticker_event_t *obj, us_timestamp_t timestamp, uint32_t id);
     159
     160/** Read the current (relative) ticker's timestamp
     161 *
     162 * @warning Return a relative timestamp because the counter wrap every 4294
     163 * seconds.
     164 *
     165 * @param ticker The ticker object.
    93166 * @return The current timestamp
    94167 */
    95 timestamp_t ticker_read(const ticker_data_t *const data);
     168timestamp_t ticker_read(const ticker_data_t *const ticker);
     169
     170/** Read the current (absolute) ticker's timestamp
     171 *
     172 * @warning Return an absolute timestamp counting from the initialization of the
     173 * ticker.
     174 *
     175 * @param ticker The ticker object.
     176 * @return The current timestamp
     177 */
     178us_timestamp_t ticker_read_us(const ticker_data_t *const ticker);
    96179
    97180/** Read the next event's timestamp
    98181 *
    99  * @param data The ticker's data
     182 * @param ticker        The ticker object.
     183 * @param timestamp     The timestamp object.
    100184 * @return 1 if timestamp is pending event, 0 if there's no event pending
    101185 */
    102 int ticker_get_next_timestamp(const ticker_data_t *const data, timestamp_t *timestamp);
     186int ticker_get_next_timestamp(const ticker_data_t *const ticker, timestamp_t *timestamp);
     187
     188/** Suspend this ticker
     189 *
     190 * When suspended reads will always return the same time and no
     191 * events will be dispatched. When suspended the common layer
     192 * will only ever call the interface function clear_interrupt()
     193 * and that is only if ticker_irq_handler is called.
     194 *
     195 *
     196 * @param ticker        The ticker object.
     197 */
     198void ticker_suspend(const ticker_data_t *const ticker);
     199
     200/** Resume this ticker
     201 *
     202 * When resumed the ticker will ignore any time that has passed
     203 * and continue counting up where it left off.
     204 *
     205 * @param ticker        The ticker object.
     206 */
     207void ticker_resume(const ticker_data_t *const ticker);
     208
     209/* Private functions
     210 *
     211 * @cond PRIVATE
     212 *
     213 */
     214
     215int _ticker_match_interval_passed(timestamp_t prev_tick, timestamp_t cur_tick, timestamp_t match_tick);
     216
     217/*
     218 * @endcond PRIVATE
     219 *
     220 */
     221
     222/**@}*/
    103223
    104224#ifdef __cplusplus
     
    107227
    108228#endif
     229
     230/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/us_ticker_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2015 ARM Limited
     
    1821
    1922#include <stdint.h>
    20 #include "ticker_api.h"
     23#include "hal/ticker_api.h"
    2124
    2225#ifdef __cplusplus
     
    2528
    2629/**
    27  * \defgroup UsTicker Microseconds Ticker Functions
     30 * \defgroup hal_us_ticker Microsecond Ticker
     31 * Low level interface to the microsecond ticker of a target
     32 *
     33 * # Defined behavior
     34 * * Has a reported frequency between 250KHz and 8MHz - Verified by test ::us_ticker_info_test
     35 * * Has a counter that is at least 16 bits wide - Verified by test ::us_ticker_info_test
     36 * * All behavior defined by the @ref hal_ticker_shared "ticker specification"
     37 *
     38 * # Undefined behavior
     39 * * See the @ref hal_ticker_shared "ticker specification"
     40 *
     41 * @see hal_us_ticker_tests
     42 *
    2843 * @{
    2944 */
    3045
     46/**
     47 * \defgroup hal_us_ticker_tests Microsecond Ticker tests
     48 * Tests to validate the proper implementation of the microsecond ticker
     49 *
     50 * To run the microsecond ticker hal tests use the command:
     51 *
     52 *     mbed test -t <toolchain> -m <target> -n tests-mbed_hal-common_ticker*,tests-mbed_hal-us_ticker*
     53 *
     54 * @see hal_ticker_tests
     55 *
     56 */
     57
     58/**
     59 * \defgroup hal_ticker_shared Ticker Hal
     60 * Low level interface to the ticker of a target
     61 *
     62 * # Defined behavior
     63 * * The function ticker_init is safe to call repeatedly - Verified by test ::ticker_init_test
     64 * * The function ticker_init allows the ticker to keep counting and disables the ticker interrupt - Verified by test ::ticker_init_test
     65 * * Ticker frequency is non-zero and counter is at least 8 bits - Verified by ::ticker_info_test
     66 * * The ticker rolls over at (1 << bits) and continues counting starting from 0 - Verified by ::ticker_overflow_test
     67 * * The ticker counts at the specified frequency +- 10% - Verified by ::ticker_frequency_test
     68 * * The ticker increments by 1 each tick - Verified by ::ticker_increment_test
     69 * * The ticker interrupt fires only when the ticker times increments to or past the value set by ticker_set_interrupt.
     70 * Verified by ::ticker_interrupt_test and ::ticker_past_test
     71 * * It is safe to call ticker_set_interrupt repeatedly before the handler is called - Verified by ::ticker_repeat_reschedule_test
     72 * * The function ticker_fire_interrupt causes ticker_irq_handler to be called immediately from interrupt context -
     73 * Verified by ::ticker_fire_now_test
     74 * * The ticker operations ticker_read, ticker_clear_interrupt, ticker_set_interrupt and ticker_fire_interrupt
     75 * take less than 20us to complete - Verified by ::ticker_speed_test
     76 *
     77 * # Undefined behavior
     78 * * Calling any function other than ticker_init before the initialization of the ticker
     79 * * Whether ticker_irq_handler is called a second time if the time wraps and matches the value set by ticker_set_interrupt again
     80 * * Calling ticker_set_interrupt with a value that has more than the supported number of bits
     81 * * Calling any function other than us_ticker_init after calling us_ticker_free
     82 *
     83 * # Potential bugs
     84 * * Drift due to reschedule - Verified by ::ticker_repeat_reschedule_test
     85 * * Incorrect overflow handling of timers - Verified by ::ticker_overflow_test
     86 * * Interrupting at a time of 0 - Verified by ::ticker_overflow_test
     87 * * Interrupt triggered more than once - Verified by ::ticker_interrupt_test
     88 *
     89 * @ingroup hal_us_ticker
     90 * @ingroup hal_lp_ticker
     91 */
     92
     93/**
     94 * \defgroup hal_ticker_tests Ticker Tests
     95 * Tests to validate the proper implementation of a ticker
     96 *
     97 * To run the ticker hal tests use the command:
     98 *
     99 *     mbed test -t <toolchain> -m <target> -n tests-mbed_hal-common_ticker*
     100 *
     101 * @ingroup hal_us_ticker
     102 * @ingroup hal_lp_ticker
     103 */
     104
     105
     106typedef void (*ticker_irq_handler_type)(const ticker_data_t *const);
     107
     108/** Set ticker IRQ handler
     109 *
     110 * @param ticker_irq_handler IRQ handler to be connected
     111 *
     112 * @return previous ticker IRQ handler
     113 *
     114 * @note by default IRQ handler is set to ::ticker_irq_handler
     115 * @note this function is primarily for testing purposes and it's not required part of HAL implementation
     116 *
     117 */
     118ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler);
     119
    31120/** Get ticker's data
    32121 *
    33  * @return The low power ticker data
    34  */
    35 const ticker_data_t* get_us_ticker_data(void);
     122 * @return The microsecond ticker data
     123 */
     124const ticker_data_t *get_us_ticker_data(void);
    36125
    37126
     
    45134/** Initialize the ticker
    46135 *
     136 * Initialize or re-initialize the ticker. This resets all the
     137 * clocking and prescaler registers, along with disabling
     138 * the compare interrupt.
     139 *
     140 * @note Initialization properties tested by ::ticker_init_test
     141 *
     142 * Pseudo Code:
     143 * @code
     144 * void us_ticker_init()
     145 * {
     146 *     // Enable clock gate so processor can read TIMER registers
     147 *     POWER_CTRL |= POWER_CTRL_TIMER_Msk;
     148 *
     149 *     // Disable the timer and ensure it is powered down
     150 *     TIMER_CTRL &= ~(TIMER_CTRL_ENABLE_Msk | TIMER_CTRL_COMPARE_ENABLE_Msk);
     151 *
     152 *     // Configure divisors
     153 *     uint32_t prescale = SystemCoreClock / 1000000;
     154 *     TIMER_PRESCALE = prescale - 1;
     155 *     TIMER_CTRL |= TIMER_CTRL_ENABLE_Msk;
     156 *
     157 *     // Install the interrupt handler
     158 *     NVIC_SetVector(TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
     159 *     NVIC_EnableIRQ(TIMER_IRQn);
     160 * }
     161 * @endcode
    47162 */
    48163void us_ticker_init(void);
    49164
     165/** Deinitialize the us ticker
     166 *
     167 * Powerdown the us ticker in preparation for sleep, powerdown, or reset.
     168 *
     169 * After this function is called, no other ticker functions should be called
     170 * except us_ticker_init(), calling any function other than init is undefined.
     171 *
     172 * @note This function stops the ticker from counting.
     173 *
     174 * Pseudo Code:
     175 * @code
     176 * uint32_t us_ticker_free()
     177 * {
     178 *     // Disable timer
     179 *     TIMER_CTRL &= ~TIMER_CTRL_ENABLE_Msk;
     180 *
     181 *     // Disable the compare interrupt
     182 *     TIMER_CTRL &= ~TIMER_CTRL_COMPARE_ENABLE_Msk;
     183 *
     184 *     // Disable timer interrupt
     185 *     NVIC_DisableIRQ(TIMER_IRQn);
     186 *
     187 *     // Disable clock gate so processor cannot read TIMER registers
     188 *     POWER_CTRL &= ~POWER_CTRL_TIMER_Msk;
     189 * }
     190 * @endcode
     191 *
     192 */
     193void us_ticker_free(void);
     194
    50195/** Read the current counter
    51196 *
    52  * @return The current timer's counter value in microseconds
     197 * Read the current counter value without performing frequency conversions.
     198 * If no rollover has occurred, the seconds passed since us_ticker_init()
     199 * was called can be found by dividing the ticks returned by this function
     200 * by the frequency returned by ::us_ticker_get_info.
     201 *
     202 * @return The current timer's counter value in ticks
     203 *
     204 * Pseudo Code:
     205 * @code
     206 * uint32_t us_ticker_read()
     207 * {
     208 *     return TIMER_COUNT;
     209 * }
     210 * @endcode
    53211 */
    54212uint32_t us_ticker_read(void);
     
    56214/** Set interrupt for specified timestamp
    57215 *
    58  * @param timestamp The time in microseconds to be set
     216 * @param timestamp The time in ticks to be set
     217 *
     218 * @note no special handling needs to be done for times in the past
     219 * as the common timer code will detect this and call
     220 * us_ticker_fire_interrupt() if this is the case
     221 *
     222 * @note calling this function with timestamp of more than the supported
     223 * number of bits returned by ::us_ticker_get_info results in undefined
     224 * behavior.
     225 *
     226 * Pseudo Code:
     227 * @code
     228 * void us_ticker_set_interrupt(timestamp_t timestamp)
     229 * {
     230 *     TIMER_COMPARE = timestamp;
     231 *     TIMER_CTRL |= TIMER_CTRL_COMPARE_ENABLE_Msk;
     232 * }
     233 * @endcode
    59234 */
    60235void us_ticker_set_interrupt(timestamp_t timestamp);
     
    62237/** Disable us ticker interrupt
    63238 *
     239 * Pseudo Code:
     240 * @code
     241 * void us_ticker_disable_interrupt(void)
     242 * {
     243 *     // Disable the compare interrupt
     244 *     TIMER_CTRL &= ~TIMER_CTRL_COMPARE_ENABLE_Msk;
     245 * }
     246 * @endcode
    64247 */
    65248void us_ticker_disable_interrupt(void);
     
    67250/** Clear us ticker interrupt
    68251 *
     252 * Pseudo Code:
     253 * @code
     254 * void us_ticker_clear_interrupt(void)
     255 * {
     256 *     // Write to the ICR (interrupt clear register) of the TIMER
     257 *     TIMER_ICR = TIMER_ICR_COMPARE_Msk;
     258 * }
     259 * @endcode
    69260 */
    70261void us_ticker_clear_interrupt(void);
     262
     263/** Set pending interrupt that should be fired right away.
     264 *
     265 * The ticker should be initialized prior calling this function.
     266 *
     267 * Pseudo Code:
     268 * @code
     269 * void us_ticker_fire_interrupt(void)
     270 * {
     271 *     NVIC_SetPendingIRQ(TIMER_IRQn);
     272 * }
     273 * @endcode
     274 */
     275void us_ticker_fire_interrupt(void);
     276
     277/** Get frequency and counter bits of this ticker.
     278 *
     279 * Pseudo Code:
     280 * @code
     281 * const ticker_info_t* us_ticker_get_info()
     282 * {
     283 *     static const ticker_info_t info = {
     284 *         1000000,    // 1 MHz
     285 *         32          // 32 bit counter
     286 *     };
     287 *     return &info;
     288 * }
     289 * @endcode
     290 */
     291const ticker_info_t *us_ticker_get_info(void);
    71292
    72293/**@}*/
     
    77298
    78299#endif
     300
     301/** @}*/
  • EcnlProtoTool/trunk/asp3_dcre/sample/Makefile

    r331 r429  
    66#  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77#                              Toyohashi Univ. of Technology, JAPAN
    8 #  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     8#  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    99#              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    9191
    9292#
     93#  TECS関係ファイルのディレクトリの定義
     94#
     95TECSDIR = @(TECSDIR)
     96
     97#
    9398#  トレースログを取得するかどうかの定義
    9499#
     
    119124
    120125#
    121 #  依存関係ファイルを置くディレクトリの定義
    122 #
    123 DEPDIR = @(DEPDIR)
     126#  中間オブジェクトファイルと依存関係ファイルを置くディレクトリの定義
     127#
     128OBJDIR = @(OBJDIR)
     129DEPDIR = @(OBJDIR)
    124130
    125131#
     
    149155        -include $(TECSGENDIR)/Makefile.tecsgen
    150156endif
     157
     158TINETDIR =
    151159
    152160#
     
    191199        APPL_COBJS := @(APPLOBJS)
    192200endif
    193 APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o
     201APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o mbed_stub.o
    194202APPL_CFLAGS := $(APPL_CFLAGS)
    195203ifdef APPLDIRS
     
    197205endif
    198206
    199 #
    200 #  ネットワークサービスの定義
    201 #
    202 
    203 NO_USE_TINET_LIBRARY = true
    204 
    205 #  ネットワークインタフェースの選択、何れか一つ選択する。
    206 
    207 NET_IF = ether
    208 
    209 #  イーサネット・ディバイスドライバの選択
    210 
    211 NET_DEV = if_mbed
    212 
    213 #  ネットワーク層の選択
    214 
    215 #SUPPORT_INET6 = true
    216 SUPPORT_INET4 = true
    217 
    218 #  API に組込む機能の選択
    219 
    220 #API_CFG_IP4MAPPED_ADDR = true
    221 
    222 #  トランスポート層の選択
    223 
    224 SUPPORT_TCP = true
    225 #SUPPORT_UDP = true
    226 
    227 #
    228 #  システムサービスの Makefile のインクルード
    229 #
    230 include $(SRCDIR)/tinet/Makefile.tinet
     207ifdef TINETDIR
     208        #
     209        #  ネットワークサービスの定義
     210        #
     211        NO_USE_TINET_LIBRARY = true
     212
     213        #  ネットワークインタフェースの選択、何れか一つ選択する。
     214        NET_IF = ether
     215
     216        #  イーサネット・ディバイスドライバの選択
     217        NET_DEV = if_mbed
     218
     219        #  ネットワーク層の選択
     220        #SUPPORT_INET6 = true
     221        SUPPORT_INET4 = true
     222
     223        #  API に組込む機能の選択
     224        #API_CFG_IP4MAPPED_ADDR = true
     225
     226        #  トランスポート層の選択
     227        SUPPORT_TCP = true
     228        #SUPPORT_UDP = true
     229
     230        # IGMPを有効に設定
     231        #SUPPORT_IGMP = true
     232
     233        #
     234        #  ネットワークサービスの Makefile のインクルード
     235        #
     236        include $(SRCDIR)/$(TINETDIR)/Makefile.tinet
     237endif
    231238
    232239#
     
    236243                                $(SYSSVC_DIRS) $(SRCDIR)/syssvc
    237244SYSSVC_ASMOBJS := $(SYSSVC_ASMOBJS)
    238 SYSSVC_COBJS := $(INIT_TECS_COBJ) $(TECS_COBJS) $(SYSSVC_COBJS) \
    239                                 @(SYSSVCOBJS) $(CXXRTS)
     245SYSSVC_COBJS := $(SYSSVC_COBJS) $(TECS_COBJS) \
     246                                $(INIT_TECS_COBJ) $(CXXRTS)
    240247SYSSVC_CFLAGS := $(SYSSVC_CFLAGS)
    241248INCLUDES := $(INCLUDES) -I$(TECSGENDIR) -I$(SRCDIR)/tecs_kernel
    242249
    243250#
     251#  トレースログ記録のサンプルコードに関する定義
     252#
     253ifdef ENABLE_TRACE
     254        COPTS := $(COPTS) -DTOPPERS_ENABLE_TRACE
     255        SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/arch/tracelog
     256endif
     257
     258#
    244259#  ターゲットファイル
    245260#
    246261.PHONY: all
    247262ifndef OMIT_TECS
    248 all: tecs
     263all: tecs | $(DEPDIR)
    249264#       @$(MAKE) check
    250265        @$(MAKE) check $(OBJNAME).bin
     
    261276#  コンフィギュレータに関する定義
    262277#
    263 CFG_TABS := --api-table $(SRCDIR)/tinet/tcpip_api.def:tcpip \
     278CFG_KERNEL := --kernel asp
     279ifndef TINETDIR
     280  CFG_TRB := -T $(TARGETDIR)/target_kernel.trb
     281  CFG_TABS := --api-table $(SRCDIR)/kernel/kernel_api.def \
     282                        --symval-table $(SRCDIR)/kernel/kernel_sym.def $(CFG_TABS)
     283else
     284  CFG_TRB := -T $(TINET_ROOT)/tinet.trb:tcpip -T $(TARGETDIR)/target_kernel.trb:kernel
     285  CFG_TABS := --api-table $(TINET_ROOT)/tcpip_api.def:tcpip \
    264286                        --api-table $(SRCDIR)/kernel/kernel_api.def:kernel \
    265                         --symval-table $(SRCDIR)/tinet/tcpip_sym.def \
     287                        --symval-table $(TINET_ROOT)/tcpip_sym.def \
    266288                        --symval-table $(SRCDIR)/kernel/kernel_sym.def $(CFG_TABS)
     289endif
    267290CFG_ASMOBJS := $(CFG_ASMOBJS)
    268291CFG_COBJS := kernel_cfg.o $(CFG_COBJS)
    269 CFG_OBJS := $(CFG_ASMOBJS) $(CFG_COBJS)
     292CFG_CFLAGS := -DTOPPERS_CB_TYPE_ONLY $(CFG_CFLAGS)
     293
    270294CFG2_OUT_SRCS := kernel_cfg.h kernel_cfg.c $(CFG2_OUT_SRCS)
    271 CFG_CFLAGS := -DTOPPERS_CB_TYPE_ONLY $(CFG_CFLAGS)
    272295
    273296#
     
    300323                                        $(foreach file,$(KERNEL_FCSRCS),$(file:.c=.o))
    301324endif
    302 ifdef OMIT_OFFSET_H
    303         OFFSET_H =
    304 else
     325ifdef TARGET_OFFSET_TRB
    305326        OFFSET_H = offset.h
    306327endif
     
    318339endif
    319340ifndef TARGET_TCPIP_TRB
    320         TARGET_TCPIP_TRB := $(SRCDIR)/tinet/tinet.trb
     341        TARGET_TCPIP_TRB := $(SRCDIR)/$(TINETDIR)/tinet.trb
    321342endif
    322343
     
    330351
    331352#
     353#  中間オブジェクトファイルを置くディレクトリの処理
     354#
     355APPL_ASMOBJS   := $(addprefix $(OBJDIR)/, $(APPL_ASMOBJS))
     356APPL_CXXOBJS   := $(addprefix $(OBJDIR)/, $(APPL_CXXOBJS))
     357APPL_COBJS     := $(addprefix $(OBJDIR)/, $(APPL_COBJS))
     358SYSSVC_ASMOBJS := $(addprefix $(OBJDIR)/, $(SYSSVC_ASMOBJS))
     359SYSSVC_COBJS   := $(addprefix $(OBJDIR)/, $(SYSSVC_COBJS))
     360KERNEL_ASMOBJS := $(addprefix $(OBJDIR)/, $(KERNEL_ASMOBJS))
     361KERNEL_COBJS   := $(addprefix $(OBJDIR)/, $(KERNEL_COBJS))
     362KERNEL_LCOBJS  := $(addprefix $(OBJDIR)/, $(KERNEL_LCOBJS))
     363CFG_ASMOBJS    := $(addprefix $(OBJDIR)/, $(CFG_ASMOBJS))
     364CFG_COBJS      := $(addprefix $(OBJDIR)/, $(CFG_COBJS))
     365
     366#
    332367#  コンパイルのための変数の定義
    333368#
     369APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS)
     370SYSSVC_OBJS = $(SYSSVC_ASMOBJS) $(SYSSVC_COBJS)
    334371KERNEL_LIB_OBJS = $(KERNEL_ASMOBJS) $(KERNEL_COBJS) $(KERNEL_LCOBJS)
    335 SYSSVC_OBJS = $(SYSSVC_ASMOBJS) $(SYSSVC_COBJS)
    336 APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS)
     372CFG_OBJS = $(CFG_ASMOBJS) $(CFG_COBJS)
    337373ALL_OBJS = $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    338374                                                                                        $(END_OBJS) $(HIDDEN_OBJS)
     
    368404tecs $(TECSGEN_SRCS) $(TECS_HEADERS): $(TECSGEN_TIMESTAMP) ;
    369405$(TECSGEN_TIMESTAMP): $(APPL_CDL) $(TECS_IMPORTS)
    370         $(TECSGEN) $< -R $(INCLUDES) --cpp "$(TECS_CPP)" -g $(TECSGENDIR)
     406        $(TECSGEN) $< -R $(INCLUDES) --cpp "$(subst ", \", $(TECS_CPP))" -g $(TECSGENDIR)
    371407
    372408#
     
    375411cfg1_out.c cfg1_out.db: cfg1_out.timestamp ;
    376412cfg1_out.timestamp: $(APPL_CFG) $(TECSGEN_TIMESTAMP)
    377         $(CFG) --pass 1 --kernel asp $(INCLUDES) $(CFG_TABS) \
     413        $(CFG) --pass 1 $(CFG_KERNEL) $(INCLUDES) $(CFG_TABS) \
    378414                                                -M $(DEPDIR)/cfg1_out_c.d $(TARGET_KERNEL_CFG) $<
    379415
    380 $(CFG1_OUT): $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
     416$(CFG1_OUT): $(START_OBJS) $(OBJDIR)/cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
    381417        $(LINK) $(CFLAGS) $(LDFLAGS) $(CFG1_OUT_LDFLAGS) -o $(CFG1_OUT) \
    382                                                 $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS)
     418                                                $(START_OBJS) $(OBJDIR)/cfg1_out.o $(CFG_DMY) $(LIBS) $(END_OBJS)
    383419
    384420cfg1_out.syms: $(CFG1_OUT)
     
    390426$(CFG2_OUT_SRCS) cfg2_out.db: kernel_cfg.timestamp ;
    391427kernel_cfg.timestamp: cfg1_out.db cfg1_out.syms cfg1_out.srec
    392         $(CFG) --pass 2 --kernel asp $(INCLUDES) -T $(TARGET_TCPIP_TRB):tcpip -T $(TARGET_KERNEL_TRB):kernel
     428        $(CFG) --pass 2 $(CFG_KERNEL) $(INCLUDES) $(CFG_TRB)
    393429
    394430#
     
    397433$(OFFSET_H): offset.timestamp ;
    398434offset.timestamp: cfg1_out.db cfg1_out.syms cfg1_out.srec
    399         $(CFG) --pass 2 -O --kernel asp $(INCLUDES) -T $(TARGET_OFFSET_TRB) \
     435        $(CFG) --pass 2 -O $(CFG_KERNEL) $(INCLUDES) -T $(TARGET_OFFSET_TRB) \
    400436                                --rom-symbol cfg1_out.syms --rom-image cfg1_out.srec
    401437
     
    409445
    410446#
     447#  並列makeのための依存関係の定義
     448#
     449$(APPL_OBJS) $(SYSSVC_OBJS): | kernel_cfg.timestamp
     450$(APPL_ASMOBJS) $(SYSSVC_ASMOBJS) $(KERNEL_ASMOBJS) $(CFG_ASMOBJS): \
     451                                                                                                                | offset.timestamp
     452
     453#
    411454#  特別な依存関係の定義
    412455#
    413 tBannerMain.o: $(filter-out tBannerMain.o,$(ALL_OBJS)) $(LIBS_DEP)
     456$(OBJDIR)/@(BANNEROBJ): $(filter-out $(OBJDIR)/@(BANNEROBJ),$(ALL_OBJS)) \
     457                                                                                                                                $(LIBS_DEP)
    414458
    415459#
     
    417461#
    418462$(OBJFILE): $(ALL_OBJS) $(LIBS_DEP)
    419         $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) \
     463        $(LINK) $(CFLAGS) $(LDFLAGS) $(OBJ_LDFLAGS) -o $(OBJFILE) -Wl,-Map=$(OBJNAME).map,--cref \
    420464                        $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    421465                        $(ALL_LIBS) $(END_OBJS)
     466
     467#
     468#  依存関係フォルダの作成
     469#
     470$(DEPDIR):
     471        mkdir $@
    422472
    423473#
     
    445495check: check.timestamp ;
    446496check.timestamp: cfg2_out.db $(OBJNAME).syms $(OBJNAME).srec
    447         $(CFG) --pass 3 --kernel asp -O $(INCLUDES) -T $(TARGET_CHECK_TRB) \
     497        $(CFG) --pass 3 $(CFG_KERNEL) -O $(INCLUDES) -T $(TARGET_CHECK_TRB) \
    448498                                --rom-symbol $(OBJNAME).syms --rom-image $(OBJNAME).srec
    449499        @echo "configuration check passed"
     
    454504.PHONY: clean
    455505clean:
    456         rm -f \#* *~ *.o $(DEPDIR)/*.d $(CLEAN_FILES) check.timestamp
     506        rm -f \#* *~ $(OBJDIR)/*.o $(DEPDIR)/*.d $(CLEAN_FILES) check.timestamp
    457507        rm -f $(OBJFILE) $(OBJNAME).syms $(OBJNAME).srec $(OBJNAME).bin
    458508        rm -f kernel_cfg.timestamp $(CFG2_OUT_SRCS) cfg2_out.db
     
    468518cleankernel:
    469519        rm -f $(OFFSET_H) $(KERNEL_LIB_OBJS)
    470         rm -f $(KERNEL_LIB_OBJS:%.o=$(DEPDIR)/%.d)
     520        rm -f $(KERNEL_LIB_OBJS:$(OBJDIR)/%.o=$(DEPDIR)/%.d)
    471521
    472522.PHONY: realclean
     
    480530#  のみを付けてコンパイルする.
    481531#
    482 ALL_CFG_COBJS = $(CFG_COBJS) cfg1_out.o
     532ALL_CFG_COBJS = $(CFG_COBJS) $(OBJDIR)/cfg1_out.o
    483533ALL_CFG_ASMOBJS = $(CFG_ASMOBJS)
    484534
    485 $(ALL_CFG_COBJS): %.o: %.c
    486         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
    487 
    488 $(ALL_CFG_COBJS:.o=.s): %.s: %.c
    489         $(CC) -S $(CFLAGS) $(CFG_CFLAGS) $<
    490 
    491 $(ALL_CFG_ASMOBJS): %.o: %.S
    492         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
     535$(ALL_CFG_COBJS): $(OBJDIR)/%.o: %.c
     536        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
     537
     538$(ALL_CFG_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     539        $(CC) -S -o $@ $(CFLAGS) $(CFG_CFLAGS) $<
     540
     541$(ALL_CFG_ASMOBJS): $(OBJDIR)/%.o: %.S
     542        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
    493543
    494544#
     
    541591#  コンパイルルールの定義
    542592#
    543 $(KERNEL_COBJS): %.o: %.c
    544         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
    545 
    546 $(KERNEL_COBJS:.o=.s): %.s: %.c
    547         $(CC) -S $(CFLAGS) $(KERNEL_CFLAGS) $<
    548 
    549 $(KERNEL_LCOBJS): %.o:
    550         $(CC) -DTOPPERS_$(*F) -o $@ -c -MD -MP -MF $(DEPDIR)/$*.d \
     593$(KERNEL_COBJS): $(OBJDIR)/%.o: %.c
     594        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
     595
     596$(KERNEL_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     597        $(CC) -S -o $@ $(CFLAGS) $(KERNEL_CFLAGS) $<
     598
     599$(KERNEL_LCOBJS): $(OBJDIR)/%.o:
     600        $(CC) -c -o $@ -DTOPPERS_$(*F) -MD -MP -MF $(DEPDIR)/$*.d \
    551601                                                                        $(CFLAGS) $(KERNEL_CFLAGS) $<
    552602
    553 $(KERNEL_LCOBJS:.o=.s): %.s:
    554         $(CC) -DTOPPERS_$(*F) -o $@ -S $(CFLAGS) $(KERNEL_CFLAGS) $<
    555 
    556 $(KERNEL_ASMOBJS): %.o: %.S
    557         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
    558 
    559 $(SYSSVC_COBJS): %.o: %.c
    560         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
    561 
    562 $(SYSSVC_COBJS:.o=.s): %.s: %.c
    563         $(CC) -S $(CFLAGS) $(SYSSVC_CFLAGS) $<
    564 
    565 $(SYSSVC_ASMOBJS): %.o: %.S
    566         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
    567 
    568 $(APPL_COBJS): %.o: %.c
    569         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    570 
    571 $(APPL_COBJS:.o=.s): %.s: %.c
    572         $(CC) -S $(CFLAGS) $(APPL_CFLAGS) $<
    573 
    574 $(APPL_CXXOBJS): %.o: %.cpp
    575         $(CXX) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    576 
    577 $(APPL_CXXOBJS:.o=.s): %.s: %.cpp
    578         $(CXX) -S $(CFLAGS) $(APPL_CFLAGS) $<
    579 
    580 $(APPL_ASMOBJS): %.o: %.S
    581         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     603$(KERNEL_LCOBJS:$(OBJDIR)/%.o=%.s): %.s:
     604        $(CC) -S -o $@ -DTOPPERS_$(*F) $(CFLAGS) $(KERNEL_CFLAGS) $<
     605
     606$(KERNEL_ASMOBJS): $(OBJDIR)/%.o: %.S
     607        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
     608
     609$(SYSSVC_COBJS): $(OBJDIR)/%.o: %.c
     610        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
     611
     612$(SYSSVC_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     613        $(CC) -S -o $@ $(CFLAGS) $(SYSSVC_CFLAGS) $<
     614
     615$(SYSSVC_ASMOBJS): $(OBJDIR)/%.o: %.S
     616        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
     617
     618$(APPL_COBJS): $(OBJDIR)/%.o: %.c
     619        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     620
     621$(APPL_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     622        $(CC) -S -o $@ $(CFLAGS) $(APPL_CFLAGS) $<
     623
     624$(APPL_CXXOBJS): $(OBJDIR)/%.o: %.cpp
     625        $(CXX) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     626
     627$(APPL_CXXOBJS:$(OBJDIR)/%.o=%.s): %.s: %.cpp
     628        $(CXX) -S -o $@ $(CFLAGS) $(APPL_CFLAGS) $<
     629
     630$(APPL_ASMOBJS): $(OBJDIR)/%.o: %.S
     631        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    582632
    583633#
    584634#  デフォルトコンパイルルールを上書き
    585635#
    586 %.o: %.c
     636$(OBJDIR)/%.o: %.c
    587637        @echo "*** Default compile rules should not be used."
    588         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     638        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
    589639
    590640%.s: %.c
    591641        @echo "*** Default compile rules should not be used."
    592         $(CC) -S $(CFLAGS) $<
    593 
    594 %.o: %.cpp
     642        $(CC) -S -o $@ $(CFLAGS) $<
     643
     644$(OBJDIR)/%.o: %.cpp
    595645        @echo "*** Default compile rules should not be used."
    596         $(CXX) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     646        $(CXX) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
    597647
    598648%.s: %.cpp
    599649        @echo "*** Default compile rules should not be used."
    600         $(CXX) -S $(CFLAGS) $<
    601 
    602 %.o: %.S
     650        $(CXX) -S -o $@ $(CFLAGS) $<
     651
     652$(OBJDIR)/%.o: %.S
    603653        @echo "*** Default compile rules should not be used."
    604         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     654        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
  • EcnlProtoTool/trunk/asp3_dcre/sample/sample1.c

    r331 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2004-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    4848 *  プログラムの概要:
    4949 *
    50  *  ユーザインタフェースを受け持つメインタスク(タスクID: MAIN_TASK,優
    51  *  先度: MAIN_PRIORITY)と,3つの並行実行されるタスク(タスクID:
    52  *  TASK1~TASK3,初期優先度: MID_PRIORITY)で構成される.また,起動周
    53  *  期が2秒の周期ハンドラ(周期ハンドラID: CYCHDR1)を用いる.
    54  *
    55  *  並行実行されるタスクは,task_loop回空ループを実行する度に,タスクが
    56  *  実行中であることをあらわすメッセージを表示する.空ループを実行する
    57  *  のは,空ループなしでメッセージを出力すると,多量のメッセージが出力
    58  *  され,プログラムの動作が確認しずらくなるためである.また,低速なシ
     50 *  ユーザインタフェースを受け持つメインタスク(MAIN_TASK)と,3つの並
     51 *  行実行されるタスク(TASK1~TASK3),例外処理タスク(EXC_TASK)の5
     52 *  つのタスクを用いる.これらの他に,システムログタスクが動作する.ま
     53 *  た,周期ハンドラ,アラームハンドラ,割込みサービスルーチン,CPU例
     54 *  外ハンドラをそれぞれ1つ用いる.
     55 *
     56 *  並行実行されるタスクは,task_loop回のループを実行する度に,タスク
     57 *  が実行中であることをあらわすメッセージを表示する.ループを実行する
     58 *  のは,プログラムの動作を確認しやすくするためである.また,低速なシ
    5959 *  リアルポートを用いてメッセージを出力する場合に,すべてのメッセージ
    6060 *  が出力できるように,メッセージの量を制限するという理由もある.
    6161 *
    62  *  周期ハンドラは,三つの優先度(HIGH_PRIORITY,MID_PRIORITY,
    63  *  LOW_PRIORITY)のレディキューを回転させる.プログラムの起動直後は,
    64  *  周期ハンドラは停止状態になっている.
    65  *
    66  *  メインタスクは,シリアルI/Oポートからの文字入力を行い(文字入力を
    67  *  待っている間は,並行実行されるタスクが実行されている),入力された
    68  *  文字に対応した処理を実行する.入力された文字と処理の関係は次の通り.
     62 *  周期ハンドラ,アラームハンドラ,割込みサービスルーチンは,3つの優
     63 *  先度(HIGH_PRIORITY,MID_PRIORITY,LOW_PRIORITY)のレディキューを
     64 *  回転させる.周期ハンドラは,プログラムの起動直後は停止状態になって
     65 *  いる.
     66 *
     67 *  CPU例外ハンドラは,CPU例外からの復帰が可能な場合には,例外処理タス
     68 *  クを起動する.例外処理タスクは,CPU例外を起こしたタスクに対して,
     69 *  終了要求を行う.
     70 *
     71 *  メインタスクは,シリアルポートからの文字入力を行い(文字入力を待っ
     72 *  ている間は,並行実行されるタスクが実行されている),入力された文字
     73 *  に対応した処理を実行する.入力された文字と処理の関係は次の通り.
    6974 *  Control-Cまたは'Q'が入力されると,プログラムを終了する.
    7075 *
     
    97102 *  'b' : アラームハンドラを5秒後に起動するよう動作開始させる.
    98103 *  'B' : アラームハンドラを動作停止させる.
    99  *  'z' : 対象タスクにCPU例外を発生させる(タスクを終了させる).
    100  *  'Z' : 対象タスクにCPUロック状態でCPU例外を発生させる(プログラムを
    101  *        終了する).
     104 *  'z' : 対象タスクにCPU例外を発生させる(ターゲットによっては復帰可能).
     105 *  'Z' : 対象タスクにCPUロック状態でCPU例外を発生させる(復帰不可能).
    102106 *  '@' : タスク3をacre_tskにより生成する.
    103107 *  '!' : 対象タスクをdel_tskにより削除する.
    104108 *  '$' : アラームハンドラをacre_almにより生成する.
    105109 *  '#' : アラームハンドラをdel_almにより削除する.
    106  *  'V' : fch_hrtで高分解能タイマを2回読む.
     110 *  'V' : 短いループを挟んで,fch_hrtで高分解能タイマを2回読む.
    107111 *  'v' : 発行したシステムコールを表示する(デフォルト).
    108112 *  'q' : 発行したシステムコールを表示しない.
     
    116120#include "kernel_cfg.h"
    117121#include "sample1.h"
    118 /*#include "sample1n.h"*/
    119122
    120123/*
     
    132135
    133136/*
     137 *  プロセッサ時間の消費
     138 *
     139 *  ループによりプロセッサ時間を消費する.最適化ができないように,ルー
     140 *  プ内でvolatile変数を読み込む.
     141 */
     142static volatile long_t  volatile_var;
     143
     144static void
     145consume_time(ulong_t ctime)
     146{
     147        ulong_t         i;
     148
     149        for (i = 0; i < ctime; i++) {
     150                (void) volatile_var;
     151        }
     152}
     153
     154/*
    134155 *  並行実行されるタスクへのメッセージ領域
    135156 */
     
    144165 *  並行実行されるタスク
    145166 */
    146 void task(intptr_t exinf)
    147 {
    148         volatile ulong_t        i;
     167void
     168task(intptr_t exinf)
     169{
    149170        int_t           n = 0;
    150171        int_t           tskno = (int_t) exinf;
     
    155176                syslog(LOG_NOTICE, "task%d is running (%03d).   %s",
    156177                                                                                tskno, ++n, graph[tskno-1]);
    157                 for (i = 0; i < task_loop; i++);
     178                consume_time(task_loop);
    158179                c = message[tskno-1];
    159180                message[tskno-1] = 0;
     
    202223
    203224/*
    204  *  割込みハンドラ
     225 *  割込みサービスルーチン
     226 *
     227 *  HIGH_PRIORITY,MID_PRIORITY,LOW_PRIORITY の各優先度のレディキュー
     228 *  を回転させる.
    205229 */
    206230#ifdef INTNO1
    207231
    208 void intno1_isr(intptr_t exinf)
     232void
     233intno1_isr(intptr_t exinf)
    209234{
    210235        intno1_clear();
     
    235260                                        "sns_dpn() is not true in CPU exception handler.");
    236261        }
    237         syslog(LOG_INFO, "sns_loc = %d sns_dsp = %d xsns_dpn = %d",
     262        syslog(LOG_INFO, "sns_loc = %d, sns_dsp = %d, xsns_dpn = %d",
    238263                                                                sns_loc(), sns_dsp(), xsns_dpn(p_excinf));
    239264
     
    244269        }
    245270
    246 #ifdef PREPARE_RETURN_CPUEXC
    247         PREPARE_RETURN_CPUEXC;
    248271        SVC_PERROR(get_tid(&cpuexc_tskid));
    249272        SVC_PERROR(act_tsk(EXC_TASK));
    250 #else /* PREPARE_RETURN_CPUEXC */
    251         syslog(LOG_NOTICE, "Sample program ends with exception.");
    252         SVC_PERROR(ext_ker());
    253         assert(0);
    254 #endif /* PREPARE_RETURN_CPUEXC */
    255273}
    256274
     
    263281 *  を回転させる.
    264282 */
    265 void cyclic_handler(intptr_t exinf)
     283void
     284cyclic_handler(intptr_t exinf)
    266285{
    267286        SVC_PERROR(rot_rdq(HIGH_PRIORITY));
     
    276295 *  を回転させる.
    277296 */
    278 void alarm_handler(intptr_t exinf)
     297void
     298alarm_handler(intptr_t exinf)
    279299{
    280300        SVC_PERROR(rot_rdq(HIGH_PRIORITY));
     
    286306 *  例外処理タスク
    287307 */
    288 void exc_task(intptr_t exinf)
     308void
     309exc_task(intptr_t exinf)
    289310{
    290311        SVC_PERROR(ras_ter(cpuexc_tskid));
     
    294315 *  メインタスク
    295316 */
    296 void main_task(intptr_t exinf)
     317void
     318main_task(intptr_t exinf)
    297319{
    298320        char    c;
     
    302324        PRI             tskpri;
    303325#ifndef TASK_LOOP
    304         volatile ulong_t        i;
    305326        SYSTIM  stime1, stime2;
    306327#endif /* TASK_LOOP */
     
    332353         *  ループ回数の設定
    333354         *
    334          *  並行実行されるタスク内での空ループの回数(task_loop)は,空ルー
    335          *  の実行時間が約0.4秒になるように設定する.この設定のために,
    336          *  LOOP_REF回のループの実行時間を,その前後でget_timを呼ぶことで
    337          *  測定し,その測定結果から空ループの実行時間が0.4秒になるループ
    338          *  数を求め,task_loopに設定する.
     355         *  並行実行されるタスク内でのループの回数(task_loop)は,ループ
     356         *  の実行時間が約0.4秒になるように設定する.この設定のために,
     357         *  LOOP_REF回のループの実行時間を,その前後でget_timを呼ぶことで
     358         *  測定し,その測定結果から空ループの実行時間が0.4秒になるループ
     359         *  数を求め,task_loopに設定する.
    339360         *
    340          *  LOOP_REFは,デフォルトでは1,000,000に設定しているが,想定したよ
    341          *  り遅いプロセッサでは,サンプルプログラムの実行開始に時間がかか
    342          *  りすぎるという問題を生じる.逆に想定したより速いプロセッサでは,
    343          *  LOOP_REF回の空ループの実行時間が短くなり,task_loopに設定する値
    344          *  の誤差が大きくなるという問題がある.
    345          *
    346          *  そこで,そのようなターゲットでは,target_test.hで,LOOP_REFを適
    347          *  切な値に定義するのが望ましい.
     361         *  LOOP_REFは,デフォルトでは1,000,000に設定しているが,想定した
     362         *  より遅いプロセッサでは,サンプルプログラムの実行開始に時間がか
     363         *  かりすぎるという問題を生じる.逆に想定したより速いプロセッサで
     364         *  は,LOOP_REF回のループの実行時間が短くなり,task_loopに設定す
     365         *  る値の誤差が大きくなるという問題がある.そこで,そのようなター
     366         *  ゲットでは,target_test.hで,LOOP_REFを適切な値に定義すること
     367         *  とする.
    348368         *
    349369         *  また,task_loopの値を固定したい場合には,その値をTASK_LOOPにマ
    350          *  クロ定義する.TASK_LOOPがマクロ定義されている場合,上記の測定
    351          *  行わずに,TASK_LOOPに定義された値を空ループの回数とする.
     370         *  クロ定義する.TASK_LOOPがマクロ定義されている場合,上記の測定
     371         *  を行わずに,TASK_LOOPに定義された値をループの回数とする.
    352372         *
    353          * ターゲットによっては,空ループの実行時間の1回目の測定で,本来よ
    354          * も長めになるものがある.このようなターゲットでは,MEASURE_TWICE
    355          * をマクロ定義することで,1回目の測定結果を捨てて,2回目の測定結果
    356          * を使う.
     373         *  ターゲットによっては,ループの実行時間の1回目の測定で,本来より
     374         *  も長めになるものがある.このようなターゲットでは,MEASURE_TWICE
     375         *  をマクロ定義することで,1回目の測定結果を捨てて,2回目の測定結
     376         *  果を使う.
    357377         */
    358378#ifdef TASK_LOOP
     
    361381
    362382#ifdef MEASURE_TWICE
    363         task_loop = LOOP_REF;
    364383        SVC_PERROR(get_tim(&stime1));
    365         for (i = 0; i < task_loop; i++);
     384        consume_time(LOOP_REF);
    366385        SVC_PERROR(get_tim(&stime2));
    367386#endif /* MEASURE_TWICE */
    368387
    369         task_loop = LOOP_REF;
    370388        SVC_PERROR(get_tim(&stime1));
    371         for (i = 0; i < task_loop; i++);
     389        consume_time(LOOP_REF);
    372390        SVC_PERROR(get_tim(&stime2));
    373391        task_loop = LOOP_REF * 400LU / (ulong_t)(stime2 - stime1) * 1000LU;
     
    477495                        break;
    478496                case 'c':
    479                         syslog(LOG_INFO, "#sta_cyc(1)");
     497                        syslog(LOG_INFO, "#sta_cyc(CYCHDR1)");
    480498                        SVC_PERROR(sta_cyc(CYCHDR1));
    481499                        break;
    482500                case 'C':
    483                         syslog(LOG_INFO, "#stp_cyc(1)");
     501                        syslog(LOG_INFO, "#stp_cyc(CYCHDR1)");
    484502                        SVC_PERROR(stp_cyc(CYCHDR1));
    485503                        break;
    486504                case 'b':
    487                         syslog(LOG_INFO, "#sta_alm(1, 5000000)");
     505                        syslog(LOG_INFO, "#sta_alm(ALMHDR1, 5000000)");
    488506                        SVC_PERROR(sta_alm(ALMHDR1, 5000000));
    489507                        break;
    490508                case 'B':
    491                         syslog(LOG_INFO, "#stp_alm(1)");
     509                        syslog(LOG_INFO, "#stp_alm(ALMHDR1)");
    492510                        SVC_PERROR(stp_alm(ALMHDR1));
    493511                        break;
     
    499517                        ctsk.stksz = STACK_SIZE;
    500518                        ctsk.stk = NULL;
    501                         SVC_PERROR(TASK3 = acre_tsk(&ctsk));
    502                         syslog(LOG_NOTICE, "task3 is created with tskid = %d.",
     519                        SVC_PERROR(ercd = acre_tsk(&ctsk));
     520                        if (ercd >= 0) {
     521                                TASK3 = ercd;
     522                                syslog(LOG_NOTICE, "task3 is created with tskid = %d.",
    503523                                                                                                                (int_t) TASK3);
     524                        }
    504525                        break;
    505526                case '!':
     
    512533                        calm.nfyinfo.nfy.handler.exinf = (intptr_t) 0;
    513534                        calm.nfyinfo.nfy.handler.tmehdr = (TMEHDR) alarm_handler;
    514                         SVC_PERROR(ALMHDR1 = acre_alm(&calm));
    515                         syslog(LOG_NOTICE, "alarm handler is created with almid = %d.",
     535                        SVC_PERROR(ercd = acre_alm(&calm));
     536                        if (ercd >= 0) {
     537                                ALMHDR1 = ercd;
     538                                syslog(LOG_NOTICE, "alarm handler is created with almid = %d.",
    516539                                                                                                                (int_t) ALMHDR1);
     540                        }
    517541                        break;
    518542                case '#':
    519                         syslog(LOG_INFO, "#del_alm(1)");
     543                        syslog(LOG_INFO, "#del_alm(ALMHDR1)");
    520544                        SVC_PERROR(del_alm(ALMHDR1));
    521545                        break;
     
    523547                case 'V':
    524548                        hrtcnt1 = fch_hrt();
     549                        consume_time(1000LU);
    525550                        hrtcnt2 = fch_hrt();
    526551                        syslog(LOG_NOTICE, "hrtcnt1 = %tu, hrtcnt2 = %tu",
    527                                                                                 hrtcnt1, hrtcnt2);
     552                                                                (uint32_t) hrtcnt1, (uint32_t) hrtcnt2);
    528553                        break;
    529554
     
    552577#endif /* BIT_KERNEL */
    553578
     579                case '\003':
     580                case 'Q':
     581                        break;
     582
    554583                default:
     584                        syslog(LOG_INFO, "Unknown command: '%c'.", c);
    555585                        break;
    556586                }
  • EcnlProtoTool/trunk/asp3_dcre/sample/sample1.cdl

    r321 r429  
    3030
    3131/*
    32  *  システムログ機能の組上げ記述
     32 *              システムログ機能のアダプタの組上げ記述
     33 *
     34 *  システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー
     35 *  スのシステムログ機能を呼び出すためのセルである.システムログ機能の
     36 *  サービスコール(syslog,syslog_0~syslog_5,t_perrorを含む)を呼び
     37 *  出さない場合には,以下のセルの組上げ記述を削除してよい.
     38 */
     39cell tSysLogAdapter SysLogAdapter {
     40        cSysLog = SysLog.eSysLog;
     41};
     42
     43/*
     44 *              シリアルインタフェースドライバのアダプタの組上げ記述
     45 *
     46 *  シリアルインタフェースドライバのアダプタは,C言語で記述されたコー
     47 *  ドから,TECSベースのシリアルインタフェースドライバを呼び出すための
     48 *  セルである.シリアルインタフェースドライバのサービスコールを呼び出
     49 *  さない場合には,以下のセルの組上げ記述を削除してよい.
     50 */
     51cell tSerialAdapter SerialAdapter {
     52        cSerialPort[0] = SerialPort1.eSerialPort;
     53};
     54
     55/*
     56 *              システムログ機能の組上げ記述
    3357 *
    3458 *  システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ
     
    4973
    5074/*
    51  *  C言語で記述されたアプリケーションから,TECSベースのシステムログ機能
    52  *  を呼び出すためのアダプタの組上げ記述
    53  *
    54  *  システムログ機能のサービスコール(syslog関数とsyslog_0関数~syslog_5
    55  *  関数以外のもの)ルをC言語で記述されたアプリケーションから呼び出さな
    56  *  い場合には,以下のセルの組上げ記述を削除すればよい.
    57  */
    58 cell tSysLogAdapter SysLogAdapter {
    59         cSysLog = SysLog.eSysLog;
    60 };
    61 
    62 /*
    63  *  シリアルインタフェースドライバの組上げ記述
     75 *              シリアルインタフェースドライバの組上げ記述
    6476 *
    6577 *  シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記
     
    7890
    7991/*
    80  *  C言語で記述されたアプリケーションから,TECSベースのシリアルインタ
    81  *  フェースドライバを呼び出すためのアダプタの組上げ記述
    82  *
    83  *  シリアルインタフェースドライバのサービスコールをC言語で記述されたア
    84  *  プリケーションから呼び出さない場合には,以下のセルの組上げ記述を削
    85  *  除すればよい.
    86  */
    87 cell tSerialAdapter SerialAdapter {
    88         cSerialPort[0] = SerialPort1.eSerialPort;
    89 };
    90 
    91 /*
    92  *  システムログタスクの組上げ記述
     92 *              システムログタスクの組上げ記述
    9393 *
    9494 *  システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ
     
    111111
    112112/*
    113  *  カーネル起動メッセージ出力の組上げ記述
     113 *              カーネル起動メッセージ出力の組上げ記述
    114114 *
    115115 *  カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述
  • EcnlProtoTool/trunk/asp3_dcre/sample/sample1.cfg

    r321 r429  
    2121DEF_EXC(CPUEXC1, { TA_NULL, cpuexc_handler });
    2222#endif /* CPUEXC1 */
    23 DEF_KMM({ KMM_SIZE, NULL });
     23DEF_MPK({ MPK_SIZE, NULL });
  • EcnlProtoTool/trunk/asp3_dcre/sample/sample1.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2004-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5757
    5858#define EXC_PRIORITY    1               /* 例外処理タスクの優先度 */
    59 #define MAIN_PRIORITY   6               /* メインタスクの優先度 */
     59#define MAIN_PRIORITY   5               /* メインタスクの優先度 */
    6060                                                                /* HIGH_PRIORITYより高くすること */
    6161
     
    7676#endif /* STACK_SIZE */
    7777
    78 #ifndef KMM_SIZE
    79 #define KMM_SIZE                (STACK_SIZE * 16)       /* カーネルが割り付ける   */
    80 #endif /* KMM_SIZE */                                           /*     メモリ領域のサイズ */
     78#ifndef MPK_SIZE                                        /* カーネルメモリプール領域のサイズ */
     79#define MPK_SIZE                (STACK_SIZE * 16)
     80#endif /* MPK_SIZE */
    8181
    8282#ifndef LOOP_REF
  • EcnlProtoTool/trunk/asp3_dcre/sample/sample1n.h

    r331 r429  
    6262
    6363extern void     net_syslog(uint_t prio, const char *format, ...) throw();
    64 extern ER_UINT  net_serial_rea_dat(ID portid, char *buf, uint_t len) throw();
     64static ER_UINT  net_serial_rea_dat(ID portid, char *buf, uint_t len) throw();
    6565extern ER       net_serial_ctl_por(ID portid, uint_t ioctl) throw();
    6666
  • EcnlProtoTool/trunk/asp3_dcre/sample/tSample2.c

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems/
    44 *      Advanced Standard Profile Kernel
    5  *
     5 * 
    66 *  Copyright (C) 2015-2016 by Ushio Laboratory
    77 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    4242
    4343/*
    44  *  サンプルプログラム(1)の本体
    45  *
    46  *  ASPカーネルの基本的な動作を確認するためのサンプルプログラム
     44 *  サンプルプログラム(2)の本体
     45 *
     46 *  ASPカーネルの基本的な動作を確認するためのサンプルプログラム(TECS版)
    4747 *
    4848 *  プログラムの概要:
    4949 *
    50  *  ユーザインタフェースを受け持つメインタスク(タスクID: MAIN_TASK,優
    51  *  先度: MAIN_PRIORITY)と,3つの並行実行されるタスク(タスクID:
    52  *  TASK1~TASK3,初期優先度: MID_PRIORITY)で構成される.また,起動周
    53  *  期が2秒の周期ハンドラ(周期ハンドラID: CYCHDR1)を用いる.
    54  *
    55  *  並行実行されるタスクは,task_loop回空ループを実行する度に,タスクが
    56  *  実行中であることをあらわすメッセージを表示する.空ループを実行する
    57  *  のは,空ループなしでメッセージを出力すると,多量のメッセージが出力
    58  *  され,プログラムの動作が確認しずらくなるためである.また,低速なシ
     50 *  ユーザインタフェースを受け持つメインタスク(MainTask)と,3つの並
     51 *  行実行されるタスク(Task1~Task3),例外処理タスク(ExceptionTask)
     52 *  の5つのタスクを用いる.これらの他に,システムログタスクが動作する.
     53 *  また,周期ハンドラ,アラームハンドラ,割込みサービスルーチン,CPU
     54 *  例外ハンドラをそれぞれ1つ用いる.
     55 *
     56 *  並行実行されるタスクは,task_loop回のループを実行する度に,タスク
     57 *  が実行中であることをあらわすメッセージを表示する.ループを実行する
     58 *  のは,プログラムの動作を確認しやすくするためである.また,低速なシ
    5959 *  リアルポートを用いてメッセージを出力する場合に,すべてのメッセージ
    6060 *  が出力できるように,メッセージの量を制限するという理由もある.
    6161 *
    62  *  周期ハンドラは,三つの優先度(HIGH_PRIORITY,MID_PRIORITY,
    63  *  LOW_PRIORITY)のレディキューを回転させる.プログラムの起動直後は,
    64  *  周期ハンドラは停止状態になっている.
    65  *
    66  *  メインタスクは,シリアルI/Oポートからの文字入力を行い(文字入力を
    67  *  待っている間は,並列実行されるタスクが実行されている),入力された
    68  *  文字に対応した処理を実行する.入力された文字と処理の関係は次の通り.
     62 *  周期ハンドラ,アラームハンドラ,割込みサービスルーチンは,3つの優
     63 *  先度(HIGH_PRIORITY,MID_PRIORITY,LOW_PRIORITY)のレディキューを
     64 *  回転させる.周期ハンドラは,プログラムの起動直後は停止状態になって
     65 *  いる.
     66 *
     67 *  CPU例外ハンドラは,CPU例外からの復帰が可能な場合には,例外処理タス
     68 *  クを起動する.例外処理タスクは,CPU例外を起こしたタスクに対して,
     69 *  終了要求を行う.
     70 *
     71 *  メインタスクは,シリアルポートからの文字入力を行い(文字入力を待っ
     72 *  ている間は,並行実行されるタスクが実行されている),入力された文字
     73 *  に対応した処理を実行する.入力された文字と処理の関係は次の通り.
    6974 *  Control-Cまたは'Q'が入力されると,プログラムを終了する.
    7075 *
     
    97102 *  'b' : アラームハンドラを5秒後に起動するよう動作開始させる.
    98103 *  'B' : アラームハンドラを動作停止させる.
    99  *  'z' : 対象タスクにCPU例外を発生させる(タスクを終了させる).
    100  *  'Z' : 対象タスクにCPUロック状態でCPU例外を発生させる(プログラムを
    101  *        終了する).
    102  *  'V' : fetchHighResolutionTimerで高分解能タイマを2回読む.
     104 *  'z' : 対象タスクにCPU例外を発生させる(ターゲットによっては復帰可能).
     105 *  'Z' : 対象タスクにCPUロック状態でCPU例外を発生させる(復帰不可能).
     106 *  'V' : 短いループを挟んで,fetchHighResolutionTimerで高分解能タイマを
     107 *        2回読む.
    103108 *  'v' : 発行したシステムコールを表示する(デフォルト).
    104109 *  'q' : 発行したシステムコールを表示しない.
    105  * 呼び口関数 #_TCPF_#
    106  * require port: signature:sKernel context:task
    107  *   ER             getExtendedInformation( intptr_t* p_exinf );
    108  *   ER             sleep( );
    109  *   ER             sleepTimeout( TMO timeout );
    110  *   ER             delay( RELTIM delayTime );
    111  *   ER             exit( );
    112  *   ER             disableTerminate( );
    113  *   ER             enableTerminate( );
    114  *   bool_t         senseTerminate( );
    115  *   ER             setTime( SYSTIM systemTime );
    116  *   ER             getTime( SYSTIM* p_systemTime );
    117  *   ER             adjustTime( int32_t adjustTime );
    118  *   HRTCNT         fetchHighResolutionTimer( );
    119  *   ER             rotateReadyQueue( PRI taskPriority );
    120  *   ER             getTaskId( ID* p_taskId );
    121  *   ER             getLoad( PRI taskPriority, uint_t* p_load );
    122  *   ER             getNthTask( PRI taskPriority, uint_t nth, ID* p_taskID );
    123  *   ER             lockCpu( );
    124  *   ER             unlockCpu( );
    125  *   ER             disableDispatch( );
    126  *   ER             enableDispatch( );
    127  *   bool_t         senseContext( );
    128  *   bool_t         senseLock( );
    129  *   bool_t         senseDispatch( );
    130  *   bool_t         senseDispatchPendingState( );
    131  *   bool_t         senseKernel( );
    132  *   ER             exitKernel( );
    133  *   ER             changeInterruptPriorityMask( PRI interruptPriority );
    134  *   ER             getInterruptPriorityMask( PRI* p_interruptPriority );
    135  * require port: signature:siKernel context:non-task
    136  *   HRTCNT         ciKernel_fetchHighResolutionTimer( );
    137  *   ER             ciKernel_rotateReadyQueue( PRI taskPriority );
    138  *   ER             ciKernel_getTaskId( ID* p_taskId );
    139  *   ER             ciKernel_lockCpu( );
    140  *   ER             ciKernel_unlockCpu( );
    141  *   bool_t         ciKernel_senseContext( );
    142  *   bool_t         ciKernel_senseLock( );
    143  *   bool_t         ciKernel_senseDispatch( );
    144  *   bool_t         ciKernel_senseDispatchPendingState( );
    145  *   bool_t         ciKernel_senseKernel( );
    146  *   ER             ciKernel_exitKernel( );
    147  *   bool_t         ciKernel_exceptionSenseDispatchPendingState( const void* p_exceptionInformation );
    148  * call port: cTask signature: sTask context:task
    149  *   ER             cTask_activate( subscript );
    150  *   ER_UINT        cTask_cancelActivate( subscript );
    151  *   ER             cTask_getTaskState( subscript, STAT* p_tskstat );
    152  *   ER             cTask_changePriority( subscript, PRI priority );
    153  *   ER             cTask_getPriority( subscript, PRI* p_priority );
    154  *   ER             cTask_refer( subscript, T_RTSK* pk_taskStatus );
    155  *   ER             cTask_wakeup( subscript );
    156  *   ER_UINT        cTask_cancelWakeup( subscript );
    157  *   ER             cTask_releaseWait( subscript );
    158  *   ER             cTask_suspend( subscript );
    159  *   ER             cTask_resume( subscript );
    160  *   ER             cTask_raiseTerminate( subscript );
    161  *   ER             cTask_terminate( subscript );
    162  *       subscript:  0...(NCP_cTask-1)
    163  * call port: cExceptionTask signature: sTask context:task
    164  *   ER             cExceptionTask_activate( );
    165  *   ER_UINT        cExceptionTask_cancelActivate( );
    166  *   ER             cExceptionTask_getTaskState( STAT* p_tskstat );
    167  *   ER             cExceptionTask_changePriority( PRI priority );
    168  *   ER             cExceptionTask_getPriority( PRI* p_priority );
    169  *   ER             cExceptionTask_refer( T_RTSK* pk_taskStatus );
    170  *   ER             cExceptionTask_wakeup( );
    171  *   ER_UINT        cExceptionTask_cancelWakeup( );
    172  *   ER             cExceptionTask_releaseWait( );
    173  *   ER             cExceptionTask_suspend( );
    174  *   ER             cExceptionTask_resume( );
    175  *   ER             cExceptionTask_raiseTerminate( );
    176  *   ER             cExceptionTask_terminate( );
    177  * call port: cCyclic signature: sCyclic context:task
    178  *   ER             cCyclic_start( );
    179  *   ER             cCyclic_stop( );
    180  *   ER             cCyclic_refer( T_RCYC* pk_cyclicHandlerStatus );
    181  * call port: cAlarm signature: sAlarm context:task
    182  *   ER             cAlarm_start( RELTIM alarmTime );
    183  *   ER             cAlarm_stop( );
    184  *   ER             cAlarm_refer( T_RALM* pk_alarmStatus );
    185  * call port: cSerialPort signature: sSerialPort context:task optional:true
    186  *   bool_t     is_cSerialPort_joined()                     check if joined
    187  *   ER             cSerialPort_open( );
    188  *   ER             cSerialPort_close( );
    189  *   ER_UINT        cSerialPort_read( char* buffer, uint_t length );
    190  *   ER_UINT        cSerialPort_write( const char* buffer, uint_t length );
    191  *   ER             cSerialPort_control( uint_t ioControl );
    192  *   ER             cSerialPort_refer( T_SERIAL_RPOR* pk_rpor );
    193  * call port: cSysLog signature: sSysLog context:task
    194  *   ER             cSysLog_write( uint_t priority, const SYSLOG* p_syslog );
    195  *   ER_UINT        cSysLog_read( SYSLOG* p_syslog );
    196  *   ER             cSysLog_mask( uint_t logMask, uint_t lowMask );
    197  *   ER             cSysLog_refer( T_SYSLOG_RLOG* pk_rlog );
    198  *   ER             cSysLog_flush( );
    199  * #[</PREAMBLE>]# */ 
     110 */
    200111
    201112#include "tSample2_tecsgen.h"
     
    220131
    221132/*
     133 *  プロセッサ時間の消費
     134 *
     135 *  ループによりプロセッサ時間を消費する.最適化ができないように,ルー
     136 *  プ内でvolatile変数を読み込む.
     137 */
     138static volatile long_t  volatile_var;
     139
     140static void
     141consume_time(ulong_t ctime)
     142{
     143        ulong_t         i;
     144
     145        for (i = 0; i < ctime; i++) {
     146                (void) volatile_var;
     147        }
     148}
     149
     150/*
    222151 *  並行実行されるタスクへのメッセージ領域
    223152 */
     
    232161 *  並行実行されるタスク
    233162 */
    234 void eSampleTask_main(int_t subscript)
    235 {
    236         volatile ulong_t        i;
     163void
     164eSampleTask_main(int_t subscript)
     165{
    237166        int_t           n = 0;
    238167        int_t           tskno = subscript + 1;
     
    243172                syslog(LOG_NOTICE, "task%d is running (%03d).   %s",
    244173                                                                                tskno, ++n, graph[tskno-1]);
    245                 for (i = 0; i < task_loop; i++);
     174                consume_time(task_loop);
    246175                c = message[tskno-1];
    247176                message[tskno-1] = 0;
     
    290219
    291220/*
     221 *  割込みサービスルーチン
     222 *
     223 *  HIGH_PRIORITY,MID_PRIORITY,LOW_PRIORITY の各優先度のレディキュー
     224 *  を回転させる.
     225 */
     226#ifdef INTNO1
     227
     228void
     229eiISR_main(void)
     230{
     231        intno1_clear();
     232        SVC_PERROR(ciKernel_rotateReadyQueue(HIGH_PRIORITY));
     233        SVC_PERROR(ciKernel_rotateReadyQueue(MID_PRIORITY));
     234        SVC_PERROR(ciKernel_rotateReadyQueue(LOW_PRIORITY));
     235}
     236
     237#endif /* INTNO1 */
     238
     239/*
    292240 *  CPU例外ハンドラ
    293241 */
    294 
    295242ID      cpuexc_tskid;           /* CPU例外を起こしたタスクのID */
    296243
     
    298245
    299246void
    300 cpuexc_handler(void *p_excinf)
     247eiCpuExceptionHandler_main(const void *p_excinf)
    301248{
    302249       
    303250        syslog(LOG_NOTICE, "CPU exception handler (p_excinf = %08p).", p_excinf);
    304251        if (ciKernel_senseContext() != true) {
    305                 syslog(LOG_WARNING,
    306                                         "ciKernel_senseContext() is not true in CPU exception handler.");
     252                syslog(LOG_WARNING, "ciKernel_senseContext() is not true"
     253                                                                                        " in CPU exception handler.");
    307254        }
    308255        if (ciKernel_senseDispatchPendingState() != true) {
    309                 syslog(LOG_WARNING,
    310                                         "ciKernel_senseDispatchPendingState() is not true in CPU exception handler.");
    311         }
    312         syslog(LOG_INFO, "ciKernel_senseLock() = %d ciKernel_senseDispatch() = %d ciKernel_exceptionSenseDispatchPendingState() = %d",
    313                    ciKernel_senseLock(), ciKernel_senseDispatch(), ciKernel_exceptionSenseDispatchPendingState(p_excinf));
     256                syslog(LOG_WARNING, "ciKernel_senseDispatchPendingState() is not true"
     257                                                                                        " in CPU exception handler.");
     258        }
     259        syslog(LOG_INFO, "ciKernel_senseLock() = %d, ciKernel_senseDispatch() = %d",
     260                                                ciKernel_senseLock(), ciKernel_senseDispatch());
     261        syslog(LOG_INFO, "ciKernel_exceptionSenseDispatchPendingState() = %d",
     262                                                ciKernel_exceptionSenseDispatchPendingState(p_excinf));
    314263
    315264        if (ciKernel_exceptionSenseDispatchPendingState(p_excinf)) {
    316265                syslog(LOG_NOTICE, "Sample program ends with exception.");
    317                 SVC_PERROR(ciKernel_senseKernel());
     266                SVC_PERROR(ciKernel_exitKernel());
    318267                assert(0);
    319268        }
    320269
    321 #ifdef PREPARE_RETURN_CPUEXC
    322         PREPARE_RETURN_CPUEXC;
    323270        SVC_PERROR(ciKernel_getTaskId(&cpuexc_tskid));
    324271        cExceptionTask_activate();
    325 #else /* PREPARE_RETURN_CPUEXC */
    326         syslog(LOG_NOTICE, "Sample program ends with exception.");
    327         SVC_PERROR(ciKernel_exitKernel());
    328         assert(0);
    329 #endif /* PREPARE_RETURN_CPUEXC */
    330272}
    331273
     
    338280 *  を回転させる.
    339281 */
    340 /* #[<ENTRY_FUNC>]# eiCyclicHandler_main
    341  * name:         eiCyclicHandler_main
    342  * global_name:  tSample2_eiCyclicHandler_main
    343  * oneway:       
    344  * #[/ENTRY_FUNC>]# */
    345 void
    346 eiCyclicHandler_main()
     282void
     283eiCyclicHandler_main(void)
    347284{
    348285        SVC_PERROR(ciKernel_rotateReadyQueue(HIGH_PRIORITY));
     
    357294 *  を回転させる.
    358295 */
    359 /* #[<ENTRY_FUNC>]# eiAlarmHandler_main
    360  * name:         eiAlarmHandler_main
    361  * global_name:  tSample2_eiAlarmHandler_main
    362  * oneway:       
    363  * #[/ENTRY_FUNC>]# */
    364 void
    365 eiAlarmHandler_main()
     296void
     297eiAlarmHandler_main(void)
    366298{
    367299        SVC_PERROR(ciKernel_rotateReadyQueue(HIGH_PRIORITY));
     
    369301        SVC_PERROR(ciKernel_rotateReadyQueue(LOW_PRIORITY));
    370302}
     303
    371304/*
    372305 *  例外処理タスク
    373306 */
    374 /* #[<ENTRY_FUNC>]# eExceptionTask_main
    375  * name:         eExceptionTask_main
    376  * global_name:  tSample2_eExceptionTask_main
    377  * oneway:       
    378  * #[/ENTRY_FUNC>]# */
    379 void eExceptionTask_main()
     307void
     308eExceptionTask_main(void)
    380309{
    381310        SVC_PERROR(ras_ter(cpuexc_tskid));
    382311}
     312
    383313/*
    384314 *  メインタスク
    385315 */
    386 /* 属性の設定 *//* #[<ENTRY_FUNC>]# eMainTask_main
    387  * name:         eMainTask_main
    388  * global_name:  tSample2_eMainTask_main
    389  * oneway:       
    390  * #[/ENTRY_FUNC>]# */
    391 void
    392 eMainTask_main()
     316void
     317eMainTask_main(void)
    393318{
    394319        char    c;
    395         volatile ulong_t        i;
    396         ulong_t j;
    397320        int_t   tskno = 1;
    398321        ER_UINT ercd;
    399322        PRI             tskpri;
     323#ifndef TASK_LOOP
    400324        SYSTIM  stime1, stime2;
     325#endif /* TASK_LOOP */
    401326        HRTCNT  hrtcnt1, hrtcnt2;
    402327
    403         if (is_cSerialPort_joined()) {
    404                 SVC_PERROR(cSysLog_mask(LOG_UPTO(LOG_INFO), LOG_UPTO(LOG_ERROR)));
    405         } else {
    406                 /*
    407                  *  シリアル出力ができない場合、ログメッセージを全て
    408                  *  低レベル出力により出力する。
    409                  */
    410                 SVC_PERROR(cSysLog_mask(LOG_UPTO(LOG_INFO), LOG_UPTO(LOG_DEBUG)));
    411         }
     328        SVC_PERROR(cSysLog_mask(LOG_UPTO(LOG_INFO), LOG_UPTO(LOG_EMERG)));
    412329        syslog(LOG_NOTICE, "Sample program starts.");
    413330
     
    419336         *  ない.
    420337         */
    421 
    422         if (is_cSerialPort_joined()) {
    423                 ercd = cSerialPort_open();
    424                 if (ercd < 0 && MERCD(ercd) != E_OBJ) {
    425                         syslog(LOG_ERROR, "%s (%d) reported by `cSerialPort_open'.",
    426                                                                                 itron_strerror(ercd), SERCD(ercd));
    427                 }
    428                 SVC_PERROR(cSerialPort_control(IOCTL_CRLF | IOCTL_FCSND | IOCTL_FCRCV));
    429         }
     338        ercd = cSerialPort_open();
     339        if (ercd < 0 && MERCD(ercd) != E_OBJ) {
     340                syslog(LOG_ERROR, "%s (%d) reported by `cSerialPort_open'.",
     341                                                                        itron_strerror(ercd), SERCD(ercd));
     342        }
     343        SVC_PERROR(cSerialPort_control(IOCTL_CRLF | IOCTL_FCSND | IOCTL_FCRCV));
    430344
    431345        /*
    432346         *  ループ回数の設定
    433347         *
    434          *  並行実行されるタスク内での空ループの回数(task_loop)は,空ルー
    435          *  の実行時間が約0.4秒になるように設定する.この設定のために,
    436          *  LOOP_REF回の空ループの実行時間を,その前後でget_timを呼ぶことで
    437          *  測定し,その測定結果から空ループの実行時間が0.4秒になるループ
    438          *  数を求め,task_loopに設定する.
     348         *  並行実行されるタスク内でのループの回数(task_loop)は,ループ
     349         *  の実行時間が約0.4秒になるように設定する.この設定のために,
     350         *  LOOP_REF回のループの実行時間を,その前後でgetTimeを呼ぶことで
     351         *  測定し,その測定結果から空ループの実行時間が0.4秒になるループ
     352         *  数を求め,task_loopに設定する.
    439353         *
    440          *  LOOP_REFは,デフォルトでは1,000,000に設定しているが,想定したよ
    441          *  り遅いプロセッサでは,サンプルプログラムの実行開始に時間がかか
    442          *  りすぎるという問題を生じる.逆に想定したより速いプロセッサでは,
    443          *  LOOP_REF回の空ループの実行時間が短くなり,task_loopに設定する値
    444          *  の誤差が大きくなるという問題がある.
    445          *
    446          *  そこで,そのようなターゲットでは,target_test.hで,LOOP_REFを適
    447          *  切な値に定義するのが望ましい.
     354         *  LOOP_REFは,デフォルトでは1,000,000に設定しているが,想定した
     355         *  より遅いプロセッサでは,サンプルプログラムの実行開始に時間がか
     356         *  かりすぎるという問題を生じる.逆に想定したより速いプロセッサで
     357         *  は,LOOP_REF回のループの実行時間が短くなり,task_loopに設定す
     358         *  る値の誤差が大きくなるという問題がある.そこで,そのようなター
     359         *  ゲットでは,target_test.hで,LOOP_REFを適切な値に定義すること
     360         *  とする.
    448361         *
    449362         *  また,task_loopの値を固定したい場合には,その値をTASK_LOOPにマ
    450          *  クロ定義する.TASK_LOOPがマクロ定義されている場合,上記の測定
    451          *  行わずに,TASK_LOOPに定義された値を空ループの回数とする.
     363         *  クロ定義する.TASK_LOOPがマクロ定義されている場合,上記の測定
     364         *  を行わずに,TASK_LOOPに定義された値をループの回数とする.
    452365         *
    453          * ターゲットによっては,空ループの実行時間の1回目の測定で,本来よ
    454          * も長めになるものがある.このようなターゲットでは,MEASURE_TWICE
    455          * をマクロ定義することで,1回目の測定結果を捨てて,2回目の測定結果
    456          * を使う.
     366         *  ターゲットによっては,ループの実行時間の1回目の測定で,本来より
     367         *  も長めになるものがある.このようなターゲットでは,MEASURE_TWICE
     368         *  をマクロ定義することで,1回目の測定結果を捨てて,2回目の測定結
     369         *  果を使う.
    457370         */
    458371#ifdef TASK_LOOP
     
    461374
    462375#ifdef MEASURE_TWICE
    463         task_loop = LOOP_REF;
    464         SVC_PERROR(get_tim(&stime1));
    465         for (i = 0; i < task_loop; i++);
    466         SVC_PERROR(get_tim(&stime2));
     376        SVC_PERROR(getTime(&stime1));
     377        consume_time(LOOP_REF);
     378        SVC_PERROR(getTime(&stime2));
    467379#endif /* MEASURE_TWICE */
    468380
    469         task_loop = LOOP_REF;
    470         SVC_PERROR(get_tim(&stime1));
    471         for (i = 0; i < task_loop; i++);
    472         SVC_PERROR(get_tim(&stime2));
     381        SVC_PERROR(getTime(&stime1));
     382        consume_time(LOOP_REF);
     383        SVC_PERROR(getTime(&stime2));
    473384        task_loop = LOOP_REF * 400LU / (ulong_t)(stime2 - stime1) * 1000LU;
    474385
     
    478389         *  タスクの起動
    479390         */
    480 
    481         SVC_PERROR(cTask_activate( 1 ));
    482         SVC_PERROR(cTask_activate( 2 ));
    483         SVC_PERROR(cTask_activate( 3 ));
     391        SVC_PERROR(cTask_activate(1));
     392        SVC_PERROR(cTask_activate(2));
     393        SVC_PERROR(cTask_activate(3));
    484394
    485395        /*
    486396         *  メインループ
    487397         */
    488         if (is_cSerialPort_joined()) {
    489                 do {
    490                         SVC_PERROR(cSerialPort_read(&c, 1));
    491                         switch (c) {
    492                         case 'e':
    493                         case 's':
    494                         case 'S':
    495                         case 'd':
    496                         case 'y':
    497                         case 'Y':
    498                         case 'z':
    499                         case 'Z':
    500                                 message[tskno-1] = c;
    501                                 break;
    502                         case '1':
    503                                 tskno = 1;
    504                                 break;
    505                         case '2':
    506                                 tskno = 2;
    507                                 break;
    508                         case '3':
    509                                 tskno = 3;
    510                                 break;
    511                         case 'a':
    512                                 syslog(LOG_INFO, "#cTask_activate(%d)", tskno);
    513                                 SVC_PERROR(cTask_activate(tskno));
    514                                 break;
    515                         case 'A':
    516                                 syslog(LOG_INFO, "#cTask_cancelActivate(%d)", tskno);
    517                                 SVC_PERROR(cTask_cancelActivate(tskno));
    518 
    519                                 if (ercd >= 0) {
    520                                         syslog(LOG_NOTICE, "cTask_cancelActivate(%d) returns %d", tskno, ercd);
    521                                 }
    522                                 break;
    523                         case 't':
    524                                 syslog(LOG_INFO, "#cTask_terminate(%d)", tskno);
    525                                 SVC_PERROR(cTask_terminate(tskno));
    526                                 break;
    527                         case '>':
    528                                 syslog(LOG_INFO, "#cTask_changePriority(%d, HIGH_PRIORITY)", tskno);
    529                                 SVC_PERROR(cTask_changePriority(tskno, HIGH_PRIORITY));
    530                                 break;
    531                         case '=':
    532                                 syslog(LOG_INFO, "#cTask_changePriority(%d, MID_PRIORITY)", tskno);
    533                                 SVC_PERROR(cTask_changePriority(tskno, MID_PRIORITY));
    534                                 break;
    535                         case '<':
    536                                 syslog(LOG_INFO, "#(cTask_changePriority(%d, LOW_PRIORITY)", tskno);
    537                                 SVC_PERROR(cTask_changePriority(tskno, LOW_PRIORITY));
    538                                 break;
    539                         case 'G':
    540                                 syslog(LOG_INFO, "#cTask_getPriority(%d, &tskpri)", tskno);
    541                                 SVC_PERROR(ercd = cTask_getPriority(tskno, &tskpri));
    542                                 if (ercd >= 0) {
    543                                         syslog(LOG_NOTICE, "priority of task %d is %d", tskno, tskpri);
    544                                 }
    545                                 break;
    546                         case 'w':
    547                                 syslog(LOG_INFO, "#cTask_wakeup(%d)", tskno);
    548                                 SVC_PERROR(cTask_wakeup(tskno));
    549                                 break;
    550                         case 'W':
    551                                 syslog(LOG_INFO, "#cTask_cancelWakeup(%d)", tskno);
    552                                 SVC_PERROR(ercd = cTask_cancelWakeup(tskno));
    553                                 if (ercd >= 0) {
    554                                         syslog(LOG_NOTICE, "cTask_cancelWakeup(%d) returns %d", tskno, ercd);
    555                                 }
    556                                 break;
    557                         case 'l':
    558                                 syslog(LOG_INFO, "#cTask_releaseWait(%d)", tskno);
    559                                 SVC_PERROR(cTask_releaseWait(tskno));
    560                                 break;
    561                         case 'u':
    562                                 syslog(LOG_INFO, "#cTask_suspend(%d)", tskno);
    563                                 SVC_PERROR(cTask_suspend(tskno));
    564                                 break;
    565                         case 'm':
    566                                 syslog(LOG_INFO, "#cTask_resume(%d)", tskno);
    567                                 SVC_PERROR(cTask_resume(tskno));
    568                                 break;
    569                         case 'x':
    570                                 syslog(LOG_INFO, "#cTask_raiseTerminate(%d)", tskno);
    571                                 SVC_PERROR(cTask_raiseTerminate(tskno));
    572                                 break;
    573                         case 'X':
    574                                 syslog(LOG_INFO, "#cTask_raiseTerminate(%d)", tskno);
    575                                 SVC_PERROR(cTask_raiseTerminate(tskno));
    576                                 break;
    577                         case 'r':
    578                                 syslog(LOG_INFO, "#rotateReadyQueue(three priorities)");
    579                                 SVC_PERROR(rotateReadyQueue(HIGH_PRIORITY));
    580                                 SVC_PERROR(rotateReadyQueue(MID_PRIORITY));
    581                                 SVC_PERROR(rotateReadyQueue(LOW_PRIORITY));
    582                                 break;
    583                         case 'c':
    584                                 syslog(LOG_INFO, "#cCyclic_start(1)");
    585                                 SVC_PERROR(cCyclic_start());
    586                                 break;
    587                         case 'C':
    588                                 syslog(LOG_INFO, "#cCyclic_stop(1)");
    589                                 SVC_PERROR(cCyclic_stop());
    590                                 break;
    591                         case 'b':
    592                                 syslog(LOG_INFO, "#cAlarm_start(1, 5000000)");
    593                                 SVC_PERROR(cAlarm_start(5000000));
    594                                 break;
    595                         case 'B':
    596                                 syslog(LOG_INFO, "#cAlarm_stop()(1)");
    597                                 SVC_PERROR(cAlarm_stop());
    598                                 break;
    599                         case 'V':
    600                                 hrtcnt1 = fetchHighResolutionTimer();
    601                                 hrtcnt2 = fetchHighResolutionTimer();
    602                                 syslog(LOG_NOTICE, "hrtcnt1 = %tu, hrtcnt2 = %tu",
    603                                                                                         hrtcnt1, hrtcnt2);
    604                                 break;
    605                         case 'v':
    606                                 SVC_PERROR(cSysLog_mask(LOG_UPTO(LOG_INFO),
    607                                                                                         LOG_UPTO(LOG_EMERG)));
    608                                 break;
    609                         case 'q':
    610                                 SVC_PERROR(cSysLog_mask(LOG_UPTO(LOG_NOTICE),
    611                                                                                         LOG_UPTO(LOG_EMERG)));
    612                                 break;
    613 #ifdef BIT_KERNEL
    614                         case ' ':
    615                                 SVC_PERROR(lockCpu());
    616                                 {
    617                                         extern ER       bit_kernel(void);
    618 
    619                                         SVC_PERROR(ercd = bit_kernel());
    620                                         if (ercd >= 0) {
    621                                                 syslog(LOG_NOTICE, "bit_kernel passed.");
    622                                         }
    623                                 }
    624                                 SVC_PERROR(unlockCpu());
    625                                 break;
    626 #endif /* BIT_KERNEL */
    627 
    628                         default:
    629                                 break;
     398        do {
     399                SVC_PERROR(cSerialPort_read(&c, 1));
     400                switch (c) {
     401                case 'e':
     402                case 's':
     403                case 'S':
     404                case 'd':
     405                case 'y':
     406                case 'Y':
     407                case 'z':
     408                case 'Z':
     409                        message[tskno-1] = c;
     410                        break;
     411                case '1':
     412                        tskno = 1;
     413                        break;
     414                case '2':
     415                        tskno = 2;
     416                        break;
     417                case '3':
     418                        tskno = 3;
     419                        break;
     420                case 'a':
     421                        syslog(LOG_INFO, "#cTask_activate(%d)", tskno);
     422                        SVC_PERROR(cTask_activate(tskno));
     423                        break;
     424                case 'A':
     425                        syslog(LOG_INFO, "#cTask_cancelActivate(%d)", tskno);
     426                        SVC_PERROR(ercd = cTask_cancelActivate(tskno));
     427                        if (ercd >= 0) {
     428                                syslog(LOG_NOTICE, "cTask_cancelActivate(%d) returns %d",
     429                                                                                                                        tskno, ercd);
    630430                        }
    631                 } while (c != '\003' && c != 'Q');
    632         } else {
    633                 syslog(LOG_NOTICE, "cSerialPort of tSample2 is not joined.");
    634                 syslog(LOG_NOTICE, "Sample program will halt after 40 seconds.");
    635                 for (j = 0; j < 100; j++) {
    636                         for (i = 0; i < task_loop; i++);
     431                        break;
     432                case 't':
     433                        syslog(LOG_INFO, "#cTask_terminate(%d)", tskno);
     434                        SVC_PERROR(cTask_terminate(tskno));
     435                        break;
     436                case '>':
     437                        syslog(LOG_INFO, "#cTask_changePriority(%d, HIGH_PRIORITY)", tskno);
     438                        SVC_PERROR(cTask_changePriority(tskno, HIGH_PRIORITY));
     439                        break;
     440                case '=':
     441                        syslog(LOG_INFO, "#cTask_changePriority(%d, MID_PRIORITY)", tskno);
     442                        SVC_PERROR(cTask_changePriority(tskno, MID_PRIORITY));
     443                        break;
     444                case '<':
     445                        syslog(LOG_INFO, "#(cTask_changePriority(%d, LOW_PRIORITY)", tskno);
     446                        SVC_PERROR(cTask_changePriority(tskno, LOW_PRIORITY));
     447                        break;
     448                case 'G':
     449                        syslog(LOG_INFO, "#cTask_getPriority(%d, &tskpri)", tskno);
     450                        SVC_PERROR(ercd = cTask_getPriority(tskno, &tskpri));
     451                        if (ercd >= 0) {
     452                                syslog(LOG_NOTICE, "priority of task %d is %d", tskno, tskpri);
     453                        }
     454                        break;
     455                case 'w':
     456                        syslog(LOG_INFO, "#cTask_wakeup(%d)", tskno);
     457                        SVC_PERROR(cTask_wakeup(tskno));
     458                        break;
     459                case 'W':
     460                        syslog(LOG_INFO, "#cTask_cancelWakeup(%d)", tskno);
     461                        SVC_PERROR(ercd = cTask_cancelWakeup(tskno));
     462                        if (ercd >= 0) {
     463                                syslog(LOG_NOTICE, "cTask_cancelWakeup(%d) returns %d",
     464                                                                                                                        tskno, ercd);
     465                        }
     466                        break;
     467                case 'l':
     468                        syslog(LOG_INFO, "#cTask_releaseWait(%d)", tskno);
     469                        SVC_PERROR(cTask_releaseWait(tskno));
     470                        break;
     471                case 'u':
     472                        syslog(LOG_INFO, "#cTask_suspend(%d)", tskno);
     473                        SVC_PERROR(cTask_suspend(tskno));
     474                        break;
     475                case 'm':
     476                        syslog(LOG_INFO, "#cTask_resume(%d)", tskno);
     477                        SVC_PERROR(cTask_resume(tskno));
     478                        break;
     479                case 'x':
     480                        syslog(LOG_INFO, "#cTask_raiseTerminate(%d)", tskno);
     481                        SVC_PERROR(cTask_raiseTerminate(tskno));
     482                        break;
     483                case 'X':
     484                        syslog(LOG_INFO, "#cTask_raiseTerminate(%d)", tskno);
     485                        SVC_PERROR(cTask_raiseTerminate(tskno));
     486                        break;
     487                case 'r':
     488                        syslog(LOG_INFO, "#rotateReadyQueue(three priorities)");
     489                        SVC_PERROR(rotateReadyQueue(HIGH_PRIORITY));
     490                        SVC_PERROR(rotateReadyQueue(MID_PRIORITY));
     491                        SVC_PERROR(rotateReadyQueue(LOW_PRIORITY));
     492                        break;
     493                case 'c':
     494                        syslog(LOG_INFO, "#cCyclic_start()");
     495                        SVC_PERROR(cCyclic_start());
     496                        break;
     497                case 'C':
     498                        syslog(LOG_INFO, "#cCyclic_stop()");
     499                        SVC_PERROR(cCyclic_stop());
     500                        break;
     501                case 'b':
     502                        syslog(LOG_INFO, "#cAlarm_start(5000000)");
     503                        SVC_PERROR(cAlarm_start(5000000));
     504                        break;
     505                case 'B':
     506                        syslog(LOG_INFO, "#cAlarm_stop()");
     507                        SVC_PERROR(cAlarm_stop());
     508                        break;
     509
     510                case 'V':
     511                        hrtcnt1 = fetchHighResolutionTimer();
     512                        consume_time(1000LU);
     513                        hrtcnt2 = fetchHighResolutionTimer();
     514                        syslog(LOG_NOTICE, "hrtcnt1 = %tu, hrtcnt2 = %tu",
     515                                                                (uint32_t) hrtcnt1, (uint32_t) hrtcnt2);
     516                        break;
     517
     518                case 'v':
     519                        SVC_PERROR(cSysLog_mask(LOG_UPTO(LOG_INFO),
     520                                                                                LOG_UPTO(LOG_EMERG)));
     521                        break;
     522                case 'q':
     523                        SVC_PERROR(cSysLog_mask(LOG_UPTO(LOG_NOTICE),
     524                                                                                LOG_UPTO(LOG_EMERG)));
     525                        break;
     526
     527                case '\003':
     528                case 'Q':
     529                        break;
     530
     531                default:
     532                        syslog(LOG_INFO, "Unknown command: '%c'.", c);
     533                        break;
    637534                }
    638         }
     535        } while (c != '\003' && c != 'Q');
    639536
    640537        syslog(LOG_NOTICE, "Sample program ends.");
    641         SVC_PERROR(ciKernel_exitKernel());
     538        SVC_PERROR(exitKernel());
    642539        assert(0);
    643540}
  • EcnlProtoTool/trunk/asp3_dcre/sample/tSample2.cdl

    r321 r429  
    44 *  $Id$
    55 */
     6
    67/*
    78 *  カーネルオブジェクトの定義
    89 */
    9 import("kernel.cdl");
     10import(<kernel.cdl>);
    1011
    1112/*
     
    1415import("syssvc/tSerialPort.cdl");
    1516import("syssvc/tSysLog.cdl");
     17import("syssvc/tSysLogAdapter.cdl");
    1618import("syssvc/tLogTask.cdl");
    1719import("syssvc/tBanner.cdl");
     
    2325
    2426/*
     27 *  サンプルプログラムのC言語ヘッダファイルの取り込み
     28 */
     29import_C("tSample2.h");
     30
     31/*
    2532 *  「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};"
    2633 *  の行までのことを言う.
     
    2835
    2936/*
    30  *  システムログ機能の組上げ記述
     37 *              システムログ機能のアダプタの組上げ記述
     38 *
     39 *  システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー
     40 *  スのシステムログ機能を呼び出すためのセルである.システムログ機能の
     41 *  サービスコール(syslog,syslog_0~syslog_5,t_perrorを含む)を呼び
     42 *  出さない場合には,以下のセルの組上げ記述を削除してよい.
     43 */
     44cell tSysLogAdapter SysLogAdapter {
     45        cSysLog = SysLog.eSysLog;
     46};
     47
     48/*
     49 *              システムログ機能の組上げ記述
    3150 *
    3251 *  システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ
     
    4261        initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)");
    4362                                                                                /* 低レベル出力すべき重要度 */
    44 
    4563        /* 低レベル出力との結合 */
    4664        cPutLog = PutLogTarget.ePutLog;
     
    4866
    4967/*
    50  *  シリアルインタフェースドライバの組上げ記述
     68 *              シリアルインタフェースドライバの組上げ記述
    5169 *
    5270 *  シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記
     
    6583
    6684/*
    67  *  システムログタスクの組上げ記述
     85 *              システムログタスクの組上げ記述
    6886 *
    6987 *  システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ
     
    86104
    87105/*
    88  *  カーネル起動メッセージ出力の組上げ記述
     106 *              カーネル起動メッセージ出力の組上げ記述
    89107 *
    90108 *  カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述
     
    98116
    99117/*
    100  *  サンプルプログラムの定義
     118 *              サンプルプログラムのセルタイプの定義
    101119 */
    102120[singleton]
     
    111129        call sAlarm         cAlarm;
    112130
    113         [optional] call sSerialPort     cSerialPort;/* シリアルドライバとの接続 */
     131        call sSerialPort        cSerialPort;    /* シリアルドライバとの接続 */
    114132        call sSysLog            cSysLog;                /* システムログ機能との接続 */
    115133       
     
    118136        entry sTaskBody         eExceptionTask; /* 例外処理タスク */
    119137       
    120         entry siHandlerBody eiCyclicHandler;/* 周期ハンドラ*/
    121         entry siHandlerBody eiAlarmHandler; /* アラームハンドラ */
    122 };
    123 
    124 /*
    125  *  組み上げ記述
    126  */
    127 
    128 /* Sample2のプロトタイプ宣言 */
    129 cell tSample2 Sample2;
    130 
    131 cell tKernel ASPKernel{
     138        entry siHandlerBody eiCyclicHandler;    /* 周期ハンドラ*/
     139        entry siHandlerBody eiAlarmHandler;             /* アラームハンドラ */
     140
     141        entry siHandlerBody     eiISR;                          /* 割込みサービスルーチン */
     142
     143        entry siCpuExceptionHandlerBody eiCpuExceptionHandler;
     144                                                                                        /* CPU例外ハンドラ */
     145};
     146
     147/*
     148 *              組み上げ記述
     149 */
     150
     151cell tKernel ASPKernel {
    132152};
    133153
     
    181201
    182202cell tAlarmHandler AlarmHandler {
     203        /* 呼び口の結合 */
    183204        ciHandlerBody = Sample2.eiAlarmHandler;
    184205};
    185206
     207cell tInterruptRequest InterruptRequest {
     208        /* 属性の設定 */
     209        interruptNumber = C_EXP("INTNO1");
     210        attribute = C_EXP("INTNO1_INTATR");
     211        interruptPriority = C_EXP("INTNO1_INTPRI");
     212};
     213
     214cell tISR InterruptServiceRoutine {
     215        /* 呼び口の結合 */
     216        ciISRBody = Sample2.eiISR;
     217        /* 属性の設定 */
     218        attribute = C_EXP("TA_NULL");
     219        interruptNumber = C_EXP("INTNO1");
     220};
     221
     222cell tCpuExceptionHandler CpuExceptionHandler {
     223        /* 呼び口の結合 */
     224        ciCpuExceptionHandlerBody = Sample2.eiCpuExceptionHandler;
     225        /* 属性の設定 */
     226        cpuExceptionHandlerNumber = C_EXP("CPUEXC1");
     227};
     228
    186229cell tSample2 Sample2 {
    187230        /* 呼び口の結合 */
    188         cTask[ 0 ] = MainTask.eTask;
    189         cTask[ 1 ] = Task1.eTask;
    190         cTask[ 2 ] = Task2.eTask;
    191         cTask[ 3 ] = Task3.eTask;
     231        cTask[0] = MainTask.eTask;
     232        cTask[1] = Task1.eTask;
     233        cTask[2] = Task2.eTask;
     234        cTask[3] = Task3.eTask;
    192235
    193236        cExceptionTask = ExceptionTask.eTask;
  • EcnlProtoTool/trunk/asp3_dcre/sample/tSample2.cfg

    r321 r429  
    44 *  $Id$
    55 */
    6 INCLUDE("gen/tecsgen.cfg");
    7 
    8 #include "tSample2.h"
    9 
    10 #ifdef CPUEXC1
    11 DEF_EXC(CPUEXC1, { TA_NULL, cpuexc_handler });
    12 #endif /* CPUEXC1 */
     6INCLUDE("tecsgen.cfg");
  • EcnlProtoTool/trunk/asp3_dcre/sample/tSample2.h

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2004-2007 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2004-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5555
    5656#define EXC_PRIORITY    1               /* 例外処理タスクの優先度 */
    57 #define MAIN_PRIORITY   6               /* メインタスクの優先度 */
     57#define MAIN_PRIORITY   5               /* メインタスクの優先度 */
    5858                                                                /* HIGH_PRIORITYより高くすること */
    5959
     
    7575
    7676/*
    77  *  関数のプロトタイプ宣言
     77 *  必要な定義のチェック
    7878 */
    79 #ifndef TOPPERS_MACRO_ONLY
    80 
    81 //extern void   task(intptr_t exinf);
    82 extern void     main_task(intptr_t exinf);
    83 extern void     cyclic_handler(intptr_t exinf);
    84 extern void     alarm_handler(intptr_t exinf);
    85 extern void     cpuexc_handler(void *p_excinf);
    86 
    87 #endif /* TOPPERS_MACRO_ONLY */
     79#ifndef INTNO1
     80#error INTNO1 is necessary for this sample program.
     81#endif /* INTNO1 */
     82#ifndef CPUEXC1
     83#error CPUEXC1 is necessary for this sample program.
     84#endif /* CPUEXC1 */
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/histogram.h

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems
    44 *
    5  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    66 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    77 *
     
    5454 *  実行時間分布計測の初期化
    5555 */
    56 extern void     init_hist(ID histid);
     56extern ER       init_hist(ID histid);
    5757
    5858/*
    5959 *  実行時間計測の開始
    6060 */
    61 extern void     begin_measure(ID histid);
     61extern ER       begin_measure(ID histid);
    6262
    6363/*
    6464 *  実行時間計測の終了
    6565 */
    66 extern void     end_measure(ID histid);
     66extern ER       end_measure(ID histid);
    6767
    6868/*
    6969 *  実行時間分布計測の表示
    7070 */
    71 extern void     print_hist(ID histid);
     71extern ER       print_hist(ID histid);
    7272
    7373#ifdef __cplusplus
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/serial.h

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
     
    4847#define TOPPERS_SERIAL_H
    4948
    50 #include <kernel.h>
    51 
    5249#ifdef __cplusplus
    5350extern "C" {
    5451#endif
     52
     53#include <kernel.h>
    5554
    5655/*
     
    6261} T_SERIAL_RPOR;
    6362
     63#ifdef TOPPERS_OMIT_TECS
     64/*
     65 *  シリアルインタフェースドライバの初期化ルーチン
     66 */
     67extern void             serial_initialize(intptr_t exinf) throw();
     68
     69/*
     70 *  シリアルインタフェースドライバからの未送信文字の取出し
     71 */
     72extern bool_t   serial_get_chr(ID portid, char *p_c) throw();
     73#endif
     74
    6475/*
    6576 *  シリアルインタフェースドライバのサービスコール
     
    6778extern ER               serial_opn_por(ID portid) throw();
    6879extern ER               serial_cls_por(ID portid) throw();
    69 extern ER_UINT  serial_rea_dat(ID portid, char *buf, uint_t len) throw();
     80extern ER_UINT  serial_trea_dat(ID portid, char *buf, uint_t len, TMO tmout) throw();
    7081extern ER_UINT  serial_wri_dat(ID portid, const char *buf, uint_t len) throw();
    7182extern ER               serial_ctl_por(ID portid, uint_t ioctl) throw();
    7283extern ER               serial_ref_por(ID portid, T_SERIAL_RPOR *pk_rpor) throw();
     84
     85Inline ER_UINT  serial_rea_dat(ID portid, char *buf, uint_t len)
     86{
     87        return serial_trea_dat(portid, buf, len, TMO_FEVR);
     88}
    7389
    7490/*
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/syslog.h

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
     
    5554#include <t_syslog.h>
    5655
     56#ifdef TOPPERS_OMIT_TECS
     57/*
     58 *  ログバッファのサイズ
     59 */
     60#ifndef TCNT_SYSLOG_BUFFER
     61#define TCNT_SYSLOG_BUFFER      32              /* ログバッファのサイズ */
     62#endif /* TCNT_SYSLOG_BUFFER */
     63
     64/*
     65 *  システムログ機能の初期化
     66 */
     67extern void     syslog_initialize(intptr_t exinf) throw();
     68#endif
     69
     70/*
     71 *  ログ情報の重要度のビットマップを作るためのマクロ
     72 */
     73#define LOG_MASK(prio)          (1U << (prio))
     74#define LOG_UPTO(prio)          ((1U << ((prio) + 1)) - 1)
     75
     76/*
     77 *  パケット形式の定義
     78 */
     79typedef struct t_syslog_rlog {
     80        uint_t  count;          /* ログバッファ中のログの数 */
     81        uint_t  lost;           /* 失われたログの数 */
     82        uint_t  logmask;        /* ログバッファに記録すべき重要度 */
     83        uint_t  lowmask;        /* 低レベル出力すべき重要度 */
     84} T_SYSLOG_RLOG;
     85
    5786/*
    5887 *  ログ情報の出力
     
    6897 *  出力すべきログ情報の重要度の設定
    6998 */
    70 extern ER       syslog_msk_log(uint_t logmask, uint_t lowmask) throw();
     99extern ER               syslog_msk_log(uint_t logmask, uint_t lowmask) throw();
    71100
    72101/*
    73102 *  ログバッファの状態参照
    74103 */
    75 extern ER       syslog_ref_log(T_SYSLOG_RLOG *pk_rlog) throw();
     104extern ER               syslog_ref_log(T_SYSLOG_RLOG *pk_rlog) throw();
    76105
    77106/*
    78107 *  低レベル出力によるすべてのログ情報の出力
    79108 */
    80 extern ER       syslog_fls_log(void) throw();
     109extern ER               syslog_fls_log(void) throw();
    81110
    82111#ifdef __cplusplus
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tBanner.cdl

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2016 by Embedded and Real-Time Systems Laboratory
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tBannerMain.c

    r321 r429  
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2004-2017 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    5656"Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory\n"
    5757"                            Toyohashi Univ. of Technology, JAPAN\n"
    58 "Copyright (C) 2004-2017 by Embedded and Real-Time Systems Laboratory\n"
     58"Copyright (C) 2004-2019 by Embedded and Real-Time Systems Laboratory\n"
    5959"            Graduate School of Information Science, Nagoya Univ., JAPAN\n"
    6060"%s";
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tHistogram.c

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems
    44 *
    5  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    66 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    77 *
     
    4343
    4444#include "tHistogram_tecsgen.h"
    45 #define syslog_write    cSysLog_write
    4645#include <t_syslog.h>
    47 #include <log_output.h>
    4846
    4947/*
    5048 *  実行時間分布計測の初期化(受け口関数)
    5149 */
    52 void
     50ER
    5351eHistogram_initialize(CELLIDX idx)
    5452{
     
    6159        VAR_over = 0U;
    6260        VAR_under = 0U;
     61        return(E_OK);
    6362}
    6463
     
    6665 *  実行時間計測の開始(受け口関数)
    6766 */
    68 void
     67ER
    6968eHistogram_beginMeasure(CELLIDX idx)
    7069{
     
    7372        HIST_BM_HOOK();
    7473        HIST_GET_TIM(&VAR_begin_time);
     74        return(E_OK);
    7575}
    7676
     
    7878 *  実行時間計測の終了(受け口関数)
    7979 */
    80 void
     80ER
    8181eHistogram_endMeasure(CELLIDX idx)
    8282{
     
    103103                VAR_under++;
    104104        }
     105        return(E_OK);
    105106}
    106107
     
    108109 *  実行時間分布計測の表示(受け口関数)
    109110 */
    110 void
     111ER
    111112eHistogram_print(CELLIDX idx)
    112113{
     
    125126                syslog_1(LOG_NOTICE, "> INT_MAX : %d", VAR_under);
    126127        }
     128        return(E_OK);
    127129}
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tHistogram.cdl

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems
    44 *
    5  *  Copyright (C) 2016 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2016-2018 by Embedded and Real-Time Systems Laboratory
    66 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    77 *
     
    5151         *  実行時間分布計測の初期化
    5252         */
    53         void    initialize(void);
     53        ER      initialize(void);
    5454
    5555        /*
    5656         *  実行時間計測の開始
    5757         */
    58         void    beginMeasure(void);
     58        ER      beginMeasure(void);
    5959
    6060        /*
    6161         *  実行時間計測の終了
    6262         */
    63         void    endMeasure(void);
     63        ER      endMeasure(void);
    6464
    6565        /*
    6666         *  実行時間分布計測の表示
    6767         */
    68         void    print(void);
     68        ER      print(void);
    6969};
    7070
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tHistogramAdapter.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    6  *  Copyright (C) 2016 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2016-2018 by Embedded and Real-Time Systems Laboratory
    76 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    87 *
     
    4847
    4948/*
     49 *  実行時間分布計測IDの範囲の判定
     50 */
     51#define VALID_HISTID(histid)    (1 <= histid && histid <= N_CP_cHistogram)
     52
     53/*
    5054 *  実行時間分布計測の初期化(サービスコール)
    5155 */
    52 void
     56ER
    5357init_hist(ID histid)
    5458{
    55         assert(1 <= histid && histid <= N_CP_cHistogram);
    56         return(cHistogram_initialize(histid - 1));
     59        ER              ercd;
     60
     61        if (!VALID_HISTID(histid)) {
     62                ercd = E_ID;
     63        }
     64        else {
     65                ercd = cHistogram_initialize(histid - 1);
     66        }
     67        return(ercd);
    5768}
    5869
     
    6071 *  実行時間計測の開始
    6172 */
    62 void
     73ER
    6374begin_measure(ID histid)
    6475{
    65         assert(1 <= histid && histid <= N_CP_cHistogram);
    66         return(cHistogram_beginMeasure(histid - 1));
     76        ER              ercd;
     77
     78        if (!VALID_HISTID(histid)) {
     79                ercd = E_ID;
     80        }
     81        else {
     82                ercd = cHistogram_beginMeasure(histid - 1);
     83        }
     84        return(ercd);
    6785}
    6886
     
    7088 *  実行時間計測の終了
    7189 */
    72 void
     90ER
    7391end_measure(ID histid)
    7492{
    75         assert(1 <= histid && histid <= N_CP_cHistogram);
    76         return(cHistogram_endMeasure(histid - 1));
     93        ER              ercd;
     94
     95        if (!VALID_HISTID(histid)) {
     96                ercd = E_ID;
     97        }
     98        else {
     99                ercd = cHistogram_endMeasure(histid - 1);
     100        }
     101        return(ercd);
    77102}
    78103
     
    80105 *  実行時間分布計測の表示
    81106 */
    82 void
     107ER
    83108print_hist(ID histid)
    84109{
    85         assert(1 <= histid && histid <= N_CP_cHistogram);
    86         return(cHistogram_print(histid - 1));
     110        ER              ercd;
     111
     112        if (!VALID_HISTID(histid)) {
     113                ercd = E_ID;
     114        }
     115        else {
     116                ercd = cHistogram_print(histid - 1);
     117        }
     118        return(ercd);
    87119}
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tLogTask.cdl

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2015 by Ushio Laboratory
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tLogTaskMain.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    76 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    98 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    109 *
     
    8281        }
    8382        else {
    84                 for (;;) {
     83                while (true) {
    8584                        if (cSysLog_refer(&rlog) < 0) {
    8685                                ercd = E_SYS;
     
    113112                        rercd = dly_tsk(ATTR_flushWait);
    114113                        if (rercd < 0) {
    115                                 ercd = (rercd == E_RLWAI) ? rercd : E_SYS;
     114                                ercd = (MERCD(rercd) == E_RLWAI) ? rercd : E_SYS;
    116115                                goto error_exit;
    117116                        }
     
    130129{
    131130        SYSLOG  syslog;
    132         uint_t  lost;
    133131        ER_UINT rercd;
    134132
     
    136134        syslog_0(LOG_NOTICE, "System logging task is started.");
    137135
    138         for (;;) {
    139                 lost = 0U;
     136        while (true) {
    140137                while ((rercd = cSysLog_read(&syslog)) >= 0) {
    141                         lost += (uint_t) rercd;
    142                         if (lost > 0U) {
    143                                 syslog_lostmsg(lost, logtask_putc);
    144                                 lost = 0U;
     138                        if (((uint_t) rercd) > 0U) {
     139                                syslog_lostmsg((uint_t) rercd, logtask_putc);
    145140                        }
    146141                        syslog_print(&syslog, logtask_putc);
    147                         logtask_putc('\n');
    148142                }
    149                 if (lost > 0U) {
    150                         syslog_lostmsg(lost, logtask_putc);
    151                 }
    152                 dly_tsk(ATTR_interval);
     143                (void) dly_tsk(ATTR_interval);
    153144        }
    154145}
     
    189180                        syslog_lostmsg((uint_t) rercd, target_fput_log);
    190181                }
    191                 if (syslog.logtype >= LOG_TYPE_COMMENT) {
    192                         syslog_print(&syslog, target_fput_log);
    193                         target_fput_log('\n');
    194                 }
     182                syslog_print(&syslog, target_fput_log);
    195183        }
    196184}
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tSerialAdapter.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     
    8382 */
    8483ER_UINT
    85 serial_rea_dat(ID portid, char *buf, uint_t len)
     84serial_trea_dat(ID portid, char *buf, uint_t len, TMO tmout)
    8685{
    8786        if (sns_dpn()) {                                /* コンテキストのチェック */
     
    9291        }
    9392
    94         return(cSerialPort_read(portid - 1, buf, len));
     93        return(cSerialPort_read(portid - 1, buf, len, tmout));
    9594}
    9695
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tSerialPort.cdl

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2015 by Ushio Laboratory
     
    5756        ER              open(void);
    5857        ER              close(void);
    59         ER_UINT read([out,size_is(length)] char *buffer, [in] uint_t length);
     58        ER_UINT read([out,size_is(length)] char *buffer, [in] uint_t length, [in] TMO tmout);
    6059        ER_UINT write([in,size_is(length)] const char *buffer, [in] uint_t length);
    6160        ER              control([in] uint_t ioControl);
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tSerialPortMain.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    76 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2006-2015 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    98 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    109 *
     
    242241
    243242/*
    244  *  シリアルポートへの文字送信
     243 *  SIOポートへの文字送信
    245244 *
    246  *  p_cellcbで指定されるSIOポートに対して,文字cを送信する.文字を送信
    247  *  レジスタにいれた場合にはtrueを返す.そうでない場合には,送信レジス
    248  *  タが空いたことを通知するコールバック関数を許可し,falseを返す.この
    249  *  関数は,CPUロック状態で呼び出される.
     245 *  p_cellcbで指定されるシリアルポートに対応するSIOポートに対して,文
     246 *  字cを送信する.文字を送信レジスタにいれた場合にはtrueを返す.そう
     247 *  でない場合には,送信レジスタが空いたことを通知するコールバック関数
     248 *  を許可し,falseを返す.この関数は,CPUロック状態で呼び出される.
    250249 */
    251250Inline bool_t
     
    268267{
    269268        bool_t  buffer_full;
    270         ER              ercd, rercd;
     269        ER_BOOL ercd;
     270        ER              rercd;
    271271
    272272        /*
     
    359359 *  シリアルポートからの1文字受信
    360360 */
    361 static bool_t
     361static ER_BOOL
    362362serialPort_readChar(CELLCB *p_cellcb, char *p_c)
    363363{
    364364        bool_t  buffer_empty;
    365         ER              ercd;
     365        ER_BOOL ercd;
    366366
    367367        SVC(loc_cpu(), gen_ercd_sys(p_cellcb));
     
    397397 */
    398398ER_UINT
    399 eSerialPort_read(CELLIDX idx, char *buffer, uint_t length)
     399eSerialPort_read(CELLIDX idx, char *buffer, uint_t length, TMO tmout)
    400400{
    401401        CELLCB  *p_cellcb;
     
    423423        while (reacnt < length) {
    424424                if (buffer_empty) {
    425                         SVC(rercd = cReceiveSemaphore_wait(),
    426                                                                                 gen_ercd_wait(rercd, p_cellcb));
     425                        rercd = cReceiveSemaphore_waitTimeout(tmout);
     426                        if (rercd == E_TMOUT)
     427                                return E_TMOUT;
     428                        if (rercd < 0) {
     429                                gen_ercd_wait(rercd, p_cellcb);
     430                                ercd = rercd;
     431                                goto error_exit;
     432                        }
    427433                }
    428434                SVC(rercd = serialPort_readChar(p_cellcb, &c), rercd);
     
    519525        if (VAR_receiveFlowControl != '\0') {
    520526                /*
    521                  *  START/STOP を送信する.
     527                 *  START/STOPを送信する.
    522528                 */
    523529                (void) cSIOPort_putChar(VAR_receiveFlowControl);
     
    569575                 */
    570576                VAR_sendStopped = false;
    571                 if (VAR_sendCount > 0U) {
     577                while (VAR_sendCount > 0U) {
    572578                        c = VAR_sendBuffer[VAR_sendReadPointer];
    573579                        if (serialPort_sendChar(p_cellcb, c)) {
     
    580586                                VAR_sendCount--;
    581587                        }
     588                        else {
     589                                break;
     590                        }
    582591                }
    583592        }
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tSysLog.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    76 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     7 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    98 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    109 *
     
    5049#include <t_syslog.h>
    5150#include <log_output.h>
     51
     52/*
     53 *  トレースログに関する設定
     54 */
     55#ifdef TOPPERS_ENABLE_TRACE
     56#include "arch/tracelog/trace_log.h"
     57#endif /* TOPPERS_ENABLE_TRACE */
     58
     59/*
     60 *  ターゲット依存情報の定義
     61 */
    5262#include "target_syssvc.h"
    5363
     
    126136        if ((VAR_lowMask & LOG_MASK(priority)) != 0U) {
    127137                syslog_print(p_syslog, low_putchar);
    128                 low_putchar('\n');
    129138        }
    130139
     
    212221
    213222        while ((rercd = eSysLog_read(&logbuf)) >= 0) {
    214                 if (rercd > 0) {
     223                if (((uint_t) rercd) > 0U) {
    215224                        syslog_lostmsg((uint_t) rercd, low_putchar);
    216225                }
    217                 if (logbuf.logtype >= LOG_TYPE_COMMENT) {
    218                         syslog_print(&logbuf, low_putchar);
    219                         low_putchar('\n');
    220                 }
    221         }
    222 
    223         SIL_UNL_INT();
    224         return(E_OK);
    225 }
     226                syslog_print(&logbuf, low_putchar);
     227        }
     228
     229        SIL_UNL_INT();
     230        return(E_OK);
     231}
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tSysLog.cdl

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2015 by Ushio Laboratory
     
    4645
    4746/*
    48  *  システムログ出力に関する定義
     47 *  システムログ機能に関する定義
    4948 */
    50 import_C("t_syslog.h");
     49import_C("syssvc/syslog.h");
    5150
    5251/*
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tSysLogAdapter.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    65 *  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tTestService.c

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    6  *  Copyright (C) 2016 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2016-2018 by Embedded and Real-Time Systems Laboratory
    76 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    87 *
     
    5251 *  テストプログラムの開始(受け口関数)
    5352 */
    54 void
     53ER
    5554eTestService_start(const char *progname)
    5655{
    5756        syslog_1(LOG_NOTICE, "Test program: %s", progname);
    5857        VAR_check_count = 0U;
    59 }
    60 
    61 /*
    62  *      自己診断関数の設定
    63  */
    64 void
    65 eTestService_setBuiltInTest(Descriptor(sBuiltInTest) desc)
    66 {
    67         cBuiltInTest_set_descriptor(desc);
     58        return(E_OK);
    6859}
    6960
     
    8778 *      チェックポイント(受け口関数)
    8879 */
    89 void
     80ER
    9081eTestService_checkPoint(uint_t count)
    9182{
     
    133124         */
    134125        SIL_UNL_INT();
     126        return(E_OK);
    135127}
    136128
     
    138130 *      完了チェックポイント(受け口関数)
    139131 */
    140 void
     132ER
    141133eTestService_finishPoint(uint_t count)
    142134{
     
    146138        }
    147139        test_finish();
     140        return(E_OK);
    148141}
    149142
     
    151144 *      条件チェックのエラー処理(受け口関数)
    152145 */
    153 void
     146ER
    154147eTestService_assertError(const char *expr, const char *file, int_t line)
    155148{
     
    157150                                                                                                expr, file, line);
    158151        test_finish();
    159 }
    160 
    161 /*
    162  *      エラーコードチェックのエラー処理(受け口関数)
    163  */
    164 void
    165 eTestService_serviceError(ER ercd, const char *file, int_t line)
    166 {
    167         syslog_3(LOG_ERROR, "## Unexpected error %s detected at %s:%u.\007",
    168                                                                                 itron_strerror(ercd), file, line);
    169         test_finish();
     152        return(E_OK);
    170153}
    171154
     
    174157 */
    175158ER
     159eTestService_serviceError(ER ercd, const char *file, int_t line)
     160{
     161        syslog_3(LOG_ERROR, "## Unexpected error %s detected at %s:%u.\007",
     162                                                                                itron_strerror(ercd), file, line);
     163        test_finish();
     164        return(E_OK);
     165}
     166
     167/*
     168 *      割込み優先度マスクの取得(受け口関数)
     169 */
     170ER
    176171eTestService_getInterruptPriorityMask(PRI *p_ipm)
    177172{
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/tTestService.cdl

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    6  *  Copyright (C) 2016 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2016-2018 by Embedded and Real-Time Systems Laboratory
    76 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    87 *
     
    4645 *  自己診断サービスのシグニチャ
    4746 */
     47[callback]
    4848signature sBuiltInTest {
    4949        ER              builtInTest(void);
     
    5252/*
    5353 *  テストプログラム用サービスのシグニチャ
    54  *
    55  *  setBuiltInTestは,TECSの中では動的結合を使って実現すべきであるが,
    56  *  C言語のアプリケーションから呼び出しやすくするために,TECSの作法違
    57  *  反のコードとなっている.
    5854 *
    5955 *  getInterruptPriorityMaskは,そのままカーネルを呼び出すだけの関数で
     
    6460 */
    6561signature sTestService {
    66         void    start([in, string] const char *progname);
    67         void    setBuiltInTest([in] Descriptor(sBuiltInTest) desc);
    68         void    checkPoint([in] uint_t count);
    69         void    finishPoint([in] uint_t count);
    70         void    assertError([in, string] const char *expr,
     62        ER              start([in, string] const char *progname);
     63        ER              checkPoint([in] uint_t count);
     64        ER              finishPoint([in] uint_t count);
     65        ER              assertError([in, string] const char *expr,
    7166                                                        [in, string] const char *file, [in] int_t line);
    72         void    serviceError([in] ER ercd,
     67        ER              serviceError([in] ER ercd,
    7368                                                        [in, string] const char *file, [in] int_t line);
    7469        ER              getInterruptPriorityMask([out] PRI *p_ipm);
     
    8075[singleton, active]
    8176celltype tTestService {
    82         entry           sTestService    eTestService;
    83         [dynamic, optional] call        sBuiltInTest    cBuiltInTest;
    84         call            sSysLog                 cSysLog;
     77        entry                           sTestService    eTestService;
     78        call                            sSysLog                 cSysLog;
     79        [optional] call         sBuiltInTest    cBuiltInTest;
    8580
    8681        var {
     
    8883        };
    8984};
    90 
    91 /*
    92  *  自己診断サービスのディスクリプタを取得するシグニチャ
    93  */
    94 signature sGetBuiltInTestDescriptor {
    95         ER              getDescriptor([out] Descriptor(sBuiltInTest) *p_desc,
    96                                                                                                                 [in] int_t i);
    97 };
    98 
    99 /*
    100  *  自己診断サービスのディスクリプタを取得するセルタイプ
    101  */
    102 [singleton, active]
    103 celltype tBuiltInTestAdaptor {
    104         [ref_desc] call sBuiltInTest                            cBuiltInTest[];
    105         entry                   sGetBuiltInTestDescriptor       eGetBuiltInTestDescriptor;
    106 };
  • EcnlProtoTool/trunk/asp3_dcre/syssvc/test_svc.h

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
    54 *
    6  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     5 *  Copyright (C) 2005-2018 by Embedded and Real-Time Systems Laboratory
    76 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    87 *
     
    5453
    5554/*
    56  *  TECSで記述されたテストプログラム用のサービスを直接呼び出すための定義
    57  *
    58  *  C言語で記述されたアプリケーションから,TECSで記述されたテストプログ
    59  *  ラム用のサービスを呼び出すためには,アダプタを用いるのが正当な方法
    60  *  であるが,テストプログラム用のサービスがシングルトンであることを利
    61  *  用して直接呼び出す.
     55 *  テストプログラム用サービスのサービスコール
    6256 */
    63 extern void     tTestService_eTestService_start(const char* progname);
    64 extern void     tTestService_eTestService_setBuiltInTest(void *desc);
    65 extern void     tTestService_eTestService_checkPoint(uint_t count);
    66 extern void     tTestService_eTestService_finishPoint(uint_t count);
    67 extern void     tTestService_eTestService_assertError(const char* expr,
    68                                                                                         const char* file, int_t line);
    69 extern void     tTestService_eTestService_serviceError(ER ercd,
    70                                                                                         const char* file, int_t line);
    71 extern ER       tTestService_eTestService_getInterruptPriorityMask(PRI* p_ipm);
    72 
    73 /*
    74  *  テストプログラムの開始
    75  */
    76 Inline void
    77 test_start(const char *progname)
    78 {
    79         tTestService_eTestService_start(progname);
    80 }
    81 
    82 /*
    83  *      自己診断関数の設定
    84  */
    85 Inline void
    86 set_bit_service(void *bit_service)
    87 {
    88         tTestService_eTestService_setBuiltInTest(bit_service);
    89 }
    90 
    91 /*
    92  *      チェックポイント
    93  */
    94 Inline void
    95 check_point(uint_t count)
    96 {
    97         tTestService_eTestService_checkPoint(count);
    98 }
    99 
    100 /*
    101  *      完了チェックポイント
    102  */
    103 Inline void
    104 check_finish(uint_t count)
    105 {
    106         tTestService_eTestService_finishPoint(count);
    107 }
     57extern void     test_start(const char *progname);
     58extern void     check_point(uint_t count);
     59extern void     check_finish(uint_t count);
     60extern void     check_assert_error(const char *expr, const char *file, int_t line);
     61extern void     check_ercd_error(ER ercd, const char *file, int_t line);
     62extern ER       get_interrupt_priority_mask(PRI *p_ipm);
    10863
    10964/*
    11065 *      条件チェック
    11166 */
    112 Inline void
    113 check_assert_error(const char *expr, const char *file, int_t line)
    114 {
    115         tTestService_eTestService_assertError(expr, file, line);
    116 }
    117 
    11867#define check_assert(exp) \
    11968        ((void)(!(exp) ? (check_assert_error(#exp, __FILE__, __LINE__), 0) : 0))
     
    12271 *      エラーコードチェック
    12372 */
    124 Inline void
    125 check_ercd_error(ER ercd, const char *file, int_t line)
    126 {
    127         tTestService_eTestService_serviceError(ercd, file, line);
    128 }
    129 
    13073#define check_ercd(ercd, expected_ercd) \
    13174        ((void)((ercd) != (expected_ercd) ? \
     
    14689 *      割込み優先度マスクのチェック
    14790 */
    148 #define check_ipm(ipm) do {                                                                                             \
    149         PRI             intpri;                                                                                                         \
    150         ER              ercd;                                                                                                           \
    151                                                                                                                                                 \
    152         ercd = tTestService_eTestService_getInterruptPriorityMask(&intpri);     \
    153         check_ercd(ercd, E_OK);                                                                                         \
    154         check_assert(intpri == ipm);                                                                            \
     91#define check_ipm(ipm) do {                                                     \
     92        PRI             intpri;                                                                 \
     93        ER              ercd;                                                                   \
     94                                                                                                        \
     95        ercd = get_interrupt_priority_mask(&intpri);    \
     96        check_ercd(ercd, E_OK);                                                 \
     97        check_assert(intpri == ipm);                                    \
    15598} while (false);
    15699
     
    159102#endif
    160103
    161 /*
    162  *  TECSで記述された自己診断サービスを直接呼び出すための定義
    163  *
    164  *  C言語で記述されたアプリケーションから,TECSで記述された自己診断サー
    165  *  ビスを呼び出すためには,アダプタを用いるのが正当な方法であるが,自
    166  *  己診断サービスがシングルトンであることを利用して直接呼び出す.
    167  */
    168 extern ER       tBuiltInTestAdaptor_eGetBuiltInTestDescriptor_getDescriptor
    169                                                                                                 (void **p_desc, int_t i);
    170 
    171 Inline void *
    172 get_bit_kernel(void)
    173 {
    174         void    *desc;
    175 
    176         tBuiltInTestAdaptor_eGetBuiltInTestDescriptor_getDescriptor(&desc, 0);
    177         return(desc);
    178 }
    179 
    180 Inline void *
    181 get_bit_mutex(void)
    182 {
    183         void    *desc;
    184 
    185         tBuiltInTestAdaptor_eGetBuiltInTestDescriptor_getDescriptor(&desc, 1);
    186         return(desc);
    187 }
    188 
    189104#endif /* TOPPERS_TEST_SVC_H */
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/Makefile.target

    r321 r429  
    22#               Makefile のターゲット依存部(GR-PEACH用)
    33#
    4 #  $Id$
     4#  $Id: Makefile.target 732 2016-04-03 03:08:05Z ertl-hiro $
    55#
    66
     
    3131
    3232#
    33 MPCoreの種類の定義
     33FPUサポートとコーリングコンベンション
    3434#
    35 MPCORE_TYPE = CA9
     35#  FPUを使用する場合は,USE_ARM_FPUをマクロ定義し,使用するコーリング
     36#  コンベンションに応じて,-mfloat-abi=softfpまたは-mfloat-abi=hardオ
     37#  プションをつける.
     38#
     39#CDEFS := $(CDEFS) -DUSE_ARM_FPU
     40#COPTS := $(COPTS) -mfloat-abi=softfp
     41COPTS := $(COPTS) -mfloat-abi=hard
    3642
    3743#
     
    4652#
    4753KERNEL_DIRS := $(KERNEL_DIRS) $(TARGETDIR)
    48 KERNEL_COBJS := $(KERNEL_COBJS) target_kernel_impl.o core_pl310.o
     54KERNEL_COBJS := $(KERNEL_COBJS) target_kernel_impl.o
    4955KERNEL_ASMOBJS := $(KERNEL_ASMOBJS) target_support.o
    5056
     
    5561        CDEFS := $(CDEFS) -DTOPPERS_EXECUTE_ON_ROM
    5662        #LDSCRIPT = $(TARGETDIR)/gr_peach_rom.ld
    57         LDSCRIPT = $(SRCDIR)/mbed/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/TOOLCHAIN_GCC_ARM/RZA1H.ld
     63        LDSCRIPT = $(SRCDIR)/mbed/targets/TARGET_RENESAS/TARGET_RZA1XX/TARGET_RZ_A1H/device/TOOLCHAIN_GCC_ARM/RZA1H.ld
    5864else
    5965        CDEFS := $(CDEFS) -DTOPPERS_EXECUTE_ON_RAM
     
    6268
    6369#
    64 GNU開発環境のターゲットアーキテクチャの定義
     70チップ依存部
    6571#
    66 GCC_TARGET = arm-none-eabi
    67 #GCC_TARGET = arm-atollic-eabi
    68 
    69 #
    70 #  トレースログ記録のサンプルコードに関する定義
    71 #
    72 ifeq ($(ENABLE_TRACE),true)
    73         COPTS := $(COPTS) -DTOPPERS_ENABLE_TRACE
    74         SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/arch/tracelog
    75 endif
    76 
    77 #
    78 #  チップ依存部のインクルード
    79 #
    80 include $(SRCDIR)/arch/arm_gcc/rza1/Makefile.chip
     72include $(SRCDIR)/arch/$(CORE)_$(TOOL)/$(CHIP)/Makefile.chip
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/Makefile.tinet

    r321 r429  
    2929#   接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
    3030
    31 #   @(#) $Id$
     31#   @(#) $Id: Makefile.tinet,v 1.6 2012/07/18 04:17:01 abe Exp abe $
    3232#
    3333
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/cfg_dmy.c

    r321 r429  
    11#include "MBRZA1H.h"
     2#include <stdlib.h>
    23
    3 IRQHandler _kernel_inh_table[Renesas_RZ_A1_IRQ_MAX+1];
     4IRQHandler _kernel_inh_table[RZ_A1_IRQ_MAX+1];
    45uint32_t _kernel_excpt_nest_count = 0;
    56
     
    2324{
    2425}
     26
    2527void _kernel_irq_handler()
    2628{
     
    3032{
    3133}
     34
     35void __libc_init_array()
     36{
     37}
     38
     39void *memset(void *dst, int c, size_t size)
     40{
     41        return NULL;
     42}
     43
     44void *memcpy(void *dst, void * src, size_t size)
     45{
     46        return NULL;
     47}
     48
     49int main()
     50{
     51}
     52
     53void exit(int exitcd)
     54{
     55}
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/gr_peach.h

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
    5  *
     2 *  TOPPERS Software
     3 *      Toyohashi Open Platform for Embedded Real-Time Systems
     4 *
    65 *  Copyright (C) 2011-2016 by Embedded and Real-Time Systems Laboratory
    76 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    8  *
     7 * 
    98 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    109 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    2928 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    3029 *      免責すること.
    31  *
     30 * 
    3231 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3332 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3534 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3635 *  の責任を負わない.
    37  *
     36 *
     37 *  $Id$
    3838 */
    3939
     
    5858
    5959/*
     60 *  ボーレート設定
     61 */
     62#define UART_BAUDRATE           115200
     63
     64/*
    6065 *  LEDの点灯/消灯
    6166 */
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/gr_peach_ram.ld

    r321 r429  
    11/*
    2  *  $Id$
     2 *  $Id: gr_peach_ram.ld 720 2016-04-01 22:16:17Z ertl-hiro $
    33 */
    44
    5 OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm","elf32-littlearm")
     5OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
    66OUTPUT_ARCH(arm)
    77ENTRY(start);
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/gr_peach_rom.ld

    r321 r429  
    11/*
    2  *  $Id$
     2 *  $Id: gr_peach_rom.ld 720 2016-04-01 22:16:17Z ertl-hiro $
    33 */
    44
    5 OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm","elf32-littlearm")
     5OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
    66OUTPUT_ARCH(arm)
    77ENTRY(start);
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/tSIOPortGRPeach.cdl

    r321 r429  
    66 *  Copyright (C) 2015 by Ushio Laboratory
    77 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    4747
    4848/*
    49  *  GR-PEACHとRZ/A1に関する定義
     49 *  GR-PEACHのハードウェア資源の定義
    5050 */
    5151import_C("gr_peach.h");
    52 import_C("rza1.h");
    53 
    54 /*
    55  *  FIFO内蔵シリアルコミュニケーションインタフェース用 簡易SIOドライバ
    56  */
    57 import("tSCIF.cdl");
     52import_C("device.h");
     53
     54/*
     55 *  シリアルインタフェースドライバのチップ依存部(RZ/A1用)
     56 */
     57import("tMbedSerial.cdl");
    5858
    5959/*
     
    7373        call                    sSIOPort        cSIOPort;
    7474        [inline] entry  siSIOCBR        eiSIOCBR;
    75 
    76         /*
    77          *  割込み要求ライン操作のための結合
    78          */
    79         call    sInterruptRequest       cRxInterruptRequest;
    80         call    sInterruptRequest       cTxInterruptRequest;
    8175};
    8276
     
    8579 *  ト)のセルタイプ
    8680 */
    87 [active]
    8881composite tSIOPortGRPeach {
    8982        /*
     
    9790         */
    9891        attr {
    99                 uintptr_t       baseAddress;                            /* ベースアドレス */
    100                 INTNO           rxInterruptNumber;                      /* 受信割込み番号 */
    101                 INTNO           txInterruptNumber;                      /* 送信割込み番号 */
    102                 PRI                     isrPriority = 1;                        /* ISR優先度 */
    103                 PRI                     interruptPriority = -4;         /* 割込み優先度 */
     92                int32_t tx;                                                             /* 送信Pin */
     93                int32_t rx;                                                             /* 受信Pin */
    10494                uint32_t        baudRate = 115200;                      /* ボーレートの設定値 */
    10595        };
     
    10898         *  SIOドライバ
    10999         */
    110         cell tSCIF SCIF {
    111                 baseAddress = composite.baseAddress;
     100        cell tMbedSerial MbedSerial {
     101                tx          = composite.tx;
     102                rx          = composite.rx;
    112103                baudRate    = composite.baudRate;
    113104                ciSIOCBR    = SIOPortMain.eiSIOCBR;
     
    119110        cell tSIOPortGRPeachMain SIOPortMain {
    120111                ciSIOCBR            => composite.ciSIOCBR;
    121                 cSIOPort            = SCIF.eSIOPort;
    122                 cRxInterruptRequest = RxInterruptRequest.eInterruptRequest;
    123                 cTxInterruptRequest = TxInterruptRequest.eInterruptRequest;
     112                cSIOPort            = MbedSerial.eSIOPort;
    124113        };
    125114        composite.eSIOPort => SIOPortMain.eSIOPort;
    126 
    127         /*
    128          *  SIOの受信割込みサービスルーチンと割込み要求ライン
    129          */
    130         cell tISR RxISRInstance {
    131                 interruptNumber = composite.rxInterruptNumber;
    132                 isrPriority     = composite.isrPriority;
    133                 ciISRBody       = SCIF.eiRxISR;
    134         };
    135         cell tInterruptRequest RxInterruptRequest {
    136                 interruptNumber   = composite.rxInterruptNumber;
    137                 interruptPriority = composite.interruptPriority;
    138         };
    139 
    140         /*
    141          *  SIOの受信割込みサービスルーチンと割込み要求ライン
    142          */
    143         cell tISR TxISRInstance {
    144                 interruptNumber = composite.txInterruptNumber;
    145                 isrPriority     = composite.isrPriority;
    146                 ciISRBody       = SCIF.eiTxISR;
    147         };
    148         cell tInterruptRequest TxInterruptRequest {
    149                 interruptNumber   = composite.txInterruptNumber;
    150                 interruptPriority = composite.interruptPriority;
    151         };
    152115};
    153116
     
    157120 *  サンプルプログラムが使うポートが,SIOPortTarget1に固定されているた
    158121 *  め,ポート1とポート3を入れ換えている.具体的には,SIOPortTarget1は
    159  *  SCIFのチャネル2(チャネル番号は0から始まるので,ポート3のこと)に,
    160  *  SIOPortTarget3はSCIFのチャネル0につながっている.
     122 *  MbedSerialのチャネル2(チャネル番号は0から始まるので,ポート3のこと)に,
     123 *  SIOPortTarget3はMbedSerialのチャネル0につながっている.
    161124 */
    162125[prototype]
    163126cell tSIOPortGRPeach SIOPortTarget1 {
    164127        /* 属性の設定 */
    165         baseAddress       = C_EXP("SCIF2_BASE");
    166         rxInterruptNumber = C_EXP("INTNO_SCIF2_RXI");
    167         txInterruptNumber = C_EXP("INTNO_SCIF2_TXI");
     128        tx = C_EXP("P6_3");
     129        rx = C_EXP("P6_2");
    168130};
    169131
     
    171133cell tSIOPortGRPeach SIOPortTarget2 {
    172134        /* 属性の設定 */
    173         baseAddress       = C_EXP("SCIF1_BASE");
    174         rxInterruptNumber = C_EXP("INTNO_SCIF1_RXI");
    175         txInterruptNumber = C_EXP("INTNO_SCIF1_TXI");
     135        tx = C_EXP("P2_5");
     136        rx = C_EXP("P2_6");
    176137};
    177138
     
    179140cell tSIOPortGRPeach SIOPortTarget3 {
    180141        /* 属性の設定 */
    181         baseAddress       = C_EXP("SCIF0_BASE");
    182         rxInterruptNumber = C_EXP("INTNO_SCIF0_RXI");
    183         txInterruptNumber = C_EXP("INTNO_SCIF0_TXI");
     142        tx = C_EXP("P4_12");
     143        rx = C_EXP("P4_13");
    184144};
    185145
     
    187147cell tSIOPortGRPeach SIOPortTarget4 {
    188148        /* 属性の設定 */
    189         baseAddress       = C_EXP("SCIF3_BASE");
    190         rxInterruptNumber = C_EXP("INTNO_SCIF3_RXI");
    191         txInterruptNumber = C_EXP("INTNO_SCIF3_TXI");
     149        tx = C_EXP("P2_14");
     150        rx = C_EXP("P2_15");
    192151};
    193152
     
    195154cell tSIOPortGRPeach SIOPortTarget5 {
    196155        /* 属性の設定 */
    197         baseAddress       = C_EXP("SCIF4_BASE");
    198         rxInterruptNumber = C_EXP("INTNO_SCIF4_RXI");
    199         txInterruptNumber = C_EXP("INTNO_SCIF4_TXI");
     156        tx = C_EXP("P4_14");
     157        rx = C_EXP("P4_15");
    200158};
    201159
     
    203161cell tSIOPortGRPeach SIOPortTarget6 {
    204162        /* 属性の設定 */
    205         baseAddress       = C_EXP("SCIF5_BASE");
    206         rxInterruptNumber = C_EXP("INTNO_SCIF5_RXI");
    207         txInterruptNumber = C_EXP("INTNO_SCIF5_TXI");
     163        tx = C_EXP("P5_3");
     164        rx = C_EXP("P5_4");
    208165};
    209166
     
    211168cell tSIOPortGRPeach SIOPortTarget7 {
    212169        /* 属性の設定 */
    213         baseAddress       = C_EXP("SCIF6_BASE");
    214         rxInterruptNumber = C_EXP("INTNO_SCIF6_RXI");
    215         txInterruptNumber = C_EXP("INTNO_SCIF6_TXI");
     170        tx = C_EXP("P8_8");
     171        rx = C_EXP("P8_9");
    216172};
    217173
     
    219175cell tSIOPortGRPeach SIOPortTarget8 {
    220176        /* 属性の設定 */
    221         baseAddress       = C_EXP("SCIF7_BASE");
    222         rxInterruptNumber = C_EXP("INTNO_SCIF7_RXI");
    223         txInterruptNumber = C_EXP("INTNO_SCIF7_TXI");
    224 };
     177        tx = C_EXP("P5_0");
     178        rx = C_EXP("P5_1");
     179};
     180
     181[prototype]
     182cell tSIOPortGRPeach SIOPortTarget9 {
     183        /* 属性の設定 */
     184        tx = C_EXP("P8_14");
     185        rx = C_EXP("P8_15");
     186};
     187
     188[prototype]
     189cell tSIOPortGRPeach SIOPortTarget10 {
     190        /* 属性の設定 */
     191        tx = C_EXP("P8_13");
     192        rx = C_EXP("P8_11");
     193};
     194
     195[prototype]
     196cell tSIOPortGRPeach SIOPortTarget11 {
     197        /* 属性の設定 */
     198        tx = C_EXP("P11_10");
     199        rx = C_EXP("P11_11");
     200};
     201
     202[prototype]
     203cell tSIOPortGRPeach SIOPortTarget12 {
     204        /* 属性の設定 */
     205        tx = C_EXP("P6_6");
     206        rx = C_EXP("P6_7");
     207};
     208
     209[prototype]
     210cell tSIOPortGRPeach SIOPortTarget13 {
     211        /* 属性の設定 */
     212        tx = C_EXP("P5_6");
     213        rx = C_EXP("P5_7");
     214};
     215
     216[prototype]
     217cell tSIOPortGRPeach SIOPortTarget14 {
     218        /* 属性の設定 */
     219        tx = C_EXP("P11_1");
     220        rx = C_EXP("P11_2");
     221};
     222
     223[prototype]
     224cell tSIOPortGRPeach SIOPortTarget15 {
     225        /* 属性の設定 */
     226        tx = C_EXP("P7_4");
     227        rx = C_EXP("P7_5");
     228};
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/tSIOPortGRPeachMain_inline.h

    r321 r429  
    5757         */
    5858        cSIOPort_open();
    59 
    60         /*
    61          *  SIOの割込みマスクを解除する.
    62          */
    63         cRxInterruptRequest_enable();
    64         cTxInterruptRequest_enable();
    6559}
    6660
     
    7771         */
    7872        cSIOPort_close();
    79 
    80         /*
    81          *  SIOの割込みをマスクする.
    82          */
    83         cRxInterruptRequest_disable();
    84         cTxInterruptRequest_disable();
    8573}
    8674
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target.cdl

    r321 r429  
    66 *  Copyright (C) 2015 by Ushio Laboratory
    77 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    4242
    4343/*
     44 *              コンポーネント記述ファイルのターゲット依存部(GR-PEACH用)
     45 */
     46
     47/*
    4448 *  タスクのスタックサイズのデフォルト
    4549 */
     
    6064 *  ターゲット依存のセルタイプの定義
    6165 */
    62 import("tPutLogGRPeach.cdl");
     66import("syssvc/tPutLogSIOPort.cdl");
    6367import("tSIOPortGRPeach.cdl");
    6468
     
    7276 *  低レベル出力の組み上げ記述
    7377 */
    74 cell tPutLogGRPeach PutLogTarget {
     78cell tPutLogSIOPort PutLogTarget {
    7579        /* SIOドライバとの結合 */
    7680        cSIOPort = SIOPortTarget1.eSIOPort;
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_check.trb

    r321 r429  
    11# -*- coding: utf-8 -*-
    22#
    3 #               パス3の生成スクリプトのターゲット依存部(GR-PEACH用)
     3#               パス3の生成スクリプトのターゲット依存部
     4#
     5#  $Id: target_check.trb 1071 2018-11-25 01:27:37Z ertl-hiro $
    46#
    57
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_kernel.cfg

    r321 r429  
    44 *  $Id$
    55 */
    6 INCLUDE("target_timer.cfg")
     6INCLUDE("target_timer.cfg");
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_kernel.h

    r321 r429  
    1 /*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
    5  *
    6  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
    7  *              Graduate School of Information Science, Nagoya Univ., JAPAN
    8  *
    9  *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    10  *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
    11  *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
    12  *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
    13  *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
    14  *      スコード中に含まれていること.
    15  *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
    16  *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
    17  *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
    18  *      の無保証規定を掲載すること.
    19  *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
    20  *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
    21  *      と.
    22  *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
    23  *        作権表示,この利用条件および下記の無保証規定を掲載すること.
    24  *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
    25  *        報告すること.
    26  *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
    27  *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
    28  *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
    29  *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    30  *      免責すること.
    31  *
    32  *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    33  *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
    34  *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
    35  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    36  *  の責任を負わない.
    37  *
    38  *  $Id$
    39  */
    40 
    411/*
    422 *              kernel.hのターゲット依存部(GR-PEACH用)
     
    455 *  から直接インクルードすることはない.このファイルをインクルードする
    466 *  前に,t_stddef.hがインクルードされるので,それに依存してもよい.
     7 *
     8 *  $Id$
    479 */
    4810
    4911#ifndef TOPPERS_TARGET_KERNEL_H
    5012#define TOPPERS_TARGET_KERNEL_H
     13
     14/*
     15 *  高分解能タイマのタイマ周期
     16 *
     17 *  2^32 / 33.33…を丸めた値とする.
     18 */
     19#define TCYC_HRTCNT             128849019U
     20
     21/*
     22 *  高分解能タイマのカウント値の進み幅
     23 */
     24#define TSTEP_HRTCNT    1U
     25
     26/*
     27 *  オーバランハンドラの残りプロセッサ時間に指定できる最大値
     28 *
     29 *  この値をOSタイマへの設定値に変換してタイマに設定した後,タイマの現
     30 *  在値を読み出してμ秒単位に変換できる値としている.タイマの現在値を
     31 *  μ秒単位に変換する時に34を加えるため,以下の条件を満たす最大の値と
     32 *  する.
     33 *              (TMAX_OVRTIM * 33 + TMAX_OVRTIM / 3 + 1) + 34 < 2^32
     34 */
     35#define TMAX_OVRTIM             128849017U
    5136
    5237/*
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_kernel.trb

    r321 r429  
    11# -*- coding: utf-8 -*-
    22#
    3 #               パス2の生成スクリプトのターゲット依存部(GR-PEACH用)
     3#               パス2の生成スクリプトのターゲット依存部
     4#
     5#  $Id: target_kernel.trb 1071 2018-11-25 01:27:37Z ertl-hiro $
    46#
    57
     
    79#  生成スクリプトのチップ依存部
    810#
    9 IncludeTrb("chip_kernel.trb")
     11IncludeTrb("chip_kernel.trb");
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_kernel_impl.c

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems/
    44 *      Advanced Standard Profile Kernel
    5  *
    6  *  Copyright (C) 2007-2016 by Embedded and Real-Time Systems Laboratory
     5 * 
     6 *  Copyright (C) 2007-2018 by Embedded and Real-Time Systems Laboratory
    77 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    8  *
     8 * 
    99 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    1010 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    2929 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    3030 *      免責すること.
    31  *
     31 * 
    3232 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3333 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3535 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3636 *  の責任を負わない.
    37  *
     37 * 
    3838 *  $Id$
    3939 */
     
    4848#include "rza1.h"
    4949#include "scif.h"
    50 #include "core_pl310.h"
    51 #include "us_ticker_api.h"
     50
     51/*
     52 * C++のグローバルコンストラクタ呼び出し
     53 */
     54void __libc_init_array()
     55{
     56        /* グローバルコンストラクタでOS APIを呼び出す場合は、
     57           タスクが起動してから行う */
     58}
    5259
    5360/*
     
    6370 *  MMUへの設定属性(第1レベルディスクリプタ)
    6471 */
    65 #define MMU_ATTR_RAM    (ARM_MMU_DSCR1_SHARED|ARMV6_MMU_DSCR1_APX0 \
    66                                                         |ARM_MMU_DSCR1_TEX001|ARM_MMU_DSCR1_AP11 \
    67                                                         |ARM_MMU_DSCR1_CB11)
    68 #define MMU_ATTR_IODEV  (ARM_MMU_DSCR1_SHARED|ARMV6_MMU_DSCR1_APX0 \
    69                                                         |ARM_MMU_DSCR1_TEX000|ARM_MMU_DSCR1_AP11 \
    70                                                         |ARM_MMU_DSCR1_CB01|ARMV6_MMU_DSCR1_NOEXEC)
     72#define MMU_ATTR_RAM    (ARM_MMU_DSCR1_SHARED|ARM_MMU_DSCR1_TEX001 \
     73                                                        |ARMV6_MMU_DSCR1_AP011|ARM_MMU_DSCR1_CB11)
     74#define MMU_ATTR_IODEV  (ARM_MMU_DSCR1_SHARED|ARM_MMU_DSCR1_TEX000 \
     75                                                        |ARMV6_MMU_DSCR1_AP011|ARM_MMU_DSCR1_CB01 \
     76                                                        |ARMV6_MMU_DSCR1_NOEXEC)
     77
    7178/*
    7279 *  MMUの設定情報(メモリエリアの情報)
    7380 */
    74 ARM_MMU_CONFIG arm_memory_area[] = {
     81const ARM_MMU_CONFIG arm_memory_area[] = {
    7582        { SPI_ADDR, SPI_ADDR, SPI_SIZE, MMU_ATTR_RAM },
    7683        { SRAM_ADDR, SRAM_ADDR, SRAM_SIZE, MMU_ATTR_RAM },
     
    206213 *  システムログの低レベル出力のための初期化
    207214 *
    208  *  セルタイプtPutLogGRPeach内に実装されている関数を直接呼び出す.
    209  */
    210 extern void     tPutLogGRPeach_initialize(void);
     215 *  セルタイプtPutLogSIOPort内に実装されている関数を直接呼び出す.
     216 */
     217extern void     tPutLogSIOPort_initialize(void);
    211218
    212219/*
     
    244251
    245252        /*
    246          *  L2キャッシュコントローラ(PL310)の初期化
    247          */
    248         /*pl310_initialize(0x0U, ~0x0U);*/
    249 
    250         /*
    251253         *  LEDを青色に点灯させる
    252254         */
     
    254256
    255257        /*
    256          *  低レベル出力用にSIOを初期化
     258         *  SIOを初期化
    257259         */
    258260#ifndef TOPPERS_OMIT_TECS
    259         tPutLogGRPeach_initialize();
     261        tPutLogSIOPort_initialize();
    260262#endif /* TOPPERS_OMIT_TECS */
    261263}
     
    268270{
    269271        static int first = 1;
     272        extern void    software_term_hook(void);
     273        void (*volatile fp)(void) = software_term_hook;
     274
     275        /*
     276         *  software_term_hookへのポインタを,一旦volatile指定のあるfpに代
     277         *  入してから使うのは,0との比較が最適化で削除されないようにするた
     278         *  めである.
     279         */
     280        if (fp != 0) {
     281                (*fp)();
     282        }
    270283
    271284        /*
     
    293306        rza1_config_port(RZA1_PORT_P(6), led, set);
    294307}
    295 
    296 void us_ticker_init(void)
    297 {
    298 }
    299 
    300 uint32_t us_ticker_read()
    301 {
    302         ER ret;
    303         SYSTIM now;
    304 
    305         ret = get_tim(&now);
    306         if(ret != E_OK)
    307                 return 0;
    308 
    309         return now;
    310 }
    311 
    312 void us_ticker_set_interrupt(timestamp_t timestamp)
    313 {
    314         Asm("bkpt #0");
    315 }
    316 
    317 void us_ticker_disable_interrupt(void)
    318 {
    319 }
    320 
    321 void us_ticker_clear_interrupt(void)
    322 {
    323 }
    324 
    325 void wait(float s)
    326 {
    327         wait_us(s * 1000000.0f);
    328 }
    329 
    330 void wait_ms(int ms)
    331 {
    332         wait_us(ms * 1000);
    333 }
    334 
    335 void wait_us(int us)
    336 {
    337         ER ret;
    338 
    339         ret = dly_tsk(us);
    340         if (ret == E_CTX){
    341                 uint32_t start = us_ticker_read();
    342                 while ((us_ticker_read() - start) < (uint32_t)us);
    343         }
    344 }
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_kernel_impl.h

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems/
    44 *      Advanced Standard Profile Kernel
    5  *
     5 * 
    66 *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77 *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2006-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    10  *
     10 * 
    1111 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    1212 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    3131 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    3232 *      免責すること.
    33  *
     33 * 
    3434 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3535 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3737 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3838 *  の責任を負わない.
    39  *
     39 * 
    4040 *  $Id$
    4141 */
     
    5757
    5858/*
    59  *  トレースログに関する設定
    60  */
    61 #ifdef TOPPERS_ENABLE_TRACE
    62 #include "arch/tracelog/trace_log.h"
    63 #endif /* TOPPERS_ENABLE_TRACE */
    64 
    65 /*
    66  *  デフォルトの非タスクコンテキスト用のスタック領域の定義
    67  */
    68 #define DEFAULT_ISTKSZ  0x2000U         /* 8KB */
    69 
    70 /*
    7159 *  微少時間待ちのための定義(本来はSILのターゲット依存部)
    7260 */
    73 #define SIL_DLY_TIM1    352
    74 #define SIL_DLY_TIM2    200
     61#define SIL_DLY_TIM1    110
     62#define SIL_DLY_TIM2    72
    7563
    7664/*
     
    8472 *  ターゲットシステム依存の初期化
    8573 */
    86 extern void target_initialize(void);
     74extern void     target_initialize(void);
    8775
    8876/*
     
    9179 *  システムを終了する時に使う.
    9280 */
    93 extern void target_exit(void) NoReturn;
     81extern void     target_exit(void) NoReturn;
    9482
    9583#endif /* TOPPERS_MACRO_ONLY */
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_rename.def

    r331 r429  
    11# target_kernel_impl.c
     2arm_tnum_memory_area
     3arm_memory_area
    24target_initialize
    35target_exit
    46
    5 # tTraceLog.c
    6 log_dsp_enter
    7 log_dsp_leave
    8 log_inh_enter
    9 log_inh_leave
    10 log_exc_enter
    11 log_exc_leave
    12 
    137INCLUDE "chip"
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_rename.h

    r321 r429  
    77 *  target_kernel_impl.c
    88 */
     9#define arm_tnum_memory_area            _kernel_arm_tnum_memory_area
     10#define arm_memory_area                         _kernel_arm_memory_area
    911#define target_initialize                       _kernel_target_initialize
    1012#define target_exit                                     _kernel_target_exit
    11 
    12 /*
    13  *  tTraceLog.c
    14  */
    15 #define log_dsp_enter                           _kernel_log_dsp_enter
    16 #define log_dsp_leave                           _kernel_log_dsp_leave
    17 #define log_inh_enter                           _kernel_log_inh_enter
    18 #define log_inh_leave                           _kernel_log_inh_leave
    19 #define log_exc_enter                           _kernel_log_exc_enter
    20 #define log_exc_leave                           _kernel_log_exc_leave
    2113
    2214
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_sil.h

    r321 r429  
    11/*
    2  *  TOPPERS Software
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems
    4  *
    5  *  Copyright (C) 2007-2015 by Embedded and Real-Time Systems Laboratory
    6  *              Graduate School of Information Science, Nagoya Univ., JAPAN
    7  *
    8  *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    9  *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
    10  *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
    11  *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
    12  *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
    13  *      スコード中に含まれていること.
    14  *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
    15  *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
    16  *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
    17  *      の無保証規定を掲載すること.
    18  *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
    19  *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
    20  *      と.
    21  *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
    22  *        作権表示,この利用条件および下記の無保証規定を掲載すること.
    23  *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
    24  *        報告すること.
    25  *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
    26  *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
    27  *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
    28  *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    29  *      免責すること.
    30  *
    31  *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    32  *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
    33  *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
    34  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    35  *  の責任を負わない.
    36  *
    37  *  $Id$
    38  */
    39 
    40 /*
    41  *              sil.hのチップ依存部(GR-PEACH用)
     2 *              sil.hのターゲット依存部(GR-PEACH用)
    423 *
    434 *  このヘッダファイルは,sil.hからインクルードされる.他のファイルから
    445 *  直接インクルードすることはない.このファイルをインクルードする前に,
    456 *  t_stddef.hがインクルードされるので,それに依存してもよい.
     7 *
     8 *  $Id$
    469 */
    4710
     
    5720 *  コアで共通な定義(チップ依存部は飛ばす)
    5821 */
    59 #ifndef TECSGEN
    6022#include "core_sil.h"
    61 #endif /* TECSGEN */
    6223
    6324#endif /* TOPPERS_TARGET_SIL_H */
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_stddef.h

    r321 r429  
    1 /*
    2  *  TOPPERS Software
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems
    4  *
    5  *  Copyright (C) 2007-2016 by Embedded and Real-Time Systems Laboratory
    6  *              Graduate School of Information Science, Nagoya Univ., JAPAN
    7  *
    8  *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    9  *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
    10  *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
    11  *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
    12  *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
    13  *      スコード中に含まれていること.
    14  *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
    15  *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
    16  *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
    17  *      の無保証規定を掲載すること.
    18  *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
    19  *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
    20  *      と.
    21  *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
    22  *        作権表示,この利用条件および下記の無保証規定を掲載すること.
    23  *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
    24  *        報告すること.
    25  *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
    26  *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
    27  *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
    28  *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    29  *      免責すること.
    30  *
    31  *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    32  *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
    33  *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
    34  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    35  *  の責任を負わない.
    36  *
    37  *  $Id$
    38  */
    39 
    401/*
    412 *              t_stddef.hのターゲット依存部(GR-PEACH用)
     
    445 *  イルからは直接インクルードすることはない.他のヘッダファイルに先立っ
    456 *  て処理されるため,他のヘッダファイルに依存してはならない.
     7 *
     8 *  $Id$
    469 */
    4710
     
    5619
    5720/*
    58  *  開発環境で共通な定義
    59  */
    60 #ifndef TOPPERS_MACRO_ONLY
    61 #include <stdint.h>
    62 #endif /* TOPPERS_MACRO_ONLY */
    63 
    64 #define TOPPERS_STDFLOAT_TYPE1
    65 #include "tool_stddef.h"
    66 
    67 /*
    68  *  チッブ依存で共通な定義
     21 *  チッブで共通な定義
    6922 */
    7023#include "chip_stddef.h"
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_support.S

    r321 r429  
    5151#define CAST(type, val)         (val)           /* 型キャストを行うマクロ */
    5252#include "kernel_impl.h"
    53 #include "core_pl310.h"
     53#include "pl310.h"
    5454#include "core_asm.inc"
    5555
     
    7171        ldrb    r0, [r2]                /* ダミーリード */
    7272
    73         /* 
     73        /*
    7474         *  クロック関係の初期化
    7575         *
     
    103103
    104104#ifdef TOPPERS_RZA1H
    105         /* 
     105        /*
    106106         *  画像処理クロックを「×2/3」に(266.67MHz)
    107107         */
     
    115115#endif /* TOPPERS_RZA1H */
    116116
    117         /* 
     117        /*
    118118         *  ソフトウェアスタンバイ復帰中でなくなるまで待つ
    119119         */
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_syssvc.h

    r426 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
    5  *
    6  *  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    7  *                              Toyohashi Univ. of Technology, JAPAN
    8  *  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
    9  *              Graduate School of Information Science, Nagoya Univ., JAPAN
    10  *
    11  *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    12  *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
    13  *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
    14  *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
    15  *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
    16  *      スコード中に含まれていること.
    17  *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
    18  *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
    19  *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
    20  *      の無保証規定を掲載すること.
    21  *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
    22  *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
    23  *      と.
    24  *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
    25  *        作権表示,この利用条件および下記の無保証規定を掲載すること.
    26  *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
    27  *        報告すること.
    28  *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
    29  *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
    30  *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
    31  *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    32  *      免責すること.
    33  *
    34  *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    35  *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
    36  *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
    37  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    38  *  の責任を負わない.
    39  *
    40  *  $Id$
    41  */
    42 
    43 /*
    44  *              システムサービスのターゲット依存部(GR-PEACH用)
     2 *              システムサービスのターゲット依存部
    453 *
    464 *  システムサービスのターゲット依存部のヘッダファイル.システムサービ
    475 *  スのターゲット依存の設定は,できる限りコンポーネント記述ファイルで
    486 *  記述し,このファイルに記述するものは最小限とする.
     7 *
     8 *  $Id$
    499 */
    5010
    5111#ifndef TOPPERS_TARGET_SYSSVC_H
    5212#define TOPPERS_TARGET_SYSSVC_H
    53 
    54 #include "gr_peach.h"
    55 
    56 /*
    57  *  トレースログに関する設定
    58  */
    59 #ifdef TOPPERS_ENABLE_TRACE
    60 #include "arch/tracelog/trace_log.h"
    61 #endif /* TOPPERS_ENABLE_TRACE */
    6213
    6314/*
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_test.h

    r321 r429  
    33 *      Toyohashi Open Platform for Embedded Real-Time Systems/
    44 *      Advanced Standard Profile Kernel
    5  *
     5 * 
    66 *  Copyright (C) 2007-2016 by Embedded and Real-Time Systems Laboratory
    77 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    8  *
     8 * 
    99 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    1010 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     
    2929 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    3030 *      免責すること.
    31  *
     31 * 
    3232 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    3333 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     
    3535 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3636 *  の責任を負わない.
    37  *
     37 * 
    3838 *  $Id$
    3939 */
     
    4949
    5050/*
    51  *  サンプルプログラムで使用する割込みに関する定義
     51 *  サンプルプログラム/テストプログラムで使用する割込みに関する定義
    5252 */
    5353#define INTNO1                          INTNO_IRQ5
    5454#define INTNO1_INTATR           TA_ENAINT|TA_NEGEDGE
    55 #define INTNO1_INTPRI           -15
     55#define INTNO1_INTPRI           (-15)
    5656#define intno1_clear()          rza1_clear_irq(INTNO_IRQ5)
    5757
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_timer.cfg

    r321 r429  
    55 */
    66
    7 #include "gr_peach.h"
    87#include "target_timer.h"
    98
    109/*
    11  *  チップ依存部(RZ/A1用)
     10 *  チップ依存部
    1211 */
    1312INCLUDE("chip_timer.cfg");
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_timer.h

    r321 r429  
    11/*
    2  *  TOPPERS/ASP Kernel
    3  *      Toyohashi Open Platform for Embedded Real-Time Systems/
    4  *      Advanced Standard Profile Kernel
    5  *
    6  *  Copyright (C) 2007-2016 by Embedded and Real-Time Systems Laboratory
    7  *              Graduate School of Information Science, Nagoya Univ., JAPAN
    8  *
    9  *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    10  *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
    11  *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
    12  *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
    13  *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
    14  *      スコード中に含まれていること.
    15  *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
    16  *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
    17  *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
    18  *      の無保証規定を掲載すること.
    19  *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
    20  *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
    21  *      と.
    22  *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
    23  *        作権表示,この利用条件および下記の無保証規定を掲載すること.
    24  *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
    25  *        報告すること.
    26  *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
    27  *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
    28  *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
    29  *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
    30  *      免責すること.
    31  *
    32  *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
    33  *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
    34  *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
    35  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    36  *  の責任を負わない.
    37  *
     2 *              タイマドライバ
     3 *
    384 *  $Id$
    39  */
    40 
    41 /*
    42  *              タイマドライバ(GR-PEACH用)
    435 */
    446
     
    479
    4810/*
    49  *  チップで共通な定義(RZ/A1用)
     11 *  チップで共通な定義
    5012 */
    5113#include "chip_timer.h"
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_unrename.h

    r321 r429  
    88 *  target_kernel_impl.c
    99 */
     10#undef arm_tnum_memory_area
     11#undef arm_memory_area
    1012#undef target_initialize
    1113#undef target_exit
    12 
    13 /*
    14  *  tTraceLog.c
    15  */
    16 #undef log_dsp_enter
    17 #undef log_dsp_leave
    18 #undef log_inh_enter
    19 #undef log_inh_leave
    20 #undef log_exc_enter
    21 #undef log_exc_leave
    2214
    2315
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_user.txt

    r331 r429  
    33                GR-PEACH依存部 ユーザーズマニュアル
    44
    5                 対応バージョン: Release 3.1
    6                 最終更新: 2016年4月2
     5                対応バージョン: Release 3.5.0
     6                最終更新: 2019年10月6
    77
    88このドキュメントは,TOPPERS/ASP3カーネルのGR-PEACHターゲット依存部を使
     
    1414     Advanced Standard Profile Kernel
    1515
    16  Copyright (C) 2008-2016 by Embedded and Real-Time Systems Laboratory
     16 Copyright (C) 2008-2019 by Embedded and Real-Time Systems Laboratory
    1717             Graduate School of Information Science, Nagoya Univ., JAPAN
    1818 
    19  上記著作権者は,以下の(1)(4)の条件を満たす場合に限り,本ソフトウェ
     19 上記著作権者は,以下の(1)(4)の条件を満たす場合に限り,本ソフトウェ
    2020 ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
    2121 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     
    4646 の責任を負わない.
    4747 
    48  $Id: target_user.txt 1145 2017-02-06 04:26:43Z coas-nagasima $
     48 $Id: target_user.txt 1280 2019-10-06 01:47:52Z ertl-hiro $
    4949----------------------------------------------------------------------
    5050
     
    5757
    5858○目次
     59
     601.GR-PEACHターゲット依存部の概要
     61        1.1 対応するターゲットシステムとターゲット略称
     62        1.2 ターゲット依存部の構成
     63        1.3 依存している個別パッケージのバージョン番号
     64        1.4 開発環境/デバッグ環境と動作確認条件
     65        1.5 メモリマップ
     662.ターゲット定義事項の規定
     673.ドライバ関連の情報
     68        3.1 タイマドライバ
     69        3.2 シリアルインタフェースドライバ
     70        3.3 システムログの低レベル出力
     714.システム構築手順と実行手順
     72        4.1 ROM実行の場合の構築手順と実行手順
     73        4.2 RAM実行の場合の構築手順と実行手順
     74        4.3 ドライバのインストール
     755.リファレンス
     76        5.1 ディレクトリ構成・ファイル構成
     77        5.2 バージョン履歴
    5978
    6079
     
    98117                arm_gcc/doc/            ARM依存部に関するドキュメント
    99118                gcc/                            GCC開発環境依存部
    100                 tracelog/                       トレースログ記録のサンプルコード
    101119
    1021201.3 依存している個別パッケージのバージョン番号
    103121
    104 GR-PEACHターゲット依存部(バージョン 3.1.0)の個別パッケージが依存して
     122GR-PEACHターゲット依存部(バージョン 3.4.0)の個別パッケージが依存して
    105123いる個別パッケージと,動作確認を行ったバージョンは次の通り.
    106124
    107125        個別パッケージの名称      バージョン   個別パッケージファイル名
    108126        ------------------------------------------------------------------
    109         ターゲット非依存部               3.1.0           asp3-3.1.0.tar.gz
     127        ターゲット非依存部               3.4.0           asp3-3.4.0.tar.gz
    110128
    1111291.4 開発環境/デバッグ環境と動作確認条件
    112130
    113 開発環境として,以下のURLからプリビルド版をダウンロードすることができる
    114 GCC ARM Embeddedを用いている.
    115 
    116         https://launchpad.net/gcc-arm-embedded/
     131開発環境として,以下のURLからプリビルド版をダウンロードすることができ
     132るGNU ARM Embedded Toolchainを用いている(Cortex-MとCortex-R向けの開発
     133環境であるが,Cortex-A向けにも使用できる).
     134
     135        https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
    117136
    118137動作確認を行ったバージョンは次の通り.
    119138
    120         gcc: version 4.8.3 20140228
    121         binutils(objcopy,objdump):2.23.2.20140228
    122 
    123 デバッグ環境として,オンボードのCMSIS-DAPから,OpenOCDを経由して,GDB
    124 用いる環境で動作確認を行っている.動作確認を行ったデバッグ環境のバージョ
    125 ンは次の通り.
     139        gcc: 7.3.1 20180622
     140        binutils(objcopy,objdump):2.30.0.20180329
     141
     142デバッグ環境として,オンボードのCMSIS-DAPから,OpenOCDを経由して,GDB
     143を用いる環境で動作確認を行っている.動作確認を行ったデバッグ環境のバー
     144ジョンは次の通り.
    126145
    127146        gdb: 7.6.0.20140228-cvs
    128147        openocd: 0.10.0-dev-00287-g85cec24
    129148
    130 古いバージョンのOpenOCDでは正しく動作しないことが報告されているため,注
    131 意が必要である.
    132 
    133 GUIベースの開発環境/デバッグ環境として,Atollic TrueStudioを用いること
    134 ができる.
     149新しいgdb(8.1.0.20180315-git)を使用したところ,OpenOCDとうまく接続で
     150きなかったため,やや古いgdbを使用している.また,異なるバージョンの
     151OpenOCDでは正しく動作しないことが報告されているため,注意が必要である.
     152
     153GUIベースの開発環境/デバッグ環境として,Atollic TrueSTUDIOを用いるこ
     154とができる.
    135155
    1361561.5 メモリマップ
     
    143163        0xe8000000 - 0xffffffff:I/O領域(384MB),予約領域を含む
    144164
    145 内蔵SRAM領域の先頭の16KBは,ブートローダを置くために使用する.
     165シリアルフラッシュメモリの先頭の16KBは,ブートローダを置くために使用す
     166る.
    146167
    147168RAM実行の場合は,以下のメモリマップを想定している.
    148169
    149         0x20000000 - 0x200fffff:内蔵SRAM(1MB)… ROM領域として使用
    150         0x20100000 - 0x209fffff:内蔵SRAM(9MB)
     170        0x20000000 - 0x200fffff:ROMとみなす内蔵SRAM領域(1MB)
     171        0x20100000 - 0x209fffff:RAMとみなす内蔵SRAM領域(9MB)
    151172        0x3fe00000 - 0x3fffffff:I/O領域(2MB),予約領域を含む
    152173        0xe8000000 - 0xffffffff:I/O領域(384MB),予約領域を含む
     
    156177
    157178メモリマップを変更する場合には,target_kernel_impl.cとgr_peach_rom.ld
    158 (または,pr_peach_ram.kd)を修正する必要がある.
     179(または,pr_peach_ram.ld)を修正する必要がある.
    159180
    160181
     
    164185装されている.ARMコア依存部およびRZ/A1チップ依存部におけるターゲット定
    165186義事項の規定については,「ARM依存部 ユーザーズマニュアル」を参照するこ
    166 と.それらの規定以外に,GR-PEACHターゲット定義の事項はない.
     187と.
    167188
    168189
     
    180201コミュニケーションインタフェースをサポートしている.
    181202
    182 USB経由でホストと接続できるポートは,SCIFのチャネル2(チャネル番号は0か
    183 ら始まるので,ポート3に相当)である.一方,sample1.cdlでは,ログタスク
    184 およびサンプルプログラムが使うポートがポート1となっているため,ポート1
    185 とポート3を入れ換えている.すなわち,シリアルインタフェースドライバのポー
    186 ト1がSCIFのチャネル2,ポート2がチャネル1,ポート3がチャネル0,ポート4が
    187 チャネル3,…に対応している.
     203GR-PEACHでUSB経由でホストと接続できるポートは,SCIFのチャネル2(チャネ
     204ル番号は0から始まるので,ポート3に相当)である.一方,サンプルプログラ
     205ム(sample1.cdl)では,ログタスクおよびサンプルプログラムが使うポート
     206がポート1となっているため,ポート1とポート3を入れ換えている.すなわち,
     207シリアルインタフェースドライバのポート1がSCIFのチャネル2,ポート2がチャ
     208ネル1,ポート3がチャネル0,ポート4がチャネル3,…に対応している.この
     209対応を変更するには,tSIOPortGRPeach.cdlを修正する必要がある.
     210
     211各ポートは,以下の通りに設定している.
    188212
    189213        ボーレート:115200bps
     
    191215        パリティ:なし
    192216        ストップビット:1ビット
    193         フロー制御:なし
    194 
    195 この対応を変更するには,tSIOPortGRPeach.cdlを修正する必要がある.
     217
     218この設定は,RZ/A1チップ依存部で行っているが,tSIOPortGRPeach.cdlを修正
     219することで変更することができる.
    196220
    1972213.3 システムログの低レベル出力
     
    292316                renesas_rza1h_swd.cfg   OpenOCDの起動スクリプト
    293317                sf_boot.c                               ブートローダ(ROM実行用)
    294                 tPutLogGRPeach.c                システムログの低レベル出力
    295                 tPutLogGRPeach.cdl              システムログの低レベル出力のコンポーネント記述
    296318                tSIOPortGRPeach.cdl             シリアルインタフェースドライバのターゲット
    297319                                                                依存部(GR-PEACH用)のコンポーネント記述
    298                 tSIOPortGRPeachMain_inline.h    シリアルインタフェースドライバの
    299                                                                 ターゲット依存部(GR-PEACH用)
    300320                target.cdl                              コンポーネント記述ファイルのターゲット依存部
    301321                target_cfg1_out.h               cfg1_out.cのリンクに必要なスタブの定義
     
    322342
    323343        2016年5月15日      Release 3.1.0           最初の一般公開
     344        2017年7月21日      Release 3.2.0
     345        2018年4月19日      Release 3.3.0
     346        2019年3月20日      Release 3.4.0
     347        2019年10月6日      Release 3.5.0
    324348
    325349以上
  • EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/tinet_target_config.h

    r331 r429  
    182182#define NUM_IF_MBED_RXBUF               NUM_OF_RX_DESCRIPTOR    /* 受信バッファ数                      */
    183183
    184 #define TMO_IF_MBED_GET_NET_BUF 1000    /* [ms]、受信用 net_buf 獲得タイムアウト    */
     184#define TMO_IF_MBED_GET_NET_BUF 1000    /* [us]、受信用 net_buf 獲得タイムアウト    */
    185185                                        /* [s]、 送信タイムアウト                        */
    186186#define TMO_IF_MBED_XMIT                (2*IF_TIMER_HZ)
    187187
    188188/*#define IF_MBED_CFG_ACCEPT_ALL                 マルチキャスト、エラーフレームも受信するときはコメントを外す。*/
     189
     190/*
     191 *  Bluetooth USB PAN に関する定義
     192 */
     193
     194#define NUM_IF_BTUSB_TXBUF              2       /* 送信バッファ数                      */
     195#define NUM_IF_BTUSB_RXBUF              2       /* 受信バッファ数                      */
     196#define IF_BTUSB_BUF_PAGE_SIZE  1518    /* バッファサイズ */
     197
     198#define TMO_IF_BTUSB_GET_NET_BUF        1000    /* [us]、受信用 net_buf 獲得タイムアウト    */
     199                                        /* [s]、 送信タイムアウト                        */
     200#define TMO_IF_BTUSB_XMIT               (2*IF_TIMER_HZ)
    189201
    190202/*
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/kernel.cdl

    r321 r429  
    66 *  Copyright (C) 2015,2016 by Ushio Laboratory
    77 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    299299        ER              sendForce([in] intptr_t data);
    300300        ER              receive([out] intptr_t *p_data);
    301         ER              receivePolling([out] intptr_t *p_Data);
     301        ER              receivePolling([out] intptr_t *p_data);
    302302        ER              receiveTimeout([out] intptr_t *p_data, [in] TMO timeout);
    303303        ER              initialize(void);
     
    397397        ER              unlock(void);
    398398        ER              initialize(void);
    399         ER              refer([out] T_RSEM *pk_mutexStatus);
     399        ER              refer([out] T_RMTX *pk_mutexStatus);
    400400};
    401401
     
    501501
    502502        attr {
    503                 ID                              id = C_EXP("ALMID_$id$");
     503                ID                              id = C_EXP("CYCID_$id$");
    504504                [omit] ATR              attribute = C_EXP("TA_NULL");
    505505                [omit] bool_t   ignoreErrors = false;
     
    536536
    537537/*
    538  *  周期通知にユーザーハンドラを指定するための複合セルタイプ
     538 *  周期通知にタイムイベントハンドラを指定するための複合セルタイプ
    539539 */
    540540[active]
     
    544544
    545545        attr {
    546                 ID                              id = C_EXP("ALMID_$id$");
     546                ID                              id = C_EXP("CYCID_$id$");
    547547                [omit] ATR              attribute = C_EXP("TA_NULL");
    548548                [omit] RELTIM   cycleTime;
     
    630630
    631631/*
    632  *  アラーム通知にユーザーハンドラを指定するための複合セルタイプ
     632 *  アラーム通知にタイムイベントハンドラを指定するための複合セルタイプ
    633633 */
    634634[active]
     
    663663        ER              disable(void);
    664664        ER              enable(void);
     665        ER              clear(void);
     666        ER              raise(void);
     667        ER_BOOL probe(void);
    665668};
    666669
     
    715718
    716719        attr {
    717                 INHNO                   interruptHandlerNumber;
    718                 [omit] ATR              attribute = C_EXP("TA_NULL");
    719         };
    720 
    721         factory {
    722                 write("tecsgen.cfg",
    723                                 "DEF_INH(%s, { %s, tInterruptHandler_start });", attribute);
     720                [omit] INHNO    interruptHandlerNumber;
     721                [omit] ATR              attribute = C_EXP("TA_NULL");
     722        };
     723
     724        factory {
     725                write("tecsgen.cfg", "DEF_INH(%s, { %s, $id$_start });",
     726                                                                        interruptHandlerNumber, attribute);
     727                write("$ct$_tecsgen.h",
     728                                "#ifndef TOPPERS_MACRO_ONLY\n"
     729                                "extern void $id$_start(void);\n"
     730                                "#endif /* TOPPERS_MACRO_ONLY */\n");
     731                write("$ct$.c",
     732                                "void $id$_start()\n"
     733                                "{\n"
     734                                "    CELLCB *p_cellcb = $cbp$;\n"
     735                                "    ciInterruptHandlerBody_main();\n"
     736                                "}\n");
    724737        };
    725738        FACTORY {
    726739                write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
    727         };
     740                write("$ct$.c", "#include \"$ct$_tecsgen.h\"");
     741        };
     742};
     743
     744/*
     745 *  CPU例外ハンドラ本体のシグニチャ
     746 */
     747[context("non-task")]
     748signature siCpuExceptionHandlerBody {
     749        void    main([in] const void *p_excinf);
    728750};
    729751
     
    733755[active]
    734756celltype tCpuExceptionHandler {
    735         call    siHandlerBody   ciCpuExceptionHandlerBody;
    736 
    737         attr {
    738                 EXCNO                   cpuExceptionHandlerNumber;
    739                 [omit] ATR              attribute = C_EXP("TA_NULL");
    740         };
    741 
    742         factory {
    743                 write("tecsgen.cfg",
    744                                 "DEF_EXC(%s, { %s, tCpuExceptionHandler_start });", attribute);
     757        call    siCpuExceptionHandlerBody       ciCpuExceptionHandlerBody;
     758
     759        attr {
     760                [omit] EXCNO    cpuExceptionHandlerNumber;
     761                [omit] ATR              attribute = C_EXP("TA_NULL");
     762        };
     763
     764        factory {
     765                write("tecsgen.cfg", "DEF_EXC(%s, { %s, $id$_start });",
     766                                                                        cpuExceptionHandlerNumber, attribute);
     767                write("$ct$_tecsgen.h",
     768                                "#ifndef TOPPERS_MACRO_ONLY\n"
     769                                "extern void $id$_start(void *p_excinf);\n"
     770                                "#endif /* TOPPERS_MACRO_ONLY */\n");
     771                write("$ct$.c",
     772                                "void $id$_start(void *p_excinf)\n"
     773                                "{\n"
     774                                "    CELLCB *p_cellcb = $cbp$;\n"
     775                                "    ciCpuExceptionHandlerBody_main(p_excinf);\n"
     776                                "}\n");
    745777        };
    746778        FACTORY {
    747779                write("tecsgen.cfg", "#include \"$ct$_tecsgen.h\"");
     780                write("$ct$.c", "#include \"$ct$_tecsgen.h\"");
    748781        };
    749782};
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tAlarmNotifier_inline.h

    r321 r429  
    66 *  Copyright (C) 2015 by Ushio Laboratory
    77 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2015-2018 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    8181{
    8282        CELLCB  *p_cellcb = GET_CELLCB(idx);
    83         return(ista_alm(ATTR_id, alarmTime));
     83        return(sta_alm(ATTR_id, alarmTime));
    8484}
    8585
     
    9191{
    9292        CELLCB  *p_cellcb = GET_CELLCB(idx);
    93         return(istp_alm(ATTR_id));
     93        return(stp_alm(ATTR_id));
    9494}
    9595
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tFixedSizeMemoryPool_inline.h

    r321 r429  
    5151{
    5252        CELLCB  *p_cellcb = GET_CELLCB(idx);
    53         return(get_mpf( ATTR_id, p_block));
     53        return(get_mpf(ATTR_id, p_block));
    5454}
    5555
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tInitializeRoutine.c

    r321 r429  
    4646 *  初期化ルーチン本体の呼出し
    4747 */
    48 void  tInitializeRoutine_start(intptr_t exinf)
     48void
     49tInitializeRoutine_start(intptr_t exinf)
    4950{
    5051        CELLCB  *p_cellcb = (CELLCB *) exinf;
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tInterruptRequest_inline.h

    r321 r429  
    66 *  Copyright (C) 2015 by Ushio Laboratory
    77 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2015-2017 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    6464}
    6565
     66/*
     67 *  割込み要求のクリア
     68 */
     69Inline ER
     70eInterruptRequest_clear(CELLIDX idx)
     71{
     72        CELLCB  *p_cellcb = GET_CELLCB(idx);
     73        return(clr_int(ATTR_interruptNumber));
     74}
     75
     76/*
     77 *  割込みの要求
     78 */
     79Inline ER
     80eInterruptRequest_raise(CELLIDX idx)
     81{
     82        CELLCB  *p_cellcb = GET_CELLCB(idx);
     83        return(ras_int(ATTR_interruptNumber));
     84}
     85
     86/*
     87 *  割込み要求のチェック
     88 */
     89Inline ER_BOOL
     90eInterruptRequest_probe(CELLIDX idx)
     91{
     92        CELLCB  *p_cellcb = GET_CELLCB(idx);
     93        return(prb_int(ATTR_interruptNumber));
     94}
     95
    6696#endif /* TOPPERS_TINTERRUPTREQUEST_INLINE_H */
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tKernel_inline.h

    r321 r429  
    185185eKernel_getNthTask(PRI taskPriority, uint_t nth, ID* p_taskID)
    186186{
    187         return (get_nth(taskPriority, nth, p_taskID));
    188 }
     187        return(get_nth(taskPriority, nth, p_taskID));
     188}
     189
    189190/*
    190191 *  CPUロック状態への遷移
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tMutex_inline.h

    r321 r429  
    7171{
    7272        CELLCB  *p_cellcb = GET_CELLCB(idx);
    73         return(ploc_mtx(ATTR_id, timeout));
     73        return(tloc_mtx(ATTR_id, timeout));
    7474}
    7575
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tTask_inline.h

    r321 r429  
    66 *  Copyright (C) 2015 by Ushio Laboratory
    77 *              Graduate School of Engineering Science, Osaka Univ., JAPAN
    8  *  Copyright (C) 2015 by Embedded and Real-Time Systems Laboratory
     8 *  Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    99 *              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010 *
     
    191191{
    192192        CELLCB  *p_cellcb= GET_CELLCB(idx);
    193         return(iwup_tsk(ATTR_id));
     193        return(wup_tsk(ATTR_id));
    194194}
    195195
     
    201201{
    202202        CELLCB  *p_cellcb = GET_CELLCB(idx);
    203         return(irel_wai(ATTR_id));
     203        return(rel_wai(ATTR_id));
    204204}
    205205
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tTerminateRoutine.c

    r321 r429  
    4646 *  終了処理ルーチン本体の呼出し
    4747 */
    48 
    49 void  tTerminateRoutine_start(intptr_t exinf)
     48void
     49tTerminateRoutine_start(intptr_t exinf)
    5050{
    5151        CELLCB  *p_cellcb = (CELLCB *) exinf;
  • EcnlProtoTool/trunk/asp3_dcre/tecs_kernel/tecs_kernel.h

    r321 r429  
    4747#include <kernel.h>
    4848
    49 extern void     tTask_start(intptr_t exinf);
    50 
    51 extern void tTimeEventHandler_start(intptr_t exinf);
     49extern void tTask_start(intptr_t exinf);
    5250
    5351extern void tISR_start(intptr_t exinf);
    54 extern void tInterruptHandler_start(void);
    55 extern void tCpuExceptionHandler_start(void *p_excinf);
    5652
    5753extern void tInitializeRoutine_start(intptr_t exinf);
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/MANIFEST_for_asp3

    r270 r429  
    2525tecslib/core/tecs_lang.rb
    2626tecslib/core/tecsgen.rb
     27tecslib/core/tecsinfo.rb
     28tecslib/core/tool_info.rb
    2729tecslib/core/types.rb
     30tecslib/core/unjoin_plugin.rb
    2831tecslib/core/value.rb
    2932
     
    3639tecslib/plugin/CellPlugin.rb
    3740tecslib/plugin/CelltypePlugin.rb
     41tecslib/plugin/CompositePlugin.rb
    3842tecslib/plugin/DomainPlugin.rb
    3943tecslib/plugin/Mruby2CBridgePlugin.rb
    4044tecslib/plugin/MrubyBridgePlugin.rb
     45tecslib/plugin/MultiPlugin.rb
    4146tecslib/plugin/NotifierPlugin.rb
    4247tecslib/plugin/RPCPlugin.rb
     
    97102tecs/rpc/tTDR_inline.h
    98103tecs/rpc/tecs_rpc.h
     104tecs/rpc/tMessageBufferCEP.cdl
     105tecs/rpc/tMessageBufferCEP_inline.h
     106tecs/rpc/tMessageBufferChannel.cdl
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/MANIFEST_tecsgen_body

    r270 r429  
    22
    33Makefile
    4 
     4tecscde
     5tecscde.rb
    56tecsgen
    67tecsgen.rb
     8tecsgen_rcov.rb
    79tecsmerge
    810tecsmerge.rb
    9 tecslib/version.rb
    10 
     11cdelib/Makefile
     12cdelib/cell_plugin_dialog.rb
     13cdelib/cell_plugin_dialog_ui_definition.rb
     14cdelib/palette.rb
     15cdelib/saveload.rb
     16cdelib/tcontrol.rb
     17cdelib/tmodel.rb
     18cdelib/tview.rb
     19cdelib/version.rb
     20tecs/TECSInfo/TECSInfo.cdl
     21tecs/TECSInfo/TECSInfoAccessor.cdl
     22tecs/TECSInfo/nTECSInfo_tArrayTypeInfo.c
     23tecs/TECSInfo/nTECSInfo_tBoolTypeInfo.c
     24tecs/TECSInfo/nTECSInfo_tCallInfo.c
     25tecs/TECSInfo/nTECSInfo_tCellInfo.c
     26tecs/TECSInfo/nTECSInfo_tCelltypeInfo.c
     27tecs/TECSInfo/nTECSInfo_tDefinedTypeInfo.c
     28tecs/TECSInfo/nTECSInfo_tDescriptorTypeInfo.c
     29tecs/TECSInfo/nTECSInfo_tEntryInfo.c
     30tecs/TECSInfo/nTECSInfo_tFloatTypeInfo.c
     31tecs/TECSInfo/nTECSInfo_tFunctionInfo.c
     32tecs/TECSInfo/nTECSInfo_tIntTypeInfo.c
     33tecs/TECSInfo/nTECSInfo_tNamespaceInfo.c
     34tecs/TECSInfo/nTECSInfo_tParamInfo.c
     35tecs/TECSInfo/nTECSInfo_tPtrTypeInfo.c
     36tecs/TECSInfo/nTECSInfo_tRawEntryDescriptorInfo.c
     37tecs/TECSInfo/nTECSInfo_tRegionInfo.c
     38tecs/TECSInfo/nTECSInfo_tSignatureInfo.c
     39tecs/TECSInfo/nTECSInfo_tStructTypeInfo.c
     40tecs/TECSInfo/nTECSInfo_tTECSInfoAccessor.c
     41tecs/TECSInfo/nTECSInfo_tTECSInfoSub.c
     42tecs/TECSInfo/nTECSInfo_tTECSInfo_inline.h
     43tecs/TECSInfo/nTECSInfo_tTypeInfo.c
     44tecs/TECSInfo/nTECSInfo_tVarDeclInfo.c
     45tecs/TECSInfo/nTECSInfo_tVoidTypeInfo.c
     46tecs/TECSInfo/tTECSInfoAccessor.c
     47tecs/TLSFMalloc/README-TLSF.txt
     48tecs/TLSFMalloc/tTLSFMalloc.cdl
     49tecs/TLSFMalloc/tTLSFMalloc_inline.h
     50tecs/mruby/README-mruby.txt
     51tecs/mruby/TECSPointer.h
     52tecs/mruby/TECSStruct.h
     53tecs/mruby/mruby.cdl
     54tecs/mruby/mrubyBridge.txt
     55tecs/mruby/mrubyInitializer.cdl
     56tecs/mruby/mrubyPointers.cdl
     57tecs/mruby/mrubyTECSPointer.txt
     58tecs/mruby/mrubyTECSStruct.txt
     59tecs/mruby/mrubyVMs.cdl
     60tecs/mruby/nMruby_tBoolPointer.c
     61tecs/mruby/nMruby_tCharPointer.c
     62tecs/mruby/nMruby_tDouble64Pointer.c
     63tecs/mruby/nMruby_tFloat32Pointer.c
     64tecs/mruby/nMruby_tInt16Pointer.c
     65tecs/mruby/nMruby_tInt32Pointer.c
     66tecs/mruby/nMruby_tInt64Pointer.c
     67tecs/mruby/nMruby_tInt8Pointer.c
     68tecs/mruby/nMruby_tIntPointer.c
     69tecs/mruby/nMruby_tLongPointer.c
     70tecs/mruby/nMruby_tMruby.c
     71tecs/mruby/nMruby_tMrubyCyclicTaskBody.c
     72tecs/mruby/nMruby_tMrubyProc.c
     73tecs/mruby/nMruby_tMrubyTaskBody.c
     74tecs/mruby/nMruby_tMrubyVM.c
     75tecs/mruby/nMruby_tSCharPointer.c
     76tecs/mruby/nMruby_tShortPointer.c
     77tecs/mruby/nMruby_tTECSInitializer.c
     78tecs/mruby/nMruby_tUCharPointer.c
     79tecs/mruby/nMruby_tUInt16Pointer.c
     80tecs/mruby/nMruby_tUInt32Pointer.c
     81tecs/mruby/nMruby_tUInt64Pointer.c
     82tecs/mruby/nMruby_tUInt8Pointer.c
     83tecs/mruby/nMruby_tUIntPointer.c
     84tecs/mruby/nMruby_tULongPointer.c
     85tecs/mruby/nMruby_tUShortPointer.c
     86tecs/mruby/sMruby.cdl
     87tecs/mruby/tMruby.cdl
     88tecs/mruby/tecs_mruby.h
     89tecs/posix/posix.cdl
     90tecs/rpc/PPAllocator.cdl
     91tecs/rpc/RPCTask.cdl
     92tecs/rpc/TDR.cdl
     93tecs/rpc/rpc.cdl
     94tecs/rpc/rpc_string.h
     95tecs/rpc/sChannel.cdl
     96tecs/rpc/sRPCErrorHandler.cdl
     97tecs/rpc/tDataqueueAdaptor_inline.h
     98tecs/rpc/tDataqueueOWChannel.cdl
     99tecs/rpc/tMessageBufferCEP.cdl
     100tecs/rpc/tMessageBufferCEP_inline.h
     101tecs/rpc/tMessageBufferChannel.cdl
     102tecs/rpc/tNBOTDR_inline.h
     103tecs/rpc/tPPAllocator.c
     104tecs/rpc/tRPCDedicatedTaskMain.c
     105tecs/rpc/tRPCDedicatedTaskMainWithOpener.c
     106tecs/rpc/tRPCSharedChannelMan.c
     107tecs/rpc/tRPCSharedTaskMain.c
     108tecs/rpc/tRPCSharedTaskMainWithOpener.c
     109tecs/rpc/tSocketChannel.cdl
     110tecs/rpc/tSocketClient.c
     111tecs/rpc/tSocketServer.c
     112tecs/rpc/tTDR_inline.h
     113tecs/rpc/tTINETChannel.cdl
     114tecs/rpc/tTINETClient.c
     115tecs/rpc/tTINETServer.c
     116tecs/rpc/tecs_rpc.h
     117tecs/sMalloc.cdl
     118tecs/tecs.h
     119tecs/tecs.xsd
    11120tecslib/core/C_parser.tab.rb
    12121tecslib/core/C_parser.y.rb
     
    26135tecslib/core/tecs_lang.rb
    27136tecslib/core/tecsgen.rb
     137tecslib/core/tecsinfo.rb
     138tecslib/core/tool_info.rb
    28139tecslib/core/types.rb
     140tecslib/core/unjoin_plugin.rb
    29141tecslib/core/value.rb
    30 
    31142tecslib/messages/messages_console_en_US.rb
    32143tecslib/messages/messages_console_ja_JP.rb
    33144tecslib/messages/messages_file_en_US.rb
    34145tecslib/messages/messages_file_ja_JP.rb
    35 
    36146tecslib/plugin/ATK1AlarmPlugin.rb
    37147tecslib/plugin/ATK1DelayTaskPlugin.rb
     
    44154tecslib/plugin/CellPlugin.rb
    45155tecslib/plugin/CelltypePlugin.rb
     156tecslib/plugin/CompositePlugin.rb
    46157tecslib/plugin/DomainPlugin.rb
    47158tecslib/plugin/HRP2AlarmHandlerPlugin.rb
     
    61172tecslib/plugin/HRP2SemaphorePlugin.rb
    62173tecslib/plugin/HRP2TaskPlugin.rb
     174tecslib/plugin/HRPHandlerPlugin.rb
     175tecslib/plugin/HRPKernelObjectManager.rb
     176tecslib/plugin/HRPKernelObjectPlugin.rb
     177tecslib/plugin/HRPObjectPlugin.rb
     178tecslib/plugin/HRPPlugin.rb
     179tecslib/plugin/HRPRPCPlugin.rb
     180tecslib/plugin/HRPSVCPlugin.rb
     181tecslib/plugin/HRPTaskPlugin.rb
    63182tecslib/plugin/Mruby2CBridgePlugin.rb
     183tecslib/plugin/MrubyBridgeCellPlugin.rb
     184tecslib/plugin/MrubyBridgeCelltypePlugin.rb
     185tecslib/plugin/MrubyBridgeCompositePlugin.rb
    64186tecslib/plugin/MrubyBridgePlugin.rb
     187tecslib/plugin/MrubyBridgeSignaturePlugin.rb
     188tecslib/plugin/MultiPlugin.rb
    65189tecslib/plugin/NotifierPlugin.rb
    66190tecslib/plugin/OpaqueMarshalerPlugin.rb
    67191tecslib/plugin/OpaqueRPCPlugin.rb
    68192tecslib/plugin/RPCPlugin.rb
     193tecslib/plugin/RepeatCellPlugin.rb
     194tecslib/plugin/RepeatJoinPlugin.rb
    69195tecslib/plugin/SharedOpaqueRPCPlugin.rb
    70196tecslib/plugin/SharedRPCPlugin.rb
    71197tecslib/plugin/SignaturePlugin.rb
    72198tecslib/plugin/TECS2CBridgePlugin.rb
     199tecslib/plugin/TECSInfoPlugin.rb
    73200tecslib/plugin/ThroughPlugin.rb
    74201tecslib/plugin/TracePlugin.rb
     
    77204tecslib/plugin/lib/GenParamCopy.rb
    78205tecslib/plugin/lib/GenTransparentMarshaler.rb
    79 
    80 tecs/mruby/TECSPointer.h
    81 tecs/mruby/TECSStruct.h
    82 tecs/mruby/mruby.cdl
    83 tecs/mruby/mrubyInitializer.cdl
    84 tecs/mruby/mrubyPointers.cdl
    85 tecs/mruby/mrubyVMs.cdl
    86 tecs/mruby/nMruby_tBoolPointer.c
    87 tecs/mruby/nMruby_tCharPointer.c
    88 tecs/mruby/nMruby_tDouble64Pointer.c
    89 tecs/mruby/nMruby_tFloat32Pointer.c
    90 tecs/mruby/nMruby_tInt16Pointer.c
    91 tecs/mruby/nMruby_tInt32Pointer.c
    92 tecs/mruby/nMruby_tInt64Pointer.c
    93 tecs/mruby/nMruby_tInt8Pointer.c
    94 tecs/mruby/nMruby_tIntPointer.c
    95 tecs/mruby/nMruby_tLongPointer.c
    96 tecs/mruby/nMruby_tMruby.c
    97 tecs/mruby/nMruby_tMrubyProc.c
    98 tecs/mruby/nMruby_tMrubyProc_1_0.c
    99 tecs/mruby/nMruby_tSCharPointer.c
    100 tecs/mruby/nMruby_tShortPointer.c
    101 tecs/mruby/nMruby_tTECSInitializer.c
    102 tecs/mruby/nMruby_tUCharPointer.c
    103 tecs/mruby/nMruby_tUInt16Pointer.c
    104 tecs/mruby/nMruby_tUInt32Pointer.c
    105 tecs/mruby/nMruby_tUInt64Pointer.c
    106 tecs/mruby/nMruby_tUInt8Pointer.c
    107 tecs/mruby/nMruby_tUIntPointer.c
    108 tecs/mruby/nMruby_tULongPointer.c
    109 tecs/mruby/nMruby_tUShortPointer.c
    110 tecs/mruby/tMruby.cdl
    111 tecs/mruby/tecs_mruby.h
    112 tecs/posix/posix.cdl
    113 tecs/rpc/PPAllocator.cdl
    114 tecs/rpc/RPCTask.cdl
    115 tecs/rpc/TDR.cdl
    116 tecs/rpc/rpc.cdl
    117 tecs/rpc/rpc_string.h
    118 tecs/rpc/sChannel.cdl
    119 tecs/rpc/sRPCErrorHandler.cdl
    120 tecs/rpc/tDataqueueAdaptor_inline.h
    121 tecs/rpc/tDataqueueOWChannel.cdl
    122 tecs/rpc/tNBOTDR_inline.h
    123 tecs/rpc/tPPAllocator.c
    124 tecs/rpc/tRPCDedicatedTaskMain.c
    125 tecs/rpc/tRPCDedicatedTaskMainWithOpener.c
    126 tecs/rpc/tRPCSharedChannelMan.c
    127 tecs/rpc/tRPCSharedTaskMain.c
    128 tecs/rpc/tRPCSharedTaskMainWithOpener.c
    129 tecs/rpc/tSocketChannel.cdl
    130 tecs/rpc/tSocketClient.c
    131 tecs/rpc/tSocketServer.c
    132 tecs/rpc/tTDR_inline.h
    133 tecs/rpc/tTINETChannel.cdl
    134 tecs/rpc/tTINETClient.c
    135 tecs/rpc/tTINETServer.c
    136 tecs/rpc/tecs_rpc.h
    137 tecs/tecs.h
    138 tecs/tecs.xsd
     206tecslib/plugin/lib/MrubyBridgeCelltypePluginModule.rb
     207tecslib/version.rb
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/Makefile

    r321 r429  
    3434#   の責任を負わない.
    3535
    36 #   $Id$
     36#   $Id: Makefile 2640 2017-06-03 11:27:12Z okuma-top $
    3737#++
    3838
     
    7676C_TAB = $(LIB_PATH)/C_parser.tab.rb
    7777EXERB_EXE = tecsgen.exe
    78 EXERB_EXY = tecsgen.exy
    7978
    8079all: generator
     
    105104        racc -v -g -o $(GEN_TAB_DEB) $(BNF)     # yydebug を有効にする
    106105
    107 # exerb : $(EXERB_EXE)
    108 exerb :
    109         @echo "!!! please build using ActiveScriptRuby !!!"
    110         exit 1
    111 
    112 # $(EXERB_EXE) : $(EXERB_EXY) $(GEN_SRC) $(PLUGIN_SRC)
    113 #       exerb  $(EXERB_EXY)
    114 # tecsgen.exy.ini から tecsgen.exy を生成するのは util/release.sh により行われる
    115 # MANIFEST に記載のバージョン番号が、tecsgen.exy.ini の文字列置換により、埋め込まれる
    116 
    117 exerb_check : $(EXERB_EXE)
    118 
    119 $(EXERB_EXE) : $(EXERB_EXY) $(GEN_SRC) $(PLUGIN_SRC)
    120         @echo "### Need make_tecsgen_exerb on ActiveScriptRuby to update tecsgen.exerb ###"
    121 
    122106print_error :   # エラーメッセージを拾い出す
    123107        grep -e "Generator\.error" -e cdl_error $(LIB_PATH)/*.rb \
    124108                | grep -v bnf.tab.rb \
    125                 | sed -e "s/\s*Generator\.error(/  /" -e "s/\s*cdl_error(//" -e "s/).*$$//"
     109                | sed -e "s/\s*Generator\.error(//" -e "s/\s*cdl_error[0-9]*(//" -e "s/).*$$//"
    126110
    127111print_error2 :  # エラーメッセージを拾い出す
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/in_exerb.rb

    r321 r429  
    3535#   の責任を負わない.
    3636
    37 #   $Id$
     37#   $Id: in_exerb.rb 1011 2016-07-11 02:20:01Z coas-nagasima $
    3838#++
    3939
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/TECSPointer.h

    r321 r429  
    102102        {                                                                                                                                       \
    103103                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 )         \
    106106                                /* '=' unecessary for negative value    */                              \
    107107                                /* ignore warning on int32_t */                                                 \
     
    126126        {                                                                                                                                       \
    127127                if( sizeof( type ) > sizeof( mrb_int ) ){                                               \
    128                         if( val >= (((type)1) << (sizeof(mrb_int)*8)))                          \
     128      if( val > TYPE ## _MAX )                        \
    129129                                /* '=' unecessary for negative value    */                              \
    130130                                /* ignore warning on int32_t */                                                 \
     
    148148VALCHECK_MRB_INT( Int16, INT16, int16_t )
    149149VALCHECK_UINT( UInt8, UINT8, uint8_t )
    150 #define VALCHECK_MRB_UInt8
     150#define VALCHECK_MRB_UInt8(mrb,val)
    151151VALCHECK_UINT( UInt16, UINT16, uint16_t )
    152 #define VALCHECK_MRB_UInt16
     152#define VALCHECK_MRB_UInt16(mrb,val)
    153153VALCHECK_INT( Int32, INT32, int32_t )
    154 #define VALCHECK_MRB_Int32
     154#define VALCHECK_MRB_Int32(mrb,val)
    155155VALCHECK_UINT( UInt32, UINT32, uint32_t )
    156 #define VALCHECK_MRB_UInt32
     156#define VALCHECK_MRB_UInt32(mrb,val)
    157157
    158158VALCHECK_INT( Int64, INT64, int64_t )
     
    163163VALCHECK_MRB_UINT( UInt64, UINT64, uint64_t )
    164164#else
    165 #define VALCHECK_MRB_Int64      // 範囲チェックが無意味であるため、警告が出るのを回避する
    166 #define VALCHECK_MRB_UInt64      // 範囲チェックが無意味であるため、警告が出るのを回避する
     165#define VALCHECK_MRB_Int64(mrb,val)      // 範囲チェックが無意味であるため、警告が出るのを回避する
     166#define VALCHECK_MRB_UInt64(mrb,val)      // 範囲チェックが無意味であるため、警告が出るのを回避する
    167167#endif
    168168
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/TECSStruct.h

    r321 r429  
    105105        Struct_ ## TAG ## _initialize( mrb_state *mrb, mrb_value self)          \
    106106        {                                                                                                                                       \
    107                 mrb_int length;                                                                                                 \
    108                 struct  TAG *structBody;                                                                                \
    109107                                                                                                                                                \
    110108                DATA_TYPE( self ) = &Struct ## TAG ## Body_mrb_data_type;               \
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/mruby.cdl

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136import_C( "tecs_mruby.h" );
    237
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/mrubyInitializer.cdl

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
    135
    236namespace nMruby{
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/mrubyPointers.cdl

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136// Pointer celltypes
    237
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/mrubyVMs.cdl

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136import( <posix.cdl> );
    237
    338/*
    4  * tools/mruby/mruby.c から cInit_initializeBridge( mrb ) を呼び出すように変更したもの
     39 * POSIX 環境用の VM
     40 * mrbgems の mrbgems/mruby-bin-mruby/tools/mruby/mruby.c を参考に作成したもの
    541 */
    642namespace nMruby{
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tBoolPointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tCharPointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tDouble64Pointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tFloat32Pointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *   *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
     36
    137/* #[<PREAMBLE>]#
    238 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tInt16Pointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tInt32Pointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tInt64Pointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2012 by Ubiquitous Computing and Networking Laboratory
     3 *                Ritsumeikan Univ., JAPAN
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tInt8Pointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tIntPointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tLongPointer.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tMruby.c

    r321 r429  
     1/*
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tMrubyProc.c

    r321 r429  
    11/*
    2  * This file comes from mruby. (renamed from tools/mruby/mruby.c)
    3  * This file is distributed under ruby's license. (not under TOPPERS license)
    4  *   see https://github.com/mruby/mruby
    5  * A little modification is done to to call initializer registering TECS components.
     2 *   Copyright (C) 2008-2017 by TOPPERS Project
    63 *
    7  * このファイルは、mruby のものです。
    8  * mruby のライセンスのもとで、配布されます。(TOPPERS ライセンスではありません)
    9  *  参照:  https://github.com/mruby/mruby
    10  * TECS コンポーネントを登録する初期化子を呼ぶため、少しの修正がなされています。
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
    1134 */
    1235
    13 #include "nMruby_tMrubyProc_tecsgen.h"
     36/*
     37 * 以前の nMruby_tMrubyProc.c は、mruby の本体に含まれていた
     38 *    mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
     39 * をベースに TECS のコードを足していたが、TOPPERS ライセンスと異なるため
     40 * 新たに書き下ろした。(小さなコードのため、概ね似たようなものになるが。
     41 */
    1442
    1543#include <stdio.h>
     
    1745#include <string.h>
    1846#include "mruby.h"
     47#include "mruby/string.h"
    1948#include "mruby/array.h"
    2049#include "mruby/compile.h"
     
    2251#include "mruby/variable.h"
    2352
    24 #ifndef ENABLE_STDIO
    25 static void
    26 p(mrb_state *mrb, mrb_value obj)
    27 {
    28   obj = mrb_funcall(mrb, obj, "inspect", 0);
    29   fwrite(RSTRING_PTR(obj), RSTRING_LEN(obj), 1, stdout);
    30   putc('\n', stdout);
    31 }
    32 #else
    33 #define p(mrb,obj) mrb_p(mrb,obj)
     53/* #[<PREAMBLE>]#
     54 * Don't edit the comments between #[<...>]# and #[</...>]#
     55 * These comment are used by tecsmerege when merging.
     56 *
     57 * attr access macro #_CAAM_#
     58 * mrb              mrb_state*       VAR_mrb         
     59 *
     60 * call port function #_TCPF_#
     61 * call port: cInit signature: nMruby_sInitializeBridge context:task optional:true
     62 *   bool_t     is_cInit_joined()                     check if joined
     63 *   void           cInit_initializeBridge( const mrb_state* mrb );
     64 *
     65 * #[</PREAMBLE>]# */
     66
     67/* プロトタイプ宣言や変数の定義をここに書きます #_PAC_# */
     68#include "nMruby_tMrubyProc_tecsgen.h"
     69
     70#ifndef E_OK
     71#define E_OK    0               /* success */
     72#define E_ID    (-18)   /* illegal ID */
    3473#endif
    3574
    36 void mrb_show_version(mrb_state *);
    37 void mrb_show_copyright(mrb_state *);
     75/* 受け口関数 #_TEPF_# */
     76/* #[<ENTRY_PORT>]# eMain
     77 * entry port: eMain
     78 * signature:  nPosix_sMain
     79 * context:    task
     80 * #[</ENTRY_PORT>]# */
    3881
    39 struct _args {
    40   FILE *rfp;
    41   char* cmdline;
    42   mrb_bool fname        : 1;
    43   mrb_bool mrbfile      : 1;
    44   mrb_bool check_syntax : 1;
    45   mrb_bool verbose      : 1;
    46   int argc;
    47   char** argv;
    48 };
     82/* #[<ENTRY_FUNC>]# eMain_main
     83 * name:         eMain_main
     84 * global_name:  nMruby_tMrubyProc_eMain_main
     85 * oneway:       false
     86 * #[</ENTRY_FUNC>]# */
     87int
     88eMain_main(CELLIDX idx, int argc, const char** argv)
     89{
     90        CELLCB  *p_cellcb;
     91  mrb_state *mrb;
     92  mrbc_context* context;
     93  if (VALID_IDX(idx)) {
     94                p_cellcb = GET_CELLCB(idx);
     95        }
     96        else {
     97                /* エラー処理コードをここに記述します */
     98      return -1;
     99        } /* end if VALID_IDX(idx) */
    49100
    50 static void
    51 usage(const char *name)
    52 {
    53   static const char *const usage_msg[] = {
    54   "switches:",
    55   "-b           load and execute RiteBinary (mrb) file",
    56   "-c           check syntax only",
    57   "-e 'command' one line of script",
    58   "-v           print version number, then run in verbose mode",
    59   "--verbose    run in verbose mode",
    60   "--version    print the version",
    61   "--copyright  print the copyright",
    62   NULL
    63   };
    64   const char *const *p = usage_msg;
     101        /* ここに処理本体を記述します #_TEFB_# */
     102  if (argc != 2) {
     103      printf("usage: %s script.rb\n", argv[0]);
     104      goto error_return;
     105  }
     106  mrb = mrb_open();
     107  if( mrb == 0 ){
     108      printf("%s: mrb_open() failed\n", argv[0]);
     109      goto error_return;
     110  }
     111  context = mrbc_context_new(mrb);
     112  if (context == 0) {
     113      printf("%s: mrbc_context_new() failed\n", argv[0]);
     114      goto error_close;
     115  }
    65116
    66   printf("Usage: %s [switches] programfile\n", name);
    67   while (*p)
    68     printf("  %s\n", *p++);
     117  /*--------   ARGV   ----------*/
     118  {
     119      mrb_value ARGV = mrb_ary_new_capa(mrb, argc);
     120      int  i;
     121      for (i = 0; i < argc; i++) {
     122          mrb_ary_push(mrb, ARGV, mrb_str_new_cstr(mrb, argv[i]));
     123      }
     124      mrb_define_global_const(mrb, "ARGV", ARGV);
     125  }
     126  /*--------   $0   ----------*/
     127  {
     128      mrb_sym zero_sym = mrb_intern_lit(mrb, "$0");
     129      mrbc_filename(mrb, context, argv[0]);
     130      mrb_gv_set(mrb, zero_sym, mrb_str_new_cstr(mrb, argv[0]));
     131  }
     132
     133  /* ------- register TECS bridge classes -------*/
     134  if (is_cInit_joined()) {
     135      cInit_initializeBridge(mrb);
     136  }
     137
     138  /*--------  load .rb file -------*/
     139  {
     140      FILE *file = fopen(argv[1], "r");
     141      if (file == NULL) {
     142          printf("file not found: %s\n", argv[1]);
     143          goto error_free;
     144      }
     145
     146      mrb_value val = mrb_load_file_cxt(mrb, file, context);
     147      if (mrb->exc) {
     148          if(! mrb_undef_p(val)){
     149              mrb_print_error(mrb);
     150          }
     151      }
     152  }
     153
     154  /*---------- success case --------*/
     155  mrbc_context_free(mrb, context);
     156  mrb_close( mrb );
     157  return 0;
     158
     159  /*---------- error case ----------*/
     160error_free:
     161  mrbc_context_free(mrb, context);
     162error_close:
     163  mrb_close( mrb );
     164error_return:
     165
     166  return -1;
    69167}
    70168
    71 static int
    72 parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
    73 {
    74   char **origargv = argv;
    75   static const struct _args args_zero = { 0 };
    76 
    77   *args = args_zero;
    78 
    79   for (argc--,argv++; argc > 0; argc--,argv++) {
    80     char *item;
    81     if (argv[0][0] != '-') break;
    82 
    83     if (strlen(*argv) <= 1) {
    84       argc--; argv++;
    85       args->rfp = stdin;
    86       break;
    87     }
    88 
    89     item = argv[0] + 1;
    90     switch (*item++) {
    91     case 'b':
    92       args->mrbfile = TRUE;
    93       break;
    94     case 'c':
    95       args->check_syntax = TRUE;
    96       break;
    97     case 'e':
    98       if (item[0]) {
    99         goto append_cmdline;
    100       }
    101       else if (argc > 1) {
    102         argc--; argv++;
    103         item = argv[0];
    104 append_cmdline:
    105         if (!args->cmdline) {
    106           size_t buflen;
    107           char *buf;
    108 
    109           buflen = strlen(item) + 1;
    110           buf = (char *)mrb_malloc(mrb, buflen);
    111           memcpy(buf, item, buflen);
    112           args->cmdline = buf;
    113         }
    114         else {
    115           size_t cmdlinelen;
    116           size_t itemlen;
    117 
    118           cmdlinelen = strlen(args->cmdline);
    119           itemlen = strlen(item);
    120           args->cmdline =
    121             (char *)mrb_realloc(mrb, args->cmdline, cmdlinelen + itemlen + 2);
    122           args->cmdline[cmdlinelen] = '\n';
    123           memcpy(args->cmdline + cmdlinelen + 1, item, itemlen + 1);
    124         }
    125       }
    126       else {
    127         printf("%s: No code specified for -e\n", *origargv);
    128         return EXIT_SUCCESS;
    129       }
    130       break;
    131     case 'v':
    132       if (!args->verbose) mrb_show_version(mrb);
    133       args->verbose = TRUE;
    134       break;
    135     case '-':
    136       if (strcmp((*argv) + 2, "version") == 0) {
    137         mrb_show_version(mrb);
    138         exit(EXIT_SUCCESS);
    139       }
    140       else if (strcmp((*argv) + 2, "verbose") == 0) {
    141         args->verbose = TRUE;
    142         break;
    143       }
    144       else if (strcmp((*argv) + 2, "copyright") == 0) {
    145         mrb_show_copyright(mrb);
    146         exit(EXIT_SUCCESS);
    147       }
    148     default:
    149       return EXIT_FAILURE;
    150     }
    151   }
    152 
    153   if (args->rfp == NULL && args->cmdline == NULL) {
    154     if (*argv == NULL) args->rfp = stdin;
    155     else {
    156       args->rfp = fopen(argv[0], args->mrbfile ? "rb" : "r");
    157       if (args->rfp == NULL) {
    158         printf("%s: Cannot open program file. (%s)\n", *origargv, *argv);
    159         return EXIT_FAILURE;
    160       }
    161       args->fname = TRUE;
    162       args->cmdline = argv[0];
    163       argc--; argv++;
    164     }
    165   }
    166   args->argv = (char **)mrb_realloc(mrb, args->argv, sizeof(char*) * (argc + 1));
    167   memcpy(args->argv, argv, (argc+1) * sizeof(char*));
    168   args->argc = argc;
    169 
    170   return EXIT_SUCCESS;
    171 }
    172 
    173 static void
    174 cleanup(mrb_state *mrb, struct _args *args)
    175 {
    176   if (args->rfp && args->rfp != stdin)
    177     fclose(args->rfp);
    178   if (args->cmdline && !args->fname)
    179     mrb_free(mrb, args->cmdline);
    180   if (args->argv)
    181     mrb_free(mrb, args->argv);
    182   mrb_close(mrb);
    183 }
    184 
    185 int
    186 // main(int argc, char **argv)
    187 eMain_main( CELLIDX idx, int argc, const char **argv)
    188 
    189 {
    190   CELLCB   *p_cellcb = GET_CELLCB( idx );
    191   mrb_state *mrb = mrb_open();
    192   int n = -1;
    193   int i;
    194   struct _args args;
    195   mrb_value ARGV;
    196   mrbc_context *c;
    197   mrb_value v;
    198   mrb_sym zero_sym;
    199 
    200   cInit_initializeBridge( mrb );    // TECS
    201 
    202 
    203   if (mrb == NULL) {
    204     fputs("Invalid mrb_state, exiting mruby\n", stderr);
    205     return EXIT_FAILURE;
    206   }
    207 
    208   n = parse_args(mrb, argc, (char **)argv, &args);
    209   if (n == EXIT_FAILURE || (args.cmdline == NULL && args.rfp == NULL)) {
    210     cleanup(mrb, &args);
    211     usage(argv[0]);
    212     return n;
    213   }
    214 
    215   ARGV = mrb_ary_new_capa(mrb, args.argc);
    216   for (i = 0; i < args.argc; i++) {
    217     mrb_ary_push(mrb, ARGV, mrb_str_new_cstr(mrb, args.argv[i]));
    218   }
    219   mrb_define_global_const(mrb, "ARGV", ARGV);
    220 
    221   c = mrbc_context_new(mrb);
    222   if (args.verbose)
    223     c->dump_result = TRUE;
    224   if (args.check_syntax)
    225     c->no_exec = TRUE;
    226 
    227   /* Set $0 */
    228   zero_sym = mrb_intern_lit(mrb, "$0");
    229   if (args.rfp) {
    230     char *cmdline;
    231     cmdline = args.cmdline ? args.cmdline : "-";
    232     mrbc_filename(mrb, c, cmdline);
    233     mrb_gv_set(mrb, zero_sym, mrb_str_new_cstr(mrb, cmdline));
    234   }
    235   else {
    236     mrbc_filename(mrb, c, "-e");
    237     mrb_gv_set(mrb, zero_sym, mrb_str_new_lit(mrb, "-e"));
    238   }
    239 
    240   /* Load program */
    241   if (args.mrbfile) {
    242     v = mrb_load_irep_file_cxt(mrb, args.rfp, c);
    243   }
    244   else if (args.rfp) {
    245     v = mrb_load_file_cxt(mrb, args.rfp, c);
    246   }
    247   else {
    248     v = mrb_load_string_cxt(mrb, args.cmdline, c);
    249   }
    250 
    251   mrbc_context_free(mrb, c);
    252   if (mrb->exc) {
    253     if (!mrb_undef_p(v)) {
    254       mrb_print_error(mrb);
    255     }
    256     n = -1;
    257   }
    258   else if (args.check_syntax) {
    259     printf("Syntax OK\n");
    260   }
    261   cleanup(mrb, &args);
    262 
    263   return n == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
    264 }
     169/* #[<POSTAMBLE>]#
     170 *   Put non-entry functions below.
     171 * #[</POSTAMBLE>]#*/
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tSCharPointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tShortPointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tTECSInitializer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tUCharPointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tUInt16Pointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tUInt32Pointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tUInt64Pointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tUInt8Pointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tUIntPointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tULongPointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/nMruby_tUShortPointer.c

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136/* #[<PREAMBLE>]#
    237 * #[<...>]# から #[</...>]# で囲まれたコメントは編集しないでください
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/tMruby.cdl

    r321 r429  
    1 
    21/*
    32 *  Copyright (C) 2012 by Ubiquitous Computing and Networking Laboratory
     
    3837
    3938import(<mruby.cdl>);
     39import(<sMruby.cdl>);
     40import(<tTLSFMalloc.cdl>);
    4041
    4142namespace nMruby{
    42   celltype tMruby{
    43     entry sTaskBody eMrubyBody;
     43
     44/*** mruby VM ***/
     45  celltype tMrubyVM{
     46    entry sMrubyVM eMrubyVM;
    4447    attr{
    4548      [omit]char_t *mrubyFile;
    46       char_t *irep=C_EXP("&$cell_global$_irep");
     49      const uint8_t *irep=C_EXP("$cell_global$_irep");
    4750    };
    48    
    49     /* write関数の接続先 */
    50 //    [optional]        call sSerialPort cSerialPort;
     51    var{
     52      mrb_irep      *var_irep;
     53      mrb_state     *mrb;
     54      struct RProc  *rproc;
     55    };
     56
     57    /* MrubyBridgePlugin の生成する VM_TECSInitializeer.eInitialize へ結合する */
    5158    [optional]  call sInitializeBridge cInit;
    52    
     59    /*
     60     * アロケータ
     61     *  他と共有しないのであれば、このアロケータは排他制御される必要はない
     62     */
     63    call sMalloc cMalloc;
     64
    5365    FACTORY{
    5466      write("Makefile.tecsgen", "clean_mrb_c :");
     
    6173      write("Makefile.tecsgen", "TECS_COBJS := $(TECS_COBJS) $cell_global$_mrb.o");
    6274      write("Makefile.tecsgen", "MRB_C := $(MRB_C) $cell_global$_mrb.c");
    63       write("$ct_global$_factory.h","extern const char_t *$cell_global$_irep;");
     75      write("$ct_global$_factory.h","extern const uint8_t $cell_global$_irep[];");
    6476    };
    6577  };
     78
     79/*** Standard Task Versoin  ***/
     80  /*
     81   * tMruby の eMrubyBody.main が、繰り返し起床されることは想定されていません。
     82   */
     83  celltype tMrubyTaskBody{
     84    entry sTaskBody eMrubyBody;
     85    call  sMrubyVM  cMrubyVM;
     86  };
     87  composite tMruby{
     88    entry sTaskBody eMrubyBody;
     89    [optional]  call sInitializeBridge cInit;
     90    attr{
     91      [omit]char_t *mrubyFile;
     92      size_t memoryPoolSize = 1024 * 1024;    /** 1MB default **/
     93      /* note: this requires enough memory */
     94      /* please pay attention to memory layout */
     95    };
     96
     97    /** **/
     98    cell tMrubyVM MrubyVM{
     99      mrubyFile = composite.mrubyFile;
     100      cInit => composite.cInit;
     101      cMalloc = TLSFMalloc.eMalloc;
     102    };
     103    cell tMrubyTaskBody MrubyTaskBody {
     104      cMrubyVM = MrubyVM.eMrubyVM;
     105    };
     106    cell tTLSFMalloc TLSFMalloc {
     107      memoryPoolSize = composite.memoryPoolSize;
     108    };
     109    composite.eMrubyBody => MrubyTaskBody.eMrubyBody;
     110  };
     111
     112/*** Cyclic Task Versoin  ***/
     113  /*
     114   * tMrubyCyclic の eMrubyBody.main が繰り返し呼び出されることが想定されています。
     115   * この実装では mrb_close は呼び出されません (終了は、突然電源が切れることを想定)
     116   */
     117  celltype tMrubyCyclicTaskBody{
     118    entry sTaskBody eMrubyBody;
     119    call  sMrubyVM  cMrubyVM;
     120    var {
     121        bool_t  b_init;
     122    };
     123  };
     124  composite tMrubyCyclic{
     125    entry sTaskBody eMrubyBody;
     126    [optional]  call sInitializeBridge cInit;
     127    attr{
     128      [omit]char_t *mrubyFile;
     129      size_t memoryPoolSize = 1024 * 1024;    /** 1MB default **/
     130      /* note: this requires enough memory */
     131      /* please pay attention to memory layout */
     132    };
     133
     134    /** **/
     135    cell tMrubyVM MrubyVM{
     136      mrubyFile = composite.mrubyFile;
     137      cInit => composite.cInit;
     138      cMalloc = TLSFMalloc.eMalloc;
     139    };
     140    cell tMrubyCyclicTaskBody MrubyTaskBody {
     141      cMrubyVM = MrubyVM.eMrubyVM;
     142    };
     143    cell tTLSFMalloc TLSFMalloc {
     144      memoryPoolSize = composite.memoryPoolSize;
     145    };
     146    composite.eMrubyBody => MrubyTaskBody.eMrubyBody;
     147  };
    66148};
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/tecs_mruby.h

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2019 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136#ifndef tecs_mruby_h__
    237#define tecs_mruby_h__
     
    944#include "mruby/data.h"
    1045#include "mruby/string.h"
     46#include "mruby/irep.h"
     47#include "mruby/dump.h"
     48#include "mruby/proc.h"
    1149
    1250#include "TECSPointer.h"
    1351#include "TECSStruct.h"
    1452
    15 #if  ! defined( MRUBY_RELEASE_MAJOR ) || MRUBY_RELEASE_MAJOR == 1 && MRUBY_RELEASE_MINOR < 2
    16 #ifndef MRB_ARGS_REQ
    17 #define MRB_ARGS_REQ(n)     ARGS_REQ(n)
    18 #define MRB_ARGS_OPT(n)     ARGS_OPT(n)
    19 #define MRB_ARGS_ARG(n1,n2) ARGS_ARG(n1,n2)
    20 #define MRB_ARGS_REST()     ARGS_REST()
    21 #define MRB_ARGS_POST(n)    ARGS_POST(n)
    22 #define MRB_ARGS_KEY(n1,n2) ARGS_KEY(n1,n2)
    23 #define MRB_ARGS_BLOCK()    ARGS_BLOCK()
    24 #define MRB_ARGS_ANY()      ARGS_ANY()
    25 #define MRB_ARGS_NONE()     ARGS_NONE()
    26 #endif /* MRB_ARGS_REQ */
    27 #endif
    2853
    29 #if  ! defined( MRUBY_RELEASE_MAJOR )
    30 #define mrb_float_value( mrb, val )  mrb_float_value( val )
    31 #endif
    32 
    33 #else
     54#else /* TECSGEN */
    3455
    3556/*
    36  * 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.
    3758 *   types:   long long, long long int
    3859 *   special keyword __attribute__(x), __extension__
    3960 */
    4061typedef int mrb_state;
    41 struct  RClass {int dummy;};
     62typedef int mrb_irep;
     63typedef int mrb_context;
     64struct  RClass {uint32_t gcnext;};  // actual definition: struct RBasic *gcnext
     65struct  RProc  {uint32_t gcnext;};  // actual definition: struct RBasic *gcnext
    4266
    4367typedef 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 )
    4475
    4576#endif /* TECSGEN */
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/posix/posix.cdl

    r321 r429  
     1/*
     2 *  Copyright (C) 2008-2017 by TOPPERS Project
     3 *
     4 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     5 *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
     6 *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     7 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     8 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     9 *      スコード中に含まれていること.
     10 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     11 *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
     12 *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
     13 *      の無保証規定を掲載すること.
     14 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     15 *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
     16 *      と.
     17 *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
     18 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     19 *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
     20 *        報告すること.
     21 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     22 *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
     23 *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
     24 *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
     25 *      免責すること.
     26 *
     27 *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
     28 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
     29 *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
     30 *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
     31 *  の責任を負わない.
     32 *
     33 *  @(#) $Id$
     34 */
     35
    136
    237namespace nPosix {
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/rpc/TDR.cdl

    r321 r429  
    6868        ER      sendSOP( [in]bool_t b_client );     /* StartOfPacket magic を送信 */
    6969        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 を受信 */
    7570                                                 /* b_client: クライアント側なら true, サーバー側なら false */
    7671
     
    150145};
    151146
    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)
    153148celltype tTDR {
    154149        call    sChannel        cChannel;
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/rpc/sChannel.cdl

    r321 r429  
    5858};
    5959
     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 */
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/rpc/tTDR_inline.h

    r321 r429  
    7575                return(E_ID);
    7676        }
     77  (void)p_cellcb;   // to avoid unused warning
    7778
    7879        syslog( LOG_INFO, "TDR: resetting channel" );
     
    102103                return(E_ID);
    103104        }
     105  (void)p_cellcb;   // to avoid unused warning
    104106
    105107        /* ここに処理本体を記述します #_TEFB_# */
     
    151153                return(E_ID);
    152154        }
     155  (void)p_cellcb;   // to avoid unused warning
    153156
    154157        /* ここに処理本体を記述します #_TEFB_# */
     
    157160#endif
    158161
    159     if( b_client )
     162  if( b_client )
    160163                p_sopMagic = &SOP_MAGIC2;
    161164        else
     
    198201                return(E_ID);
    199202        }
     203  (void)p_cellcb;   // to avoid unused warning
    200204
    201205        /* ここに処理本体を記述します #_TEFB_# */
     
    234238                return(E_ID);
    235239        }
     240  (void)p_cellcb;   // to avoid unused warning
    236241
    237242        /* ここに処理本体を記述します #_TEFB_# */
     
    267272                return(E_ID);
    268273        }
     274  (void)p_cellcb;   // to avoid unused warning
    269275
    270276        /* ここに処理本体を記述します #_TEFB_# */
     
    287293                return(E_ID);
    288294        }
     295  (void)p_cellcb;   // to avoid unused warning
    289296
    290297        /* ここに処理本体を記述します #_TEFB_# */
     
    307314                return(E_ID);
    308315        }
     316  (void)p_cellcb;   // to avoid unused warning
    309317
    310318        /* ここに処理本体を記述します #_TEFB_# */
     
    327335                return(E_ID);
    328336        }
     337  (void)p_cellcb;   // to avoid unused warning
    329338
    330339        /* ここに処理本体を記述します #_TEFB_# */
     
    347356                return(E_ID);
    348357        }
     358  (void)p_cellcb;   // to avoid unused warning
    349359
    350360        /* ここに処理本体を記述します #_TEFB_# */
     
    368378                return(E_ID);
    369379        }
     380  (void)p_cellcb;   // to avoid unused warning
    370381
    371382        /* ここに処理本体を記述します #_TEFB_# */
     
    390401                return(E_ID);
    391402        }
     403  (void)p_cellcb;   // to avoid unused warning
    392404
    393405        /* ここに処理本体を記述します #_TEFB_# */
     
    412424                return(E_ID);
    413425        }
     426  (void)p_cellcb;   // to avoid unused warning
    414427
    415428        /* ここに処理本体を記述します #_TEFB_# */
     
    434447                return(E_ID);
    435448        }
     449  (void)p_cellcb;   // to avoid unused warning
    436450
    437451        /* ここに処理本体を記述します #_TEFB_# */
     
    456470                return(E_ID);
    457471        }
     472  (void)p_cellcb;   // to avoid unused warning
    458473
    459474        /* ここに処理本体を記述します #_TEFB_# */
     
    477492                return(E_ID);
    478493        } /* end if VALID_IDX(idx) */
     494  (void)p_cellcb;   // to avoid unused warning
    479495
    480496        /* ここに処理本体を記述します #_TEFB_# */
     
    497513                return(E_ID);
    498514        } /* end if VALID_IDX(idx) */
     515  (void)p_cellcb;   // to avoid unused warning
    499516
    500517        /* ここに処理本体を記述します #_TEFB_# */
     
    517534                return(E_ID);
    518535        } /* end if VALID_IDX(idx) */
     536  (void)p_cellcb;   // to avoid unused warning
    519537
    520538        /* ここに処理本体を記述します #_TEFB_# */
     
    537555                return(E_ID);
    538556        } /* end if VALID_IDX(idx) */
     557  (void)p_cellcb;   // to avoid unused warning
    539558
    540559        /* ここに処理本体を記述します #_TEFB_# */
     
    557576                return(E_ID);
    558577        } /* end if VALID_IDX(idx) */
     578  (void)p_cellcb;   // to avoid unused warning
    559579
    560580        /* ここに処理本体を記述します #_TEFB_# */
     
    578598                return(E_ID);
    579599        } /* end if VALID_IDX(idx) */
     600  (void)p_cellcb;   // to avoid unused warning
    580601
    581602        /* ここに処理本体を記述します #_TEFB_# */
     
    600621                return(E_ID);
    601622        } /* end if VALID_IDX(idx) */
     623  (void)p_cellcb;   // to avoid unused warning
    602624
    603625        /* ここに処理本体を記述します #_TEFB_# */
     
    622644                return(E_ID);
    623645        } /* end if VALID_IDX(idx) */
     646  (void)p_cellcb;   // to avoid unused warning
    624647
    625648        /* ここに処理本体を記述します #_TEFB_# */
     
    644667                return(E_ID);
    645668        } /* end if VALID_IDX(idx) */
     669  (void)p_cellcb;   // to avoid unused warning
    646670
    647671        /* ここに処理本体を記述します #_TEFB_# */
     
    666690                return(E_ID);
    667691        } /* end if VALID_IDX(idx) */
     692  (void)p_cellcb;   // to avoid unused warning
    668693
    669694        /* ここに処理本体を記述します #_TEFB_# */
     
    688713                return(E_ID);
    689714        } /* end if VALID_IDX(idx) */
     715  (void)p_cellcb;   // to avoid unused warning
    690716
    691717        /* ここに処理本体を記述します #_TEFB_# */
     
    705731        ER              ercd = E_OK;
    706732        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
    714741
    715742        /* ここに処理本体を記述します #_TEFB_# */
     
    737764                return(E_ID);
    738765        }
     766  (void)p_cellcb;   // to avoid unused warning
    739767
    740768        /* ここに処理本体を記述します #_TEFB_# */
     
    757785                return(E_ID);
    758786        }
     787  (void)p_cellcb;   // to avoid unused warning
    759788
    760789        /* ここに処理本体を記述します #_TEFB_# */
     
    778807                return(E_ID);
    779808        }
     809  (void)p_cellcb;   // to avoid unused warning
    780810
    781811        /* ここに処理本体を記述します #_TEFB_# */
     
    800830                return(E_ID);
    801831        }
     832  (void)p_cellcb;   // to avoid unused warning
    802833
    803834        /* ここに処理本体を記述します #_TEFB_# */
     
    821852                return(E_ID);
    822853        }
     854  (void)p_cellcb;   // to avoid unused warning
    823855
    824856        /* ここに処理本体を記述します #_TEFB_# */
     
    863895                return(E_ID);
    864896        } /* end if VALID_IDX(idx) */
     897  (void)p_cellcb;   // to avoid unused warning
    865898
    866899        /* ここに処理本体を記述します #_TEFB_# */
     
    883916                return(E_ID);
    884917        }
     918  (void)p_cellcb;   // to avoid unused warning
    885919
    886920        /* ここに処理本体を記述します #_TEFB_# */
     
    903937                return(E_ID);
    904938        }
     939  (void)p_cellcb;   // to avoid unused warning
    905940
    906941        /* ここに処理本体を記述します #_TEFB_# */
     
    923958                return(E_ID);
    924959        }
     960  (void)p_cellcb;   // to avoid unused warning
    925961
    926962        /* ここに処理本体を記述します #_TEFB_# */
     
    944980                return(E_ID);
    945981        } /* end if VALID_IDX(idx) */
     982  (void)p_cellcb;   // to avoid unused warning
    946983
    947984        /* ここに処理本体を記述します #_TEFB_# */
     
    9661003                return(E_ID);
    9671004        }
     1005  (void)p_cellcb;   // to avoid unused warning
    9681006
    9691007        /* ここに処理本体を記述します #_TEFB_# */
     
    9881026                return(E_ID);
    9891027        }
     1028  (void)p_cellcb;   // to avoid unused warning
    9901029
    9911030        /* ここに処理本体を記述します #_TEFB_# */
     
    10101049                return(E_ID);
    10111050        }
     1051  (void)p_cellcb;   // to avoid unused warning
    10121052
    10131053        /* ここに処理本体を記述します #_TEFB_# */
     
    10311071                return(E_ID);
    10321072        } /* end if VALID_IDX(idx) */
     1073  (void)p_cellcb;   // to avoid unused warning
    10331074
    10341075        /* ここに処理本体を記述します #_TEFB_# */
     
    10511092                return(E_ID);
    10521093        } /* end if VALID_IDX(idx) */
     1094  (void)p_cellcb;   // to avoid unused warning
    10531095
    10541096        /* ここに処理本体を記述します #_TEFB_# */
     
    10711113                return(E_ID);
    10721114        } /* end if VALID_IDX(idx) */
     1115  (void)p_cellcb;   // to avoid unused warning
    10731116
    10741117        /* ここに処理本体を記述します #_TEFB_# */
     
    10911134                return(E_ID);
    10921135        } /* end if VALID_IDX(idx) */
     1136  (void)p_cellcb;   // to avoid unused warning
    10931137
    10941138        /* ここに処理本体を記述します #_TEFB_# */
     
    11121156                return(E_ID);
    11131157        } /* end if VALID_IDX(idx) */
     1158  (void)p_cellcb;   // to avoid unused warning
    11141159
    11151160        /* ここに処理本体を記述します #_TEFB_# */
     
    11341179                return(E_ID);
    11351180        } /* end if VALID_IDX(idx) */
     1181  (void)p_cellcb;   // to avoid unused warning
    11361182
    11371183        /* ここに処理本体を記述します #_TEFB_# */
     
    11561202                return(E_ID);
    11571203        } /* end if VALID_IDX(idx) */
     1204  (void)p_cellcb;   // to avoid unused warning
    11581205
    11591206        /* ここに処理本体を記述します #_TEFB_# */
     
    11781225                return(E_ID);
    11791226        } /* end if VALID_IDX(idx) */
     1227  (void)p_cellcb;   // to avoid unused warning
    11801228
    11811229        /* ここに処理本体を記述します #_TEFB_# */
     
    11991247                return(E_ID);
    12001248        }
     1249  (void)p_cellcb;   // to avoid unused warning
    12011250
    12021251        /* ここに処理本体を記述します #_TEFB_# */
     
    12201269                return(E_ID);
    12211270        }
     1271  (void)p_cellcb;   // to avoid unused warning
    12221272
    12231273        /* ここに処理本体を記述します #_TEFB_# */
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecsgen

    r321 r429  
    77#
    88#   ä¸Šè¨˜è‘—作権è€
    9 ã¯ï¼Œä»¥ä¸‹ã®(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
     9は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
    1010#   ã‚¢ï¼ˆæœ¬ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’改変したものを含む.以下同じ)を使用・複製・改
    1111#   å¤‰ãƒ»å†é
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecsgen.rb

    r321 r429  
    55#      Generator for TOPPERS Embedded Component System
    66
    7 #   Copyright (C) 2008-2016 by TOPPERS Project
     7#   Copyright (C) 2008-2019 by TOPPERS Project
    88#--
    99#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    5454#  Authors list is in i-ro-ha order.
    5555#Version::   see version.rb
    56 $Copyright = "Copyright(c) 2008-2016, TOPPERS project. All rights reserved."
     56$Copyright = "Copyright(c) 2008-2019, TOPPERS project. All rights reserved."
    5757$License   = "TOPPERS License"
    5858
     
    223223    analyze_option addtional_option_parser
    224224    load_modules
    225     setup
     225    if ! $TECSFLOW then
     226      setup
     227    end
    226228       
    227229    dbgPrint  "tecspath: #{$tecsgen_base_path}, __FILE__=#{__FILE__}\n"
     
    284286    ARGV.each { |a| $arguments += " " + a }
    285287
    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
    287290    $gen_base  = "gen"     # string: folder path to place generated files
    288291    $gen       = $gen_base # string: folder path to place generated files
     
    385388        $unopt = true
    386389      }
     390      parser.on('--unoptimize-entry', 'unoptimize entry port') {
     391        $unopt_entry = true
     392      }
    387393      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' ){
    388394        |arg|
     
    465471    }
    466472
    467     if ARGV.empty? && ! $print_version && ! $unit_test
     473    if ARGV.empty? && ! $print_version && ! $unit_test && ! $TECSFLOW
    468474      ARGV.options{|parser|
    469475        puts parser.help
     
    482488    # このファイルを誤って読み込むと、異なるバージョン名を表示してしまう
    483489    require_tecsgen_lib 'tecslib/version.rb'
    484     if ! $no_banner || $print_version
     490    if $title then
     491      STDERR << "#{$title} version #{$tool_version} (tecsgen version #{$version})  #{$Copyright}\n"
     492    elsif ! $no_banner || $print_version
    485493      STDERR << "tecsgen  version #{$version}  #{$Copyright}\n"
    486494    end
     
    488496      STDERR << "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]\n"
    489497    end
    490     if $print_version && ARGV.empty?
     498    if $print_version && ARGV.empty? && ! $TECSFLOW
    491499      exit
    492500    end
     
    514522    require_tecsgen_lib 'tecslib/core/generate.rb'
    515523    require_tecsgen_lib 'tecslib/core/gen_xml.rb'
    516 #    require_tecsgen_lib 'tecslib/core/tool_info.rb'
     524    require_tecsgen_lib 'tecslib/core/tool_info.rb'
     525    require_tecsgen_lib 'tecslib/core/tecsinfo.rb'
     526    require_tecsgen_lib 'tecslib/core/unjoin_plugin.rb'
    517527    require_tecsgen_lib 'tecslib/plugin/CelltypePlugin.rb'
     528    require_tecsgen_lib 'tecslib/plugin/CompositePlugin.rb'
    518529    require_tecsgen_lib 'tecslib/plugin/CellPlugin.rb'
    519530    require_tecsgen_lib 'tecslib/plugin/SignaturePlugin.rb'
    520531    require_tecsgen_lib 'tecslib/plugin/ThroughPlugin.rb'
    521532    require_tecsgen_lib 'tecslib/plugin/DomainPlugin.rb'
     533    require_tecsgen_lib 'tecslib/plugin/MultiPlugin.rb'
    522534
    523535    # C 言語パーサ
     
    596608#  クラス変数のリセットを確実に行う必要がある
    597609
    598 if $TECSCDE != true then
     610if $TECSCDE != true && $TECSFLOW != true then
    599611  begin
    600612    TECSGEN.init
     
    602614    tecsgen.run1
    603615    tecsgen.run2
     616    tecsgen.dump_tecsgen_rbdmp
    604617  rescue => evar
    605618    print_exception( evar )
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecsgen_rcov.rb

    r321 r429  
    4444# Usage: tecsgen_rcov.rb [options] CDL-file.cdl
    4545#
     46
     47$:.unshift(File.dirname(__FILE__))
     48
    4649require 'simplecov'
    47 SimpleCov.command_name "tecsgen#{$$}"
     50SimpleCov.command_name "tecsgen#{Time.now.to_f}"
    4851SimpleCov.root File.dirname( File.expand_path __FILE__ )
    4952SimpleCov.at_exit do
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/C_parser.tab.rb

    r321 r429  
    11#
    22# DO NOT MODIFY!!!!
    3 # This file is automatically generated by Racc 1.4.12
     3# This file is automatically generated by Racc 1.4.9
    44# from Racc grammer file "".
    55#
     
    88class C_parser < Racc::Parser
    99
    10 module_eval(<<'...end C_parser.y.rb/module_eval...', 'C_parser.y.rb', 715)
    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         end
    222       end
    223 
    224       if $debug then     # 070107 token 無効時ここを通さないようした (through 対応 -d の時に例外発生)
    225         locale = @@current_locale[@@generator_nest]
    226         if token then
    227           print( "#{locale[0]}: line #{locale[1]} : #{token[0]} '#{token[1].val}'\n" )
    228         else
    229           print( "#{locale[0]}: line #{locale[1]} : EOF\n" )
    230         end
    231       end
    232     end
    233 
    234     token
    235   end
    236 
    237   def on_error(t, v, vstack)
    238     if v == "$" then
    239      Generator.error( "B1003 Unexpected EOF"  )
    240     else
    241      Generator.error( "B1004 syntax error near \'$1\'" , v.val )
    242     end
    243 
    244   end
    245 
    246   def self.current_locale
    247     @@current_locale[ @@generator_nest ]
    248   end
    249 
    250   @@n_error = 0
    251   @@n_warning = 0
    252 
    253   # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でエラー発生は不適切)
    254   def self.error( msg )
    255     @@n_error += 1
    256     locale = @@current_locale[ @@generator_nest ]
    257 
    258     if locale then
    259       Console.puts "error: #{locale[0]}: line #{locale[1]} #{msg}"
    260     else
    261       Console.puts "error: #{msg}"
    262     end
    263   end
    264 
    265   # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でウォーニング発生は不適切)
    266   def self.warning( msg )
    267     @@n_warning += 1
    268     locale = @@current_locale[ @@generator_nest ]
    269     Console.puts "warning: #{locale[0]}: line #{locale[1]} #{msg}"
    270   end
    271 
    272   def self.get_n_error
    273     @@n_error
    274   end
    275 
    276   def self.get_n_warning
    277     @@n_warning
    278   end
    279 
    280   def self.get_nest
    281     @@generator_nest
    282   end
    283 
    284   def set_no_type_name b_no_type_name
    285     # print "b_no_type_name=#{b_no_type_name}\n"
    286     @b_no_type_name = b_no_type_name
    287   end
     10module_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]
     229#print( "#{locale[0]}: line #{locale[1]} : #{token[0]} '#{token[1].val}: type_name'\n" )
     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 "#{locale[0]}:#{locale[1]}: warning: #{msg}"
     280        end
     281
     282        # このメソッドは構文解析、意味解析からのみ呼出し可
     283        def self.info( msg )
     284                @@n_info += 1
     285                locale = @@current_locale[ @@generator_nest ]
     286                Console.puts "#{locale[0]}:#{locale[1]}: info: #{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 ]
     303#print "b_no_type_name=#{b_no_type_name} #{locale[0]}: line #{locale[1]}\n"
     304                @b_no_type_name = b_no_type_name
     305        end
    288306
    289307...end C_parser.y.rb/module_eval...
     
    291309
    292310clist = [
    293 '104,105,106,107,108,110,68,111,66,179,300,141,53,116,117,206,115,118',
    294 '119,120,121,122,123,104,105,106,107,108,110,168,111,203,204,207,141',
    295 '74,116,117,168,115,118,119,120,121,122,123,303,208,67,299,65,26,27,104',
    296 '105,106,107,108,110,73,111,26,27,75,141,348,116,117,167,115,118,119',
    297 '120,121,122,123,77,265,195,196,160,304,305,306,307,308,309,310,311,312',
    298 '313,262,351,142,8,9,10,11,15,16,17,18,19,20,21,22,53,192,23,25,26,27',
    299 '193,194,343,261,142,104,105,106,107,108,110,344,111,172,340,151,141',
    300 '272,116,117,251,115,118,119,120,121,122,123,104,105,106,107,108,110',
    301 '142,111,355,171,339,141,81,116,117,80,115,118,119,120,121,122,123,104',
    302 '105,106,107,108,110,52,111,195,196,3,141,51,116,117,359,115,118,119',
    303 '120,121,122,123,104,105,106,107,108,110,373,111,96,335,361,141,334,116',
    304 '117,344,115,118,119,120,121,122,123,79,142,247,335,272,251,334,251,51',
    305 '104,105,106,107,108,110,81,111,53,80,362,234,363,116,117,142,115,118',
    306 '119,120,121,122,123,247,52,364,251,197,198,51,51,197,198,79,197,198',
    307 '53,53,142,228,365,8,9,10,11,15,16,17,18,19,20,21,22,77,192,23,25,26',
    308 '27,193,194,142,229,95,230,231,232,233,87,235,236,238,239,240,241,192',
    309 '199,200,201,202,193,194,197,198,370,37,38,39,40,41,42,43,44,142,104',
    310 '105,106,107,108,110,86,111,203,204,85,141,375,116,117,376,115,118,119',
    311 '120,121,122,123,104,105,106,107,108,110,377,111,195,196,378,141,379',
    312 '116,117,380,115,118,119,120,121,122,123,104,105,106,107,108,110,382',
    313 '111,383,35,384,141,63,116,117,60,115,118,119,120,121,122,123,104,105',
    314 '106,107,108,110,389,111,209,210,390,141,391,116,117,392,115,118,119',
    315 '120,121,122,123,59,142,394,34,396,8,9,10,11,15,16,17,18,19,20,21,22',
    316 '52,278,23,25,26,27,51,142,36,52,52,52,35,53,52,51,51,51,197,198,51,45',
    317 '53,53,53,277,275,53,269,268,142,267,37,38,39,40,41,42,43,44,181,95,182',
    318 '254,183,184,185,199,200,201,202,253,34,142,8,9,10,11,15,16,17,18,19',
    319 '20,21,22,245,244,23,25,26,27,243,30,36,104,105,106,107,108,110,214,111',
    320 '213,208,207,141,206,116,117,205,115,118,119,120,121,122,123,37,38,39',
    321 '40,41,42,43,44,301,104,105,106,107,108,110,314,111,315,317,318,234,319',
    322 '116,117,321,115,118,119,120,121,122,123,52,52,52,322,52,323,51,51,51',
    323 '324,51,327,174,53,53,53,228,53,8,9,10,11,15,16,17,18,19,20,21,22,77',
    324 '173,23,25,26,27,75,95,142,229,169,230,231,232,233,161,235,236,238,239',
    325 '240,241,199,200,201,202,346,347,205,,,,37,38,39,40,41,42,43,44,142,104',
    326 '105,106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122,123',
    327 ',,104,105,106,107,108,110,,111,,,,234,,116,117,,115,118,119,120,121',
    328 '122,123,,,,,,,,,,,,,,,,,228,,8,9,10,11,15,16,17,18,19,20,21,22,77,,23',
    329 '25,26,27,,,,229,,230,231,232,233,142,235,236,238,239,240,241,,,,,,,',
    330 ',,,37,38,39,40,41,42,43,44,142,104,105,106,107,108,110,,111,,,,234,',
    331 '116,117,,115,118,119,120,121,122,123,,,,,,,,,,,,,,,,,228,,8,9,10,11',
    332 '15,16,17,18,19,20,21,22,77,,23,25,26,27,,,,229,,230,231,232,233,,235',
    333 '236,238,239,240,241,,,,,,,,,,,37,38,39,40,41,42,43,44,142,104,105,106',
    334 '107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122,123,104,105',
    335 '106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122,123,104',
    336 '105,106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122,123',
    337 '104,105,106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122',
    338 '123,,142,,,,,,,,104,105,106,107,108,110,,111,,,,141,,116,117,142,115',
    339 '118,119,120,121,122,123,104,105,106,107,108,110,,111,,366,,141,,116',
    340 '117,142,115,118,119,120,121,122,123,,,,,,,,104,105,106,107,108,110,',
    341 '111,142,,,234,,116,117,,115,118,119,120,121,122,123,,,,,,,,,,,,,,,,',
    342 '228,142,8,9,10,11,15,16,17,18,19,20,21,22,77,,23,25,26,27,,,,229,142',
    343 '230,231,232,233,,235,236,238,239,240,241,,,,,,,,,,,37,38,39,40,41,42',
    344 '43,44,142,104,105,106,107,108,110,,111,,,,234,,116,117,,115,118,119',
    345 '120,121,122,123,,,,,,,,,,,,,,,,,228,,8,9,10,11,15,16,17,18,19,20,21',
    346 '22,77,,23,25,26,27,,,,229,,230,231,232,233,,235,236,238,239,240,241',
    347 ',,,,,,,,,,37,38,39,40,41,42,43,44,142,104,105,106,107,108,110,,111,',
    348 ',,234,,116,117,,115,118,119,120,121,122,123,,,,,,,,,,,,,,,,,228,,8,9',
    349 '10,11,15,16,17,18,19,20,21,22,77,,23,25,26,27,,,,229,,230,231,232,233',
    350 ',235,236,238,239,240,241,,,,,,,,,,,37,38,39,40,41,42,43,44,142,104,105',
    351 '106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122,123,104',
    352 '105,106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122,123',
    353 '104,105,106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122',
    354 '123,104,105,106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121',
    355 '122,123,,142,,,,,,139,,,,,,140,104,105,106,107,108,110,,111,,145,142',
    356 '141,,116,117,,115,118,119,120,121,122,123,104,105,106,107,108,110,,111',
    357 ',,142,141,,116,117,,115,118,119,120,121,122,123,104,105,106,107,108',
    358 '110,,111,,,142,141,,116,117,,115,118,119,120,121,122,123,104,105,106',
    359 '107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122,123,,142,',
    360 ',,,,,,104,105,106,107,108,110,,111,,,,141,,116,117,142,115,118,119,120',
    361 '121,122,123,104,105,106,107,108,110,,111,,,,141,,116,117,142,115,118',
    362 '119,120,121,122,123,104,105,106,107,108,110,,111,,,,141,,116,117,142',
    363 '115,118,119,120,121,122,123,104,105,106,107,108,110,,111,,,,141,,116',
    364 '117,,115,118,119,120,121,122,123,,142,,,,,,139,349,,,,,140,104,105,106',
    365 '107,108,110,,111,,,142,141,,116,117,,115,118,119,120,121,122,123,104',
    366 '105,106,107,108,110,,111,,,142,141,,116,117,,115,118,119,120,121,122',
    367 '123,104,105,106,107,108,110,,111,,,142,141,,116,117,,115,118,119,120',
    368 '121,122,123,104,105,106,107,108,110,,111,,,,141,,116,117,,115,118,119',
    369 '120,121,122,123,,142,,,,,,,,104,105,106,107,108,110,,111,,,,141,,116',
    370 '117,142,115,118,119,120,121,122,123,104,105,106,107,108,110,,111,,,',
    371 '141,,116,117,142,115,118,119,120,121,122,123,104,105,106,107,108,110',
    372 ',111,,,,141,,116,117,142,115,118,119,120,121,122,123,,,,,,,,,,104,105',
    373 '106,107,108,110,,111,,,,234,,116,117,142,115,118,119,120,121,122,123',
    374 ',,,,,,,,,,,,,,,142,228,,8,9,10,11,15,16,17,18,19,20,21,22,77,237,23',
    375 '25,26,27,,,142,229,,230,231,232,233,,235,236,238,239,240,241,,,,,,,',
    376 ',,,37,38,39,40,41,42,43,44,142,104,105,106,107,108,110,,111,,336,,141',
    377 ',116,117,,115,118,119,120,121,122,123,104,105,106,107,108,110,,111,',
    378 ',,141,,116,117,,115,118,119,120,121,122,123,8,9,10,11,15,16,17,18,19',
    379 '20,21,22,,,23,25,26,27,8,9,10,11,15,16,17,18,19,20,21,22,,,23,25,26',
    380 '27,,104,105,106,107,108,110,,111,,,142,141,,116,117,,115,118,119,120',
    381 '121,122,123,104,105,106,107,108,110,,111,,,142,141,,116,117,,115,118',
    382 '119,120,121,122,123,104,105,106,107,108,110,,111,,,,141,,116,117,,115',
    383 '118,119,120,121,122,123,104,105,106,107,108,187,,111,,,,141,,116,117',
    384 ',115,118,119,120,121,122,123,,142,,,,,,,,104,105,106,107,108,189,,111',
    385 ',,,141,,116,117,142,115,118,119,120,121,122,123,104,105,106,107,108',
    386 '189,,111,,,,141,,116,117,142,115,118,119,120,121,122,123,104,105,106',
    387 '107,108,110,,111,,,,141,,116,117,142,115,118,119,120,121,122,123,104',
    388 '105,106,107,108,110,,111,,,,141,,116,117,,115,118,119,120,121,122,123',
    389 ',142,,,,,,139,,,,,,140,272,332,326,251,104,105,106,107,108,110,142,111',
    390 ',53,,141,,116,117,,115,118,119,120,121,122,123,,,,,,,142,,,8,9,10,11',
    391 '15,16,17,18,19,20,21,22,,,23,25,26,27,,,142,104,105,106,107,108,110',
    392 ',111,,,,234,,116,117,,115,118,119,120,121,122,123,37,38,39,40,41,42',
    393 '43,44,,,,,,,,,228,142,8,9,10,11,15,16,17,18,19,20,21,22,77,,23,25,26',
    394 '27,,,,229,,230,231,232,233,,235,236,238,239,240,241,368,,,,,,,,,,37',
    395 '38,39,40,41,42,43,44,142,247,332,,251,,,51,,,,,,,53,,,8,9,10,11,15,16',
    396 '17,18,19,20,21,22,,,23,25,26,27,,,8,9,10,11,15,16,17,18,19,20,21,22',
    397 ',,23,25,26,27,147,,,,,,37,38,39,40,41,42,43,44,,,,,,,,,328,,,,37,38',
    398 '39,40,41,42,43,44,,8,9,10,11,15,16,17,18,19,20,21,22,,,23,25,26,27,8',
    399 '9,10,11,15,16,17,18,19,20,21,22,,,23,25,26,27,,,,,,,,,37,38,39,40,41',
    400 '42,43,44,,,,,,,,,,,37,38,39,40,41,42,43,44,8,9,10,11,15,16,17,18,19',
    401 '20,21,22,,,23,25,26,27,8,9,10,11,15,16,17,18,19,20,21,22,,338,23,25',
    402 '26,27,,,,,,,,,37,38,39,40,41,42,43,44,,,,,,,,,,,37,38,39,40,41,42,43',
    403 '44,8,9,10,11,15,16,17,18,19,20,21,22,,162,23,25,26,27,8,9,10,11,15,16',
    404 '17,18,19,20,21,22,,,23,25,26,27,,,,,,,,,37,38,39,40,41,42,43,44,,,,',
    405 ',,,,,,37,38,39,40,41,42,43,44,8,9,10,11,15,16,17,18,19,20,21,22,,,23',
    406 '25,26,27,8,9,10,11,15,16,17,18,19,20,21,22,,,23,25,26,27,,,,,,,,,37',
    407 '38,39,40,41,42,43,44,,,,,,,,,,,37,38,39,40,41,42,43,44,8,9,10,11,15',
    408 '16,17,18,19,20,21,22,,255,23,25,26,27,8,9,10,11,15,16,17,18,19,20,21',
    409 '22,,,23,25,26,27,,,,,,,,,37,38,39,40,41,42,43,44,,,,,,,,,,,37,38,39',
    410 '40,41,42,43,44,8,9,10,11,15,16,17,18,19,20,21,22,,260,23,25,26,27,8',
    411 '9,10,11,15,16,17,18,19,20,21,22,,,23,25,26,27,,,,,,,,,37,38,39,40,41',
    412 '42,43,44,,,,,,,,,,,37,38,39,40,41,42,43,44,8,9,10,11,15,16,17,18,19',
    413 '20,21,22,,,23,25,26,27,8,9,10,11,15,16,17,18,19,20,21,22,,,23,25,26',
    414 '27,,,,,,,,,37,38,39,40,41,42,43,44,8,9,10,11,15,16,17,18,19,20,21,22',
    415 ',,23,25,26,27' ]
    416         racc_action_table = arr = ::Array.new(2877, 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)
    417452        idx = 0
    418453        clist.each do |str|
     
    424459
    425460clist = [
    426 '208,208,208,208,208,208,24,208,23,112,211,208,53,208,208,295,208,208',
    427 '208,208,208,208,208,209,209,209,209,209,209,93,209,130,130,296,209,46',
    428 '209,209,170,209,209,209,209,209,209,209,215,297,24,211,23,53,53,187',
    429 '187,187,187,187,187,46,187,112,112,48,187,298,187,187,93,187,187,187',
    430 '187,187,187,187,48,170,285,285,88,215,215,215,215,215,215,215,215,215',
    431 '215,164,301,208,187,187,187,187,187,187,187,187,187,187,187,187,83,283',
    432 '187,187,187,187,283,283,273,164,209,392,392,392,392,392,392,273,392',
    433 '99,257,82,392,271,392,392,271,392,392,392,392,392,392,392,179,179,179',
    434 '179,179,179,187,179,316,99,257,179,50,179,179,50,179,179,179,179,179',
    435 '179,179,192,192,192,192,192,192,49,192,286,286,1,192,49,192,192,320',
    436 '192,192,192,192,192,192,192,193,193,193,193,193,193,345,193,68,250,322',
    437 '193,250,193,193,345,193,193,193,193,193,193,193,49,392,246,330,178,246',
    438 '330,178,246,390,390,390,390,390,390,78,390,178,78,325,390,328,390,390',
    439 '179,390,390,390,390,390,390,390,150,158,331,150,287,287,150,158,288',
    440 '288,246,289,289,150,158,192,390,333,390,390,390,390,390,390,390,390',
    441 '390,390,390,390,390,284,390,390,390,390,284,284,193,390,67,390,390,390',
    442 '390,64,390,390,390,390,390,390,126,129,129,129,129,126,126,290,290,337',
    443 '390,390,390,390,390,390,390,390,390,379,379,379,379,379,379,62,379,293',
    444 '293,61,379,352,379,379,353,379,379,379,379,379,379,379,378,378,378,378',
    445 '378,378,354,378,127,127,355,378,356,378,378,357,378,378,378,378,378',
    446 '378,378,194,194,194,194,194,194,363,194,367,30,369,194,22,194,194,14',
    447 '194,194,194,194,194,194,194,195,195,195,195,195,195,380,195,135,135',
    448 '385,195,387,195,195,388,195,195,195,195,195,195,195,12,379,391,30,395',
    449 '30,30,30,30,30,30,30,30,30,30,30,30,92,183,30,30,30,30,92,378,30,262',
    450 '74,4,2,92,72,262,74,4,128,128,72,3,262,74,4,182,180,72,176,175,194,173',
    451 '30,30,30,30,30,30,30,30,113,168,113,155,113,113,113,291,291,291,291',
    452 '154,2,195,2,2,2,2,2,2,2,2,2,2,2,2,148,146,2,2,2,2,144,2,2,196,196,196',
    453 '196,196,196,142,196,140,134,133,196,132,196,196,131,196,196,196,196',
    454 '196,196,196,2,2,2,2,2,2,2,2,213,377,377,377,377,377,377,229,377,230',
    455 '232,233,377,234,377,377,236,377,377,377,377,377,377,377,340,216,172',
    456 '238,52,239,340,216,172,240,52,242,109,340,216,172,377,52,377,377,377',
    457 '377,377,377,377,377,377,377,377,377,377,103,377,377,377,377,102,96,196',
    458 '377,95,377,377,377,377,89,377,377,377,377,377,377,292,292,292,292,276',
    459 '279,294,,,,377,377,377,377,377,377,377,377,377,169,169,169,169,169,169',
    460 ',169,,,,169,,169,169,,169,169,169,169,169,169,169,,,376,376,376,376',
    461 '376,376,,376,,,,376,,376,376,,376,376,376,376,376,376,376,,,,,,,,,,',
    462 ',,,,,,376,,376,376,376,376,376,376,376,376,376,376,376,376,376,,376',
    463 '376,376,376,,,,376,,376,376,376,376,169,376,376,376,376,376,376,,,,',
    464 ',,,,,,376,376,376,376,376,376,376,376,376,359,359,359,359,359,359,,359',
    465 ',,,359,,359,359,,359,359,359,359,359,359,359,,,,,,,,,,,,,,,,,359,,359',
    466 '359,359,359,359,359,359,359,359,359,359,359,359,,359,359,359,359,,,',
    467 '359,,359,359,359,359,,359,359,359,359,359,359,,,,,,,,,,,359,359,359',
    468 '359,359,359,359,359,359,197,197,197,197,197,197,,197,,,,197,,197,197',
    469 ',197,197,197,197,197,197,197,348,348,348,348,348,348,,348,,,,348,,348',
    470 '348,,348,348,348,348,348,348,348,344,344,344,344,344,344,,344,,,,344',
    471 ',344,344,,344,344,344,344,344,344,344,189,189,189,189,189,189,,189,',
    472 ',,189,,189,189,,189,189,189,189,189,189,189,,197,,,,,,,,198,198,198',
    473 '198,198,198,,198,,,,198,,198,198,348,198,198,198,198,198,198,198,334',
    474 '334,334,334,334,334,,334,,334,,334,,334,334,344,334,334,334,334,334',
    475 '334,334,,,,,,,,321,321,321,321,321,321,,321,189,,,321,,321,321,,321',
    476 '321,321,321,321,321,321,,,,,,,,,,,,,,,,,321,198,321,321,321,321,321',
    477 '321,321,321,321,321,321,321,321,,321,321,321,321,,,,321,334,321,321',
    478 '321,321,,321,321,321,321,321,321,,,,,,,,,,,321,321,321,321,321,321,321',
    479 '321,321,319,319,319,319,319,319,,319,,,,319,,319,319,,319,319,319,319',
    480 '319,319,319,,,,,,,,,,,,,,,,,319,,319,319,319,319,319,319,319,319,319',
    481 '319,319,319,319,,319,319,319,319,,,,319,,319,319,319,319,,319,319,319',
    482 '319,319,319,,,,,,,,,,,319,319,319,319,319,319,319,319,319,396,396,396',
    483 '396,396,396,,396,,,,396,,396,396,,396,396,396,396,396,396,396,,,,,,',
    484 ',,,,,,,,,,396,,396,396,396,396,396,396,396,396,396,396,396,396,396,',
    485 '396,396,396,396,,,,396,,396,396,396,396,,396,396,396,396,396,396,,,',
    486 ',,,,,,,396,396,396,396,396,396,396,396,396,318,318,318,318,318,318,',
    487 '318,,,,318,,318,318,,318,318,318,318,318,318,318,317,317,317,317,317',
    488 '317,,317,,,,317,,317,317,,317,317,317,317,317,317,317,75,75,75,75,75',
    489 '75,,75,,,,75,,75,75,,75,75,75,75,75,75,75,315,315,315,315,315,315,,315',
    490 ',,,315,,315,315,,315,315,315,315,315,315,315,,318,,,,,,75,,,,,,75,80',
    491 '80,80,80,80,80,,80,,80,317,80,,80,80,,80,80,80,80,80,80,80,181,181,181',
    492 '181,181,181,,181,,,75,181,,181,181,,181,181,181,181,181,181,181,314',
    493 '314,314,314,314,314,,314,,,315,314,,314,314,,314,314,314,314,314,314',
    494 '314,302,302,302,302,302,302,,302,,,,302,,302,302,,302,302,302,302,302',
    495 '302,302,,80,,,,,,,,199,199,199,199,199,199,,199,,,,199,,199,199,181',
    496 '199,199,199,199,199,199,199,200,200,200,200,200,200,,200,,,,200,,200',
    497 '200,314,200,200,200,200,200,200,200,300,300,300,300,300,300,,300,,,',
    498 '300,,300,300,302,300,300,300,300,300,300,300,275,275,275,275,275,275',
    499 ',275,,,,275,,275,275,,275,275,275,275,275,275,275,,199,,,,,,300,300',
    500 ',,,,300,201,201,201,201,201,201,,201,,,200,201,,201,201,,201,201,201',
    501 '201,201,201,201,207,207,207,207,207,207,,207,,,300,207,,207,207,,207',
    502 '207,207,207,207,207,207,210,210,210,210,210,210,,210,,,275,210,,210',
    503 '210,,210,210,210,210,210,210,210,202,202,202,202,202,202,,202,,,,202',
    504 ',202,202,,202,202,202,202,202,202,202,,201,,,,,,,,269,269,269,269,269',
    505 '269,,269,,,,269,,269,269,207,269,269,269,269,269,269,269,203,203,203',
    506 '203,203,203,,203,,,,203,,203,203,210,203,203,203,203,203,203,203,204',
    507 '204,204,204,204,204,,204,,,,204,,204,204,202,204,204,204,204,204,204',
    508 '204,,,,,,,,,,143,143,143,143,143,143,,143,,,,143,,143,143,269,143,143',
    509 '143,143,143,143,143,,,,,,,,,,,,,,,,203,143,,143,143,143,143,143,143',
    510 '143,143,143,143,143,143,143,143,143,143,143,143,,,204,143,,143,143,143',
    511 '143,,143,143,143,143,143,143,,,,,,,,,,,143,143,143,143,143,143,143,143',
    512 '143,251,251,251,251,251,251,,251,,251,,251,,251,251,,251,251,251,251',
    513 '251,251,251,110,110,110,110,110,110,,110,,,,110,,110,110,,110,110,110',
    514 '110,110,110,110,70,70,70,70,70,70,70,70,70,70,70,70,,,70,70,70,70,110',
    515 '110,110,110,110,110,110,110,110,110,110,110,,,110,110,110,110,,205,205',
    516 '205,205,205,205,,205,,,251,205,,205,205,,205,205,205,205,205,205,205',
    517 '206,206,206,206,206,206,,206,,,110,206,,206,206,,206,206,206,206,206',
    518 '206,206,114,114,114,114,114,114,,114,,,,114,,114,114,,114,114,114,114',
    519 '114,114,114,115,115,115,115,115,115,,115,,,,115,,115,115,,115,115,115',
    520 '115,115,115,115,,205,,,,,,,,116,116,116,116,116,116,,116,,,,116,,116',
    521 '116,206,116,116,116,116,116,116,116,117,117,117,117,117,117,,117,,,',
    522 '117,,117,117,114,117,117,117,117,117,117,117,139,139,139,139,139,139',
    523 ',139,,,,139,,139,139,115,139,139,139,139,139,139,139,241,241,241,241',
    524 '241,241,,241,,,,241,,241,241,,241,241,241,241,241,241,241,,116,,,,,',
    525 '139,,,,,,139,272,272,241,272,235,235,235,235,235,235,117,235,,272,,235',
    526 ',235,235,,235,235,235,235,235,235,235,,,,,,,139,,,272,272,272,272,272',
    527 '272,272,272,272,272,272,272,,,272,272,272,272,,,241,231,231,231,231',
    528 '231,231,,231,,,,231,,231,231,,231,231,231,231,231,231,231,272,272,272',
    529 '272,272,272,272,272,,,,,,,,,231,235,231,231,231,231,231,231,231,231',
    530 '231,231,231,231,231,,231,231,231,231,,,,231,,231,231,231,231,,231,231',
    531 '231,231,231,231,335,,,,,,,,,,231,231,231,231,231,231,231,231,231,247',
    532 '247,,247,,,247,,,,,,,247,,,335,335,335,335,335,335,335,335,335,335,335',
    533 '335,,,335,335,335,335,,,247,247,247,247,247,247,247,247,247,247,247',
    534 '247,,,247,247,247,247,81,,,,,,335,335,335,335,335,335,335,335,,,,,,',
    535 ',,245,,,,247,247,247,247,247,247,247,247,,81,81,81,81,81,81,81,81,81',
    536 '81,81,81,,,81,81,81,81,245,245,245,245,245,245,245,245,245,245,245,245',
    537 ',,245,245,245,245,,,,,,,,,81,81,81,81,81,81,81,81,,,,,,,,,,,245,245',
    538 '245,245,245,245,245,245,5,5,5,5,5,5,5,5,5,5,5,5,,,5,5,5,5,252,252,252',
    539 '252,252,252,252,252,252,252,252,252,,252,252,252,252,252,,,,,,,,,5,5',
    540 '5,5,5,5,5,5,,,,,,,,,,,252,252,252,252,252,252,252,252,90,90,90,90,90',
    541 '90,90,90,90,90,90,90,,90,90,90,90,90,153,153,153,153,153,153,153,153',
    542 '153,153,153,153,,,153,153,153,153,,,,,,,,,90,90,90,90,90,90,90,90,,',
    543 ',,,,,,,,153,153,153,153,153,153,153,153,87,87,87,87,87,87,87,87,87,87',
    544 '87,87,,,87,87,87,87,86,86,86,86,86,86,86,86,86,86,86,86,,,86,86,86,86',
    545 ',,,,,,,,87,87,87,87,87,87,87,87,,,,,,,,,,,86,86,86,86,86,86,86,86,156',
    546 '156,156,156,156,156,156,156,156,156,156,156,,156,156,156,156,156,65',
    547 '65,65,65,65,65,65,65,65,65,65,65,,,65,65,65,65,,,,,,,,,156,156,156,156',
    548 '156,156,156,156,,,,,,,,,,,65,65,65,65,65,65,65,65,159,159,159,159,159',
    549 '159,159,159,159,159,159,159,,159,159,159,159,159,7,7,7,7,7,7,7,7,7,7',
    550 '7,7,,,7,7,7,7,,,,,,,,,159,159,159,159,159,159,159,159,,,,,,,,,,,7,7',
    551 '7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,,,6,6,6,6,36,36,36,36,36,36,36,36',
    552 '36,36,36,36,,,36,36,36,36,,,,,,,,,6,6,6,6,6,6,6,6,71,71,71,71,71,71',
    553 '71,71,71,71,71,71,,,71,71,71,71' ]
    554         racc_action_check = arr = ::Array.new(2877, 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)
    555604        idx = 0
    556605        clist.each do |str|
     
    562611
    563612racc_action_pointer = [
    564    nil,   173,   432,   442,   425,  2414,  2764,  2712,   nil,   nil,
    565    nil,   nil,   363,   nil,   332,   nil,   nil,   nil,   nil,   nil,
    566    nil,   nil,   357,    -5,    -7,   nil,   nil,   nil,   nil,   nil,
    567    366,   nil,   nil,   nil,   nil,   nil,  2782,   nil,   nil,   nil,
    568    nil,   nil,   nil,   nil,   nil,   nil,    18,   nil,    21,   162,
    569    145,   nil,   548,    -8,   nil,   nil,   nil,   nil,   nil,   nil,
    570    nil,   267,   263,   nil,   231,  2642,   nil,   268,   139,   nil,
    571   1860,  2816,   428,   nil,   424,  1315,   nil,   nil,   217,   nil,
    572   1375,  2344,   119,    86,   nil,   nil,  2572,  2554,    39,   555,
    573   2484,   nil,   414,    12,   nil,   549,   575,   nil,   nil,   108,
    574    nil,   nil,   545,   487,   nil,   nil,   nil,   nil,   nil,   554,
    575   1878,   nil,     2,   451,  1984,  2007,  2039,  2062,   nil,   nil,
    576    nil,   nil,   nil,   nil,   nil,   nil,   273,   322,   412,   265,
    577     -2,   492,   473,   470,   468,   351,   nil,   nil,   nil,  2085,
    578    497,   nil,   489,  1761,   482,   nil,   480,   nil,   470,   nil,
    579    234,   nil,   nil,  2502,   431,   423,  2624,   nil,   235,  2694,
    580    nil,   nil,   nil,   nil,    74,   nil,   nil,   nil,   449,   620,
    581     21,   nil,   546,   439,   nil,   442,   441,   nil,   206,   138,
    582    440,  1398,   433,   409,   nil,   nil,   nil,    51,   nil,   902,
    583    nil,   nil,   161,   184,   356,   379,   494,   833,   934,  1476,
    584   1499,  1582,  1651,  1706,  1729,  1938,  1961,  1605,    -2,    21,
    585   1628,    -7,   nil,   518,   nil,     4,   545,   nil,   nil,   nil,
    586    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   527,
    587    529,  2202,   530,   531,   500,  2149,   503,   nil,   541,   515,
    588    519,  2108,   521,   nil,   nil,  2362,   204,  2291,   nil,   nil,
    589    188,  1855,  2432,   nil,   nil,   nil,   nil,   109,   nil,   nil,
    590    nil,   nil,   423,   nil,   nil,   nil,   nil,   nil,   nil,  1683,
    591    nil,   122,  2140,   106,   nil,  1545,   596,   nil,   nil,   600,
    592    nil,   nil,   nil,    87,   252,    57,   150,   218,   222,   225,
    593    273,   439,   574,   287,   590,   -20,    -3,    10,    25,   nil,
    594   1522,    84,  1444,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    595    nil,   nil,   nil,   nil,  1421,  1338,    82,  1292,  1269,  1081,
    596    138,   987,   155,   nil,   nil,   187,   nil,   nil,   218,   nil,
    597    205,   235,   nil,   250,   957,  2271,   nil,   291,   nil,   nil,
    598    544,   nil,   nil,   nil,   879,   184,   nil,   nil,   856,   nil,
    599    nil,   nil,   283,   319,   333,   338,   306,   342,   nil,   739,
    600    nil,   nil,   nil,   352,   nil,   nil,   nil,   355,   nil,   360,
    601    nil,   nil,   nil,   nil,   nil,   nil,   645,   526,   333,   310,
    602    317,   nil,   nil,   nil,   nil,   326,   nil,   385,   355,   nil,
    603    216,   365,   115,   nil,   nil,   400,  1175,   nil ]
     613   nil,   732,  2528,   716,   182,  3068,  3043,  2752,  2993,   nil,
     614   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   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 ]
    604658
    605659racc_action_default = [
    606   -174,  -241,    -1,  -241,  -241,   -70,   -71,   -72,   -80,   -81,
    607    -82,   -83,   -84,   -85,   -86,   -87,   -88,   -89,   -90,   -91,
    608    -92,   -93,   -96,  -241,  -241,  -127,  -132,  -133,  -175,  -176,
    609   -241,  -178,  -179,  -182,  -183,  -184,  -241,  -230,  -231,  -232,
    610   -233,  -234,  -235,  -236,  -237,   398,  -241,   -76,   -78,  -241,
    611   -135,  -137,  -241,  -143,   -73,   -84,   -86,   -74,   -75,  -181,
    612   -180,   -98,  -241,  -101,  -114,  -241,  -117,  -241,  -126,  -177,
    613   -105,  -107,  -241,   -69,  -241,  -241,  -188,  -189,  -134,  -136,
    614   -241,  -241,  -241,  -144,  -145,   -94,  -241,  -241,   -84,   -85,
    615   -241,  -115,  -241,  -241,  -128,  -130,  -241,  -106,  -108,  -241,
    616   -186,   -77,   -78,    -2,    -3,    -4,    -5,    -6,    -7,    -8,
    617   -241,   -10,   -12,   -23,  -241,  -241,  -241,  -241,   -29,   -30,
    618    -31,   -32,   -33,   -34,   -35,   -37,   -41,   -44,   -47,   -52,
    619    -55,   -57,   -59,   -61,   -63,   -65,   -68,   -79,  -168,  -241,
    620   -241,  -238,  -241,  -241,  -241,  -140,  -241,  -142,  -147,  -149,
    621   -153,  -138,  -146,  -241,   -84,   -85,  -241,   -99,  -241,  -241,
    622   -120,  -119,  -113,  -116,  -241,  -121,  -123,  -124,  -241,  -241,
    623   -241,  -185,  -241,  -241,   -11,  -241,  -241,   -67,  -154,   -20,
    624   -241,  -241,  -241,  -241,   -18,   -19,   -24,  -241,   -25,  -241,
    625    -27,   -28,  -241,  -241,  -241,  -241,  -241,  -241,  -241,  -241,
    626   -241,  -241,  -241,  -241,  -241,  -241,  -241,  -241,  -241,  -241,
    627   -241,  -241,  -172,  -241,  -239,   -35,  -241,  -190,  -191,  -192,
    628   -193,  -194,  -195,  -196,  -197,  -198,  -199,  -200,  -201,  -241,
    629   -241,  -241,  -241,  -241,  -238,  -241,  -241,  -211,  -241,  -241,
    630   -241,  -241,  -241,  -139,  -141,  -241,  -156,  -241,  -151,  -152,
    631   -157,  -241,  -241,  -104,  -103,   -97,  -100,  -241,  -109,  -111,
    632   -112,  -118,  -241,  -129,  -131,  -125,  -187,  -240,    -9,  -241,
    633   -155,  -156,  -241,  -241,   -21,   -20,  -241,   -16,   -17,  -241,
    634    -38,   -39,   -40,   -42,   -43,   -45,   -46,   -48,   -49,   -50,
    635    -51,   -53,   -54,   -56,   -58,   -60,   -62,   -64,  -241,  -169,
    636   -241,  -241,  -241,  -219,  -220,  -221,  -222,  -223,  -224,  -225,
    637   -226,  -227,  -228,  -229,  -241,  -241,  -241,  -241,  -241,  -241,
    638   -241,  -241,  -241,  -213,  -214,  -241,  -216,  -217,  -241,  -150,
    639   -158,  -241,  -164,  -241,  -241,  -241,  -160,  -241,   -95,  -102,
    640   -241,  -122,   -36,   -13,  -241,  -241,   -15,   -26,  -241,  -170,
    641   -173,  -171,  -241,  -241,  -241,  -241,  -241,  -241,  -208,  -241,
    642   -210,  -212,  -215,  -241,  -159,  -165,  -162,  -241,  -166,  -241,
    643   -161,  -110,   -22,   -14,   -66,  -218,  -241,  -241,  -241,  -241,
    644   -241,  -209,  -148,  -163,  -167,  -202,  -204,  -241,  -241,  -207,
    645   -241,  -241,  -241,  -203,  -205,  -241,  -241,  -206 ]
     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 ]
    646705
    647706racc_goto_table = [
    648     48,     4,   144,   146,    54,    57,    58,   217,    84,    12,
    649    136,   137,    78,   175,   258,   136,   273,   165,   188,   190,
    650    191,   186,    72,    89,   256,    93,   176,   163,    70,     4,
    651     33,   156,   249,    29,   283,   284,   302,    12,   152,    14,
    652    330,     2,    71,   293,   155,    89,   215,    90,    89,   287,
    653    288,   289,   290,   294,   170,   295,    97,    98,    33,    83,
    654    270,    69,    70,    70,    92,   330,   296,    14,   100,   159,
    655    102,   297,    88,   101,   136,   212,    71,    71,   285,   286,
    656    150,    61,   274,   153,   276,   158,    92,    62,   166,    92,
    657    175,   264,   175,   154,    88,   316,   163,    88,   252,   280,
    658    281,   282,    70,   279,   136,   246,   291,   292,   257,    64,
    659    164,   155,   345,   298,   155,   263,    71,    89,   180,   329,
    660    256,   211,    28,    99,    76,   143,     1,   nil,   nil,   nil,
    661    nil,   nil,   nil,   271,   215,   nil,   nil,   nil,   nil,   nil,
    662    nil,   nil,   nil,   nil,   325,   nil,   248,   nil,   nil,   nil,
    663    nil,   nil,   158,   nil,   259,   158,   nil,   320,    92,   nil,
    664    154,   nil,   nil,   154,   nil,   nil,    88,   nil,   266,   nil,
    665    136,   nil,   nil,   337,   nil,   nil,   342,   nil,   274,    70,
    666    nil,   nil,   nil,   358,   nil,   360,   136,   341,   nil,   nil,
    667    nil,   nil,   nil,    71,   nil,   nil,   371,   nil,   nil,   nil,
    668    nil,   nil,   246,   nil,   nil,   352,   nil,   nil,   nil,    78,
    669    155,   nil,   102,   nil,   nil,   nil,   nil,   353,   354,   nil,
    670    356,   357,   215,   381,   215,   nil,   nil,   271,   nil,   nil,
    671    nil,   nil,   nil,   nil,   nil,   136,   350,   nil,   nil,   nil,
    672    385,   386,   nil,   nil,   150,   nil,   150,   372,   nil,   nil,
    673    nil,   158,   nil,   nil,   393,   nil,   367,   369,   166,   154,
    674    397,   nil,   215,   nil,   nil,   nil,   nil,   nil,   nil,   136,
    675    nil,   150,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   215,
    676    215,   387,   388,   374,   nil,   nil,   nil,   nil,   nil,   nil,
    677    nil,   nil,   nil,   215,   nil,   395,   nil,   nil,   nil,   215,
     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,
    678740   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    679741   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    680    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    681    nil,   nil,   nil,   nil,   150,   nil,   259 ]
    682 
    683 racc_goto_check = [
    684     32,    27,    25,    55,    27,    27,    27,    68,    53,    34,
    685     24,    33,    54,     6,    44,    24,     8,    49,    10,    10,
    686     10,    12,    43,    35,    41,    51,    13,    47,    30,    27,
    687     26,    38,    58,    62,    14,    14,    77,    34,    53,    36,
    688     59,     2,     9,    18,    35,    35,    10,    46,    35,    16,
    689     16,    16,    16,    19,    51,    20,    43,    43,    26,     9,
    690     58,    62,    30,    30,    27,    59,    21,    36,    32,    46,
    691     32,    22,    34,    31,    24,    33,     9,     9,    15,    15,
    692     27,    37,     6,    39,     6,    27,    27,    40,    32,    27,
    693      6,    25,     6,    34,    34,    68,    47,    34,    38,    12,
    694     12,    12,    30,    13,    24,    53,    17,    17,    42,    45,
    695     48,    35,     8,     6,    35,    52,     9,    35,     9,    57,
    696     41,    60,    61,    65,    66,    67,     1,   nil,   nil,   nil,
    697    nil,   nil,   nil,    53,    10,   nil,   nil,   nil,   nil,   nil,
    698    nil,   nil,   nil,   nil,     6,   nil,    32,   nil,   nil,   nil,
    699    nil,   nil,    27,   nil,    32,    27,   nil,    25,    27,   nil,
    700     34,   nil,   nil,    34,   nil,   nil,    34,   nil,    32,   nil,
    701     24,   nil,   nil,    25,   nil,   nil,    12,   nil,     6,    30,
    702    nil,   nil,   nil,    68,   nil,    68,    24,    49,   nil,   nil,
    703    nil,   nil,   nil,     9,   nil,   nil,    44,   nil,   nil,   nil,
    704    nil,   nil,    53,   nil,   nil,     6,   nil,   nil,   nil,    54,
    705     35,   nil,    32,   nil,   nil,   nil,   nil,     6,     6,   nil,
    706      6,     6,    10,    68,    10,   nil,   nil,    53,   nil,   nil,
    707    nil,   nil,   nil,   nil,   nil,    24,    33,   nil,   nil,   nil,
    708     68,    68,   nil,   nil,    27,   nil,    27,     6,   nil,   nil,
    709    nil,    27,   nil,   nil,    68,   nil,    25,    55,    32,    34,
    710     68,   nil,    10,   nil,   nil,   nil,   nil,   nil,   nil,    24,
    711    nil,    27,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    10,
    712     10,     6,     6,    24,   nil,   nil,   nil,   nil,   nil,   nil,
    713    nil,   nil,   nil,    10,   nil,     6,   nil,   nil,   nil,    10,
     742   nil,   nil,   nil,   nil,   nil,   423,   399,   145,   nil,   nil,
    714743   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    715744   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     745   306 ]
     746
     747racc_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,
    716776   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    717    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 ]
    718787
    719788racc_goto_pointer = [
    720    nil,   126,    41,   nil,   nil,   nil,   -97,   nil,  -163,     6,
    721    -97,   nil,   -93,   -84,  -161,  -119,  -150,   -97,  -162,  -153,
    722   -152,  -142,  -138,   nil,   -65,   -78,    28,    -1,   nil,   nil,
    723     -8,    -1,    -4,   -64,     7,   -42,    37,    59,   -55,    -2,
    724     65,  -132,   -50,   -14,  -144,    86,   -18,   -63,    18,   -75,
    725    nil,   -42,   -53,   -45,   -37,   -78,   nil,  -126,  -118,  -206,
    726    -18,   120,    31,   nil,   nil,    51,    76,    48,  -136,   nil,
    727    nil,   nil,   nil,   nil,   nil,   nil,   nil,  -179 ]
     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 ]
    728798
    729799racc_goto_default = [
    730    nil,   nil,   nil,   112,   103,   109,   242,   113,   nil,     7,
    731    124,   114,   125,   nil,   126,   127,   128,   129,   130,   131,
    732    132,   133,   134,   135,   177,   138,   218,   216,    46,     5,
    733      6,    47,    82,   nil,    55,    13,    56,   nil,   nil,   nil,
    734    nil,   157,   nil,   178,   nil,   nil,   nil,    91,   nil,   nil,
    735     24,   nil,    94,    49,    50,   333,   148,   149,   331,   250,
    736    nil,   nil,   nil,    31,    32,   nil,   225,   nil,   nil,   219,
    737    220,   221,   222,   223,   224,   226,   227,   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 ]
    738809
    739810racc_reduce_table = [
    740811  0, 0, :racc_error,
    741   1, 97, :_reduce_none,
    742   1, 99, :_reduce_2,
    743   1, 99, :_reduce_3,
    744   1, 99, :_reduce_4,
    745   1, 99, :_reduce_5,
    746   1, 99, :_reduce_6,
    747   1, 99, :_reduce_7,
    748   1, 99, :_reduce_8,
    749   3, 99, :_reduce_9,
    750   1, 101, :_reduce_10,
    751   2, 101, :_reduce_11,
    752   1, 103, :_reduce_none,
    753   4, 103, :_reduce_none,
    754   5, 103, :_reduce_none,
    755   4, 103, :_reduce_15,
    756   3, 103, :_reduce_16,
    757   3, 103, :_reduce_17,
    758   2, 103, :_reduce_18,
    759   2, 103, :_reduce_19,
    760   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,
    761823  1, 104, :_reduce_none,
     824  4, 104, :_reduce_13,
    762825  3, 104, :_reduce_none,
    763   1, 106, :_reduce_none,
    764   2, 106, :_reduce_24,
    765   2, 106, :_reduce_25,
    766   4, 106, :_reduce_26,
    767   2, 106, :_reduce_27,
    768   2, 106, :_reduce_28,
    769   1, 107, :_reduce_29,
    770   1, 107, :_reduce_30,
    771   1, 107, :_reduce_31,
    772   1, 107, :_reduce_32,
    773   1, 107, :_reduce_33,
    774   1, 107, :_reduce_34,
    775   1, 108, :_reduce_none,
    776   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,
    777836  1, 110, :_reduce_none,
    778   3, 110, :_reduce_38,
    779   3, 110, :_reduce_39,
    780   3, 110, :_reduce_40,
    781   1, 111, :_reduce_none,
    782   3, 111, :_reduce_42,
    783   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,
    784848  1, 112, :_reduce_none,
    785   3, 112, :_reduce_45,
    786   3, 112, :_reduce_46,
     849  4, 112, :_reduce_38,
    787850  1, 113, :_reduce_none,
    788   3, 113, :_reduce_48,
    789   3, 113, :_reduce_49,
    790   3, 113, :_reduce_50,
    791   3, 113, :_reduce_51,
     851  3, 113, :_reduce_40,
     852  3, 113, :_reduce_41,
     853  3, 113, :_reduce_42,
    792854  1, 114, :_reduce_none,
    793   3, 114, :_reduce_53,
    794   3, 114, :_reduce_54,
     855  3, 114, :_reduce_44,
     856  3, 114, :_reduce_45,
    795857  1, 115, :_reduce_none,
    796   3, 115, :_reduce_56,
     858  3, 115, :_reduce_47,
     859  3, 115, :_reduce_48,
    797860  1, 116, :_reduce_none,
    798   3, 116, :_reduce_58,
     861  3, 116, :_reduce_50,
     862  3, 116, :_reduce_51,
     863  3, 116, :_reduce_52,
     864  3, 116, :_reduce_53,
    799865  1, 117, :_reduce_none,
    800   3, 117, :_reduce_60,
     866  3, 117, :_reduce_55,
     867  3, 117, :_reduce_56,
    801868  1, 118, :_reduce_none,
    802   3, 118, :_reduce_62,
     869  3, 118, :_reduce_58,
    803870  1, 119, :_reduce_none,
    804   3, 119, :_reduce_64,
     871  3, 119, :_reduce_60,
    805872  1, 120, :_reduce_none,
    806   5, 120, :_reduce_66,
    807   1, 102, :_reduce_67,
    808   1, 121, :_reduce_68,
    809   3, 122, :_reduce_none,
    810   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,
    811878  1, 123, :_reduce_none,
    812   1, 123, :_reduce_72,
    813   2, 123, :_reduce_73,
    814   2, 123, :_reduce_74,
    815   2, 123, :_reduce_75,
    816   1, 124, :_reduce_76,
    817   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,
    818899  1, 127, :_reduce_none,
    819   3, 127, :_reduce_79,
    820   1, 126, :_reduce_80,
    821   1, 126, :_reduce_81,
    822   1, 126, :_reduce_82,
    823   1, 126, :_reduce_83,
    824   1, 126, :_reduce_84,
    825   1, 126, :_reduce_85,
    826   1, 126, :_reduce_86,
    827   1, 126, :_reduce_87,
    828   1, 126, :_reduce_88,
    829   1, 126, :_reduce_89,
    830   1, 126, :_reduce_90,
    831   1, 126, :_reduce_91,
    832   1, 126, :_reduce_92,
    833   1, 126, :_reduce_93,
    834   0, 135, :_reduce_94,
    835   6, 130, :_reduce_95,
    836   0, 136, :_reduce_96,
    837   5, 130, :_reduce_97,
    838   2, 130, :_reduce_98,
    839   1, 134, :_reduce_none,
    840   2, 134, :_reduce_none,
    841   1, 133, :_reduce_101,
    842   3, 137, :_reduce_102,
    843   2, 137, :_reduce_none,
    844   2, 137, :_reduce_none,
    845   1, 139, :_reduce_none,
    846   2, 139, :_reduce_106,
    847   1, 139, :_reduce_107,
    848   2, 139, :_reduce_108,
    849   1, 138, :_reduce_109,
    850   3, 138, :_reduce_110,
     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,
    851933  1, 140, :_reduce_none,
    852   5, 131, :_reduce_none,
    853   4, 131, :_reduce_none,
    854   2, 131, :_reduce_none,
    855   1, 142, :_reduce_none,
    856   2, 142, :_reduce_none,
    857   1, 141, :_reduce_none,
    858   3, 143, :_reduce_none,
     934  2, 140, :_reduce_none,
     935  1, 139, :_reduce_124,
     936  3, 143, :_reduce_125,
     937  5, 143, :_reduce_126,
    859938  2, 143, :_reduce_none,
    860939  2, 143, :_reduce_none,
    861   1, 144, :_reduce_none,
    862   3, 144, :_reduce_none,
     940  2, 145, :_reduce_129,
    863941  1, 145, :_reduce_none,
    864   4, 132, :_reduce_none,
    865   5, 132, :_reduce_none,
    866   2, 132, :_reduce_none,
    867   1, 146, :_reduce_127,
    868   1, 147, :_reduce_none,
    869   3, 147, :_reduce_none,
     942  2, 145, :_reduce_131,
     943  1, 145, :_reduce_132,
     944  1, 144, :_reduce_133,
     945  3, 144, :_reduce_134,
     946  1, 146, :_reduce_none,
     947  5, 136, :_reduce_none,
     948  4, 136, :_reduce_none,
     949  2, 136, :_reduce_none,
     950  1, 147, :_reduce_139,
     951  1, 149, :_reduce_none,
     952  2, 149, :_reduce_none,
    870953  1, 148, :_reduce_none,
    871   3, 148, :_reduce_none,
    872   1, 105, :_reduce_132,
    873   1, 105, :_reduce_133,
    874   2, 128, :_reduce_134,
    875   1, 128, :_reduce_none,
    876   2, 128, :_reduce_136,
    877   1, 150, :_reduce_137,
    878   3, 150, :_reduce_138,
    879   4, 150, :_reduce_139,
    880   3, 150, :_reduce_140,
    881   4, 150, :_reduce_141,
    882   3, 150, :_reduce_142,
    883   1, 149, :_reduce_143,
    884   2, 149, :_reduce_144,
    885   2, 149, :_reduce_145,
    886   3, 149, :_reduce_146,
     954  3, 150, :_reduce_none,
     955  2, 150, :_reduce_none,
     956  2, 150, :_reduce_none,
    887957  1, 151, :_reduce_none,
    888   5, 151, :_reduce_none,
     958  3, 151, :_reduce_none,
    889959  1, 152, :_reduce_none,
     960  2, 152, :_reduce_none,
    890961  3, 152, :_reduce_none,
    891   2, 153, :_reduce_none,
    892   2, 153, :_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,
    893970  1, 153, :_reduce_none,
    894   1, 109, :_reduce_none,
    895   2, 109, :_reduce_none,
     971  3, 153, :_reduce_none,
    896972  1, 154, :_reduce_none,
    897   1, 154, :_reduce_none,
    898   2, 154, :_reduce_none,
    899   3, 155, :_reduce_none,
    900   2, 155, :_reduce_none,
    901   3, 155, :_reduce_none,
    902   3, 155, :_reduce_none,
    903   4, 155, :_reduce_none,
    904   2, 155, :_reduce_164,
    905   3, 155, :_reduce_none,
    906   3, 155, :_reduce_166,
    907   4, 155, :_reduce_none,
    908   1, 129, :_reduce_168,
    909   3, 129, :_reduce_169,
    910   4, 129, :_reduce_170,
    911   4, 129, :_reduce_171,
    912   1, 156, :_reduce_172,
    913   3, 156, :_reduce_173,
    914   0, 98, :_reduce_none,
    915   2, 98, :_reduce_none,
     973  3, 154, :_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,
     995  1, 159, :_reduce_none,
     996  2, 159, :_reduce_none,
    916997  1, 157, :_reduce_none,
    917   2, 157, :_reduce_none,
     998  5, 157, :_reduce_none,
     999  1, 160, :_reduce_none,
     1000  3, 160, :_reduce_none,
     1001  2, 161, :_reduce_none,
     1002  2, 161, :_reduce_none,
     1003  1, 161, :_reduce_none,
    9181004  1, 158, :_reduce_none,
    919   1, 158, :_reduce_none,
    920   2, 158, :_reduce_none,
    921   2, 158, :_reduce_none,
    922   1, 158, :_reduce_none,
    923   1, 158, :_reduce_none,
    924   1, 158, :_reduce_none,
    925   4, 159, :_reduce_185,
    926   1, 161, :_reduce_186,
    927   3, 161, :_reduce_187,
    928   3, 160, :_reduce_none,
    929   0, 163, :_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,
    9301012  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,
    9311028  1, 164, :_reduce_none,
    932   1, 164, :_reduce_none,
    933   1, 164, :_reduce_none,
    934   1, 164, :_reduce_none,
    935   1, 164, :_reduce_none,
    936   1, 164, :_reduce_none,
    937   1, 164, :_reduce_none,
    938   1, 164, :_reduce_none,
    939   1, 164, :_reduce_none,
    940   1, 164, :_reduce_none,
    941   1, 164, :_reduce_none,
    942   5, 165, :_reduce_none,
    943   7, 165, :_reduce_none,
    944   5, 166, :_reduce_none,
    945   7, 167, :_reduce_none,
    946   9, 168, :_reduce_none,
    947   5, 169, :_reduce_none,
    948   3, 170, :_reduce_none,
    949   4, 170, :_reduce_none,
    950   3, 170, :_reduce_none,
    951   3, 162, :_reduce_none,
     1029  2, 164, :_reduce_none,
     1030  1, 165, :_reduce_none,
     1031  1, 165, :_reduce_none,
     1032  2, 165, :_reduce_none,
     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,
    9521051  3, 171, :_reduce_none,
    953   2, 171, :_reduce_none,
    954   2, 171, :_reduce_none,
     1052  4, 171, :_reduce_none,
    9551053  3, 171, :_reduce_none,
    956   2, 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,
    9571061  2, 172, :_reduce_none,
    958   4, 172, :_reduce_none,
    959   1, 173, :_reduce_none,
    960   1, 173, :_reduce_none,
    961   1, 173, :_reduce_none,
    962   1, 173, :_reduce_none,
    963   1, 173, :_reduce_none,
    964   1, 173, :_reduce_none,
    965   1, 173, :_reduce_none,
    966   1, 173, :_reduce_none,
    967   1, 173, :_reduce_none,
    968   1, 173, :_reduce_none,
    969   1, 173, :_reduce_none,
    970   1, 125, :_reduce_none,
    971   1, 125, :_reduce_none,
    972   1, 125, :_reduce_none,
    973   1, 125, :_reduce_none,
    974   1, 125, :_reduce_none,
    975   1, 125, :_reduce_none,
    976   1, 125, :_reduce_none,
    977   1, 125, :_reduce_none,
    978   1, 100, :_reduce_238,
    979   2, 100, :_reduce_239,
    980   3, 100, :_reduce_240 ]
    981 
    982 racc_reduce_n = 241
    983 
    984 racc_shift_n = 398
     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
     1081racc_reduce_n = 269
     1082
     1083racc_shift_n = 447
    9851084
    9861085racc_token_table = {
     
    10021101  "++" => 15,
    10031102  "--" => 16,
    1004   "," => 17,
    1005   :SIZEOF => 18,
    1006   "&" => 19,
    1007   "*" => 20,
    1008   "+" => 21,
    1009   "-" => 22,
    1010   "~" => 23,
    1011   "!" => 24,
    1012   "/" => 25,
    1013   "%" => 26,
    1014   "<<" => 27,
    1015   ">>" => 28,
    1016   "<" => 29,
    1017   ">" => 30,
    1018   "<=" => 31,
    1019   ">=" => 32,
    1020   "==" => 33,
    1021   "!=" => 34,
    1022   "^" => 35,
    1023   "|" => 36,
    1024   "&&" => 37,
    1025   "||" => 38,
    1026   "?" => 39,
    1027   ":" => 40,
    1028   ";" => 41,
    1029   "=" => 42,
    1030   :VOID => 43,
    1031   :FLOAT => 44,
    1032   :DOUBLE => 45,
    1033   :BOOL => 46,
    1034   :TYPE_NAME => 47,
    1035   :CHAR => 48,
    1036   :SHORT => 49,
    1037   :INT => 50,
    1038   :LONG => 51,
    1039   :SIGNED => 52,
    1040   :UNSIGNED => 53,
    1041   :STRUCT => 54,
    1042   "{" => 55,
    1043   "}" => 56,
    1044   :UNION => 57,
    1045   :ENUM => 58,
    1046   :CONST => 59,
    1047   :VOLATILE => 60,
    1048   :C_EXP => 61,
    1049   :EXTENSION => 62,
    1050   :TYPEDEF => 63,
    1051   :IF => 64,
    1052   :ELSE => 65,
    1053   :WHILE => 66,
    1054   :DO => 67,
    1055   :FOR => 68,
    1056   :SWITCH => 69,
    1057   :infunc_statment => 70,
    1058   :CASE => 71,
    1059   :DEFAULT => 72,
    1060   :GOTO => 73,
    1061   :CONTINUE => 74,
    1062   :BREAK => 75,
    1063   :RETURN => 76,
    1064   "+=" => 77,
    1065   "-=" => 78,
    1066   "*=" => 79,
    1067   "/=" => 80,
    1068   "%=" => 81,
    1069   "<<=" => 82,
    1070   ">>=" => 83,
    1071   "&=" => 84,
    1072   "|=" => 85,
    1073   "^=" => 86,
    1074   :__INLINE__ => 87,
    1075   :INLINE => 88,
    1076   :__INLINE => 89,
    1077   :CINLINE => 90,
    1078   :EXTERN => 91,
    1079   :STATIC => 92,
    1080   :AUTO => 93,
    1081   :REGISTER => 94,
    1082   "::" => 95 }
    1083 
    1084 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
     1184racc_nt_base = 97
    10851185
    10861186racc_use_result_var = true
     
    11201220  "\"++\"",
    11211221  "\"--\"",
     1222  "\"{\"",
     1223  "\"}\"",
    11221224  "\",\"",
    11231225  "SIZEOF",
     
    11441246  "\"?\"",
    11451247  "\":\"",
    1146   "\";\"",
    11471248  "\"=\"",
    1148   "VOID",
    1149   "FLOAT",
    1150   "DOUBLE",
    1151   "BOOL",
    1152   "TYPE_NAME",
    1153   "CHAR",
    1154   "SHORT",
    1155   "INT",
    1156   "LONG",
    1157   "SIGNED",
    1158   "UNSIGNED",
    1159   "STRUCT",
    1160   "\"{\"",
    1161   "\"}\"",
    1162   "UNION",
    1163   "ENUM",
    1164   "CONST",
    1165   "VOLATILE",
    1166   "C_EXP",
    1167   "EXTENSION",
    1168   "TYPEDEF",
    1169   "IF",
    1170   "ELSE",
    1171   "WHILE",
    1172   "DO",
    1173   "FOR",
    1174   "SWITCH",
    1175   "infunc_statment",
    1176   "CASE",
    1177   "DEFAULT",
    1178   "GOTO",
    1179   "CONTINUE",
    1180   "BREAK",
    1181   "RETURN",
    11821249  "\"+=\"",
    11831250  "\"-=\"",
     
    11901257  "\"|=\"",
    11911258  "\"^=\"",
     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",
    11921281  "__INLINE__",
    11931282  "INLINE",
    11941283  "__INLINE",
    11951284  "CINLINE",
    1196   "EXTERN",
    1197   "STATIC",
    1198   "AUTO",
    1199   "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",
    12001300  "\"::\"",
     1301  "_ASM",
    12011302  "$start",
    12021303  "all",
     
    12071308  "expression",
    12081309  "postfix_expression",
    1209   "argument_list",
     1310  "argument_expression_list",
    12101311  "type_qualifier",
     1312  "type_name",
     1313  "initializer_list",
     1314  "assignment_expression",
    12111315  "unary_expression",
    12121316  "unary_operator",
    12131317  "cast_expression",
    1214   "type_name",
    12151318  "multiplicative_expression",
    12161319  "additive_expression",
     
    12241327  "logical_or_expression",
    12251328  "conditional_expression",
     1329  "assignment_operator",
    12261330  "constant_expression",
    12271331  "declaration",
    12281332  "declaration_specifiers",
    12291333  "init_declarator_list",
    1230   "storage_class",
     1334  "storage_class_specifier",
    12311335  "type_specifier",
     1336  "function_specifier",
    12321337  "init_declarator",
    12331338  "declarator",
     
    12361341  "union_specifier",
    12371342  "enum_specifier",
     1343  "struct_term",
    12381344  "struct_tag",
    12391345  "struct_declaration_list",
     
    12421348  "struct_declaration",
    12431349  "struct_declarator_list",
    1244   "type_specifier_qualifier_list",
     1350  "specifier_qualifier_list",
    12451351  "struct_declarator",
     1352  "union_term",
    12461353  "union_tag",
    12471354  "union_declaration_list",
     
    12491356  "union_declarator_list",
    12501357  "union_declarator",
    1251   "enum_type",
    12521358  "enumerator_list",
    12531359  "enumerator",
     
    12551361  "direct_declarator",
    12561362  "parameter_type_list",
     1363  "identifier_list",
     1364  "type_qualifier_list",
    12571365  "parameter_list",
    12581366  "parameter_declaration",
    12591367  "abstract_declarator",
    12601368  "direct_abstract_declarator",
    1261   "initializer_list",
    12621369  "extension_statement",
    1263   "statement",
     1370  "cdl_statement",
    12641371  "typedef",
    12651372  "func_def",
    12661373  "declarator_list",
    1267   "compoundstatement",
    1268   "infunc_statement_list",
    1269   "infunc_statement",
     1374  "compound_statement",
     1375  "statement",
     1376  "labeled_statement",
     1377  "expression_statement",
    12701378  "ifstatement",
    12711379  "whilestatement",
     
    12731381  "forstatement",
    12741382  "switchstatement",
    1275   "labelstatement",
    1276   "gotostatement",
    1277   "expressionstatement",
    1278   "assignment_operator" ]
     1383  "jump_statement",
     1384  "asm_statement",
     1385  "block_item_list",
     1386  "block_item" ]
    12791387
    12801388Racc_debug_parser = false
     
    12861394# reduce 1 omitted
    12871395
    1288 module_eval(<<'.,.,', 'C_parser.y.rb', 52)
     1396module_eval(<<'.,.,', 'C_parser.y.rb', 57)
    12891397  def _reduce_2(val, _values, result)
    12901398     result = [ :IDENTIFIER, val[0] ]
     
    12931401.,.,
    12941402
    1295 module_eval(<<'.,.,', 'C_parser.y.rb', 60)
     1403module_eval(<<'.,.,', 'C_parser.y.rb', 65)
    12961404  def _reduce_3(val, _values, result)
    12971405     result = [ :INTEGER_CONSTANT, val[0] ]
     
    13001408.,.,
    13011409
    1302 module_eval(<<'.,.,', 'C_parser.y.rb', 62)
     1410module_eval(<<'.,.,', 'C_parser.y.rb', 67)
    13031411  def _reduce_4(val, _values, result)
    13041412     result = [ :FLOATING_CONSTANT, val[0] ]
     
    13071415.,.,
    13081416
    1309 module_eval(<<'.,.,', 'C_parser.y.rb', 64)
     1417module_eval(<<'.,.,', 'C_parser.y.rb', 69)
    13101418  def _reduce_5(val, _values, result)
    13111419     result = [ :OCTAL_CONSTANT, val[0] ]
     
    13141422.,.,
    13151423
    1316 module_eval(<<'.,.,', 'C_parser.y.rb', 66)
     1424module_eval(<<'.,.,', 'C_parser.y.rb', 71)
    13171425  def _reduce_6(val, _values, result)
    13181426     result = [ :HEX_CONSTANT, val[0] ]
     
    13211429.,.,
    13221430
    1323 module_eval(<<'.,.,', 'C_parser.y.rb', 68)
     1431module_eval(<<'.,.,', 'C_parser.y.rb', 73)
    13241432  def _reduce_7(val, _values, result)
    13251433     result = [ :CHARACTER_LITERAL, val[0] ]
     
    13281436.,.,
    13291437
    1330 module_eval(<<'.,.,', 'C_parser.y.rb', 70)
     1438module_eval(<<'.,.,', 'C_parser.y.rb', 75)
    13311439  def _reduce_8(val, _values, result)
    13321440     result = [ :STRING_LITERAL_LIST, val[0] ]
     
    13351443.,.,
    13361444
    1337 module_eval(<<'.,.,', 'C_parser.y.rb', 72)
     1445module_eval(<<'.,.,', 'C_parser.y.rb', 77)
    13381446  def _reduce_9(val, _values, result)
    13391447     result = [ :PARENTHESES, val[1].get_elements ]
     
    13421450.,.,
    13431451
    1344 module_eval(<<'.,.,', 'C_parser.y.rb', 76)
     1452module_eval(<<'.,.,', 'C_parser.y.rb', 81)
    13451453  def _reduce_10(val, _values, result)
    13461454     result = [val[0]]
     
    13491457.,.,
    13501458
    1351 module_eval(<<'.,.,', 'C_parser.y.rb', 78)
     1459module_eval(<<'.,.,', 'C_parser.y.rb', 83)
    13521460  def _reduce_11(val, _values, result)
    13531461     result << val[1]
     
    13581466# reduce 12 omitted
    13591467
    1360 # reduce 13 omitted
     1468module_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.,.,
    13611474
    13621475# reduce 14 omitted
    13631476
    1364 module_eval(<<'.,.,', 'C_parser.y.rb', 86)
    1365   def _reduce_15(val, _values, result)
    1366      result = [ :OP_SUBSC, val[0], val[2] ]
    1367     result
    1368   end
    1369 .,.,
    1370 
    1371 module_eval(<<'.,.,', 'C_parser.y.rb', 88)
    1372   def _reduce_16(val, _values, result)
     1477# reduce 15 omitted
     1478
     1479# reduce 16 omitted
     1480
     1481module_eval(<<'.,.,', 'C_parser.y.rb', 94)
     1482  def _reduce_17(val, _values, result)
    13731483     result = [ :OP_DOT, val[0], val[2] ]
    13741484    result
     
    13761486.,.,
    13771487
    1378 module_eval(<<'.,.,', 'C_parser.y.rb', 90)
    1379   def _reduce_17(val, _values, result)
     1488module_eval(<<'.,.,', 'C_parser.y.rb', 96)
     1489  def _reduce_18(val, _values, result)
    13801490     result = [ :OP_REF, val[0], val[2] ]
    13811491    result
     
    13831493.,.,
    13841494
    1385 module_eval(<<'.,.,', 'C_parser.y.rb', 91)
    1386   def _reduce_18(val, _values, result)
    1387      result = val[0]
    1388     result
    1389   end
    1390 .,.,
    1391 
    1392 module_eval(<<'.,.,', 'C_parser.y.rb', 92)
     1495module_eval(<<'.,.,', 'C_parser.y.rb', 97)
    13931496  def _reduce_19(val, _values, result)
    13941497     result = val[0]
     
    13971500.,.,
    13981501
    1399 # reduce 20 omitted
     1502module_eval(<<'.,.,', 'C_parser.y.rb', 98)
     1503  def _reduce_20(val, _values, result)
     1504     result = val[0]
     1505    result
     1506  end
     1507.,.,
    14001508
    14011509# reduce 21 omitted
     
    14051513# reduce 23 omitted
    14061514
    1407 module_eval(<<'.,.,', 'C_parser.y.rb', 104)
    1408   def _reduce_24(val, _values, result)
     1515# reduce 24 omitted
     1516
     1517# reduce 25 omitted
     1518
     1519module_eval(<<'.,.,', 'C_parser.y.rb', 111)
     1520  def _reduce_26(val, _values, result)
    14091521     result = [ val[0], val[1] ]
    14101522    result
     
    14121524.,.,
    14131525
    1414 module_eval(<<'.,.,', 'C_parser.y.rb', 106)
    1415   def _reduce_25(val, _values, result)
     1526module_eval(<<'.,.,', 'C_parser.y.rb', 113)
     1527  def _reduce_27(val, _values, result)
    14161528     result = [ :OP_SIZEOF_EXPR, val[1] ]
    14171529    result
     
    14191531.,.,
    14201532
    1421 module_eval(<<'.,.,', 'C_parser.y.rb', 108)
    1422   def _reduce_26(val, _values, result)
     1533module_eval(<<'.,.,', 'C_parser.y.rb', 115)
     1534  def _reduce_28(val, _values, result)
    14231535     result = [ :OP_SIZEOF_TYPE, val[1] ]
    14241536    result
     
    14261538.,.,
    14271539
    1428 module_eval(<<'.,.,', 'C_parser.y.rb', 109)
    1429   def _reduce_27(val, _values, result)
     1540module_eval(<<'.,.,', 'C_parser.y.rb', 116)
     1541  def _reduce_29(val, _values, result)
    14301542     result = val[1]
    14311543    result
     
    14331545.,.,
    14341546
    1435 module_eval(<<'.,.,', 'C_parser.y.rb', 110)
    1436   def _reduce_28(val, _values, result)
     1547module_eval(<<'.,.,', 'C_parser.y.rb', 117)
     1548  def _reduce_30(val, _values, result)
    14371549     result = val[1]
    14381550    result
     
    14401552.,.,
    14411553
    1442 module_eval(<<'.,.,', 'C_parser.y.rb', 113)
    1443   def _reduce_29(val, _values, result)
     1554module_eval(<<'.,.,', 'C_parser.y.rb', 120)
     1555  def _reduce_31(val, _values, result)
    14441556     result = :OP_U_AMP
    14451557    result
     
    14471559.,.,
    14481560
    1449 module_eval(<<'.,.,', 'C_parser.y.rb', 114)
    1450   def _reduce_30(val, _values, result)
     1561module_eval(<<'.,.,', 'C_parser.y.rb', 121)
     1562  def _reduce_32(val, _values, result)
    14511563     result = :OP_U_ASTER
    14521564    result
     
    14541566.,.,
    14551567
    1456 module_eval(<<'.,.,', 'C_parser.y.rb', 115)
    1457   def _reduce_31(val, _values, result)
     1568module_eval(<<'.,.,', 'C_parser.y.rb', 122)
     1569  def _reduce_33(val, _values, result)
    14581570     result = :OP_U_PLUS
    14591571    result
     
    14611573.,.,
    14621574
    1463 module_eval(<<'.,.,', 'C_parser.y.rb', 116)
    1464   def _reduce_32(val, _values, result)
     1575module_eval(<<'.,.,', 'C_parser.y.rb', 123)
     1576  def _reduce_34(val, _values, result)
    14651577     result = :OP_U_MINUS
    14661578    result
     
    14681580.,.,
    14691581
    1470 module_eval(<<'.,.,', 'C_parser.y.rb', 117)
    1471   def _reduce_33(val, _values, result)
     1582module_eval(<<'.,.,', 'C_parser.y.rb', 124)
     1583  def _reduce_35(val, _values, result)
    14721584     result = :OP_U_TILDE
    14731585    result
     
    14751587.,.,
    14761588
    1477 module_eval(<<'.,.,', 'C_parser.y.rb', 118)
    1478   def _reduce_34(val, _values, result)
     1589module_eval(<<'.,.,', 'C_parser.y.rb', 125)
     1590  def _reduce_36(val, _values, result)
    14791591     result = :OP_U_EXCLAM
    14801592    result
     
    14821594.,.,
    14831595
    1484 # reduce 35 omitted
    1485 
    1486 module_eval(<<'.,.,', 'C_parser.y.rb', 123)
    1487   def _reduce_36(val, _values, result)
     1596# reduce 37 omitted
     1597
     1598module_eval(<<'.,.,', 'C_parser.y.rb', 130)
     1599  def _reduce_38(val, _values, result)
    14881600      result = [ :CAST, val[1], val[3] ]
    14891601    result
     
    14911603.,.,
    14921604
    1493 # reduce 37 omitted
    1494 
    1495 module_eval(<<'.,.,', 'C_parser.y.rb', 128)
    1496   def _reduce_38(val, _values, result)
     1605# reduce 39 omitted
     1606
     1607module_eval(<<'.,.,', 'C_parser.y.rb', 135)
     1608  def _reduce_40(val, _values, result)
    14971609     result = [ :OP_MULT, val[0], val[2] ] 
    14981610    result
     
    15001612.,.,
    15011613
    1502 module_eval(<<'.,.,', 'C_parser.y.rb', 130)
    1503   def _reduce_39(val, _values, result)
     1614module_eval(<<'.,.,', 'C_parser.y.rb', 137)
     1615  def _reduce_41(val, _values, result)
    15041616     result = [ :OP_DIV, val[0], val[2] ] 
    15051617    result
     
    15071619.,.,
    15081620
    1509 module_eval(<<'.,.,', 'C_parser.y.rb', 132)
    1510   def _reduce_40(val, _values, result)
     1621module_eval(<<'.,.,', 'C_parser.y.rb', 139)
     1622  def _reduce_42(val, _values, result)
    15111623     result = [ :OP_REMAIN, val[0], val[2] ] 
    15121624    result
     
    15141626.,.,
    15151627
    1516 # reduce 41 omitted
    1517 
    1518 module_eval(<<'.,.,', 'C_parser.y.rb', 137)
    1519   def _reduce_42(val, _values, result)
     1628# reduce 43 omitted
     1629
     1630module_eval(<<'.,.,', 'C_parser.y.rb', 144)
     1631  def _reduce_44(val, _values, result)
    15201632     result = [ :OP_ADD, val[0], val[2] ] 
    15211633    result
     
    15231635.,.,
    15241636
    1525 module_eval(<<'.,.,', 'C_parser.y.rb', 139)
    1526   def _reduce_43(val, _values, result)
     1637module_eval(<<'.,.,', 'C_parser.y.rb', 146)
     1638  def _reduce_45(val, _values, result)
    15271639     result = [ :OP_SUB, val[0], val[2] ] 
    15281640    result
     
    15301642.,.,
    15311643
    1532 # reduce 44 omitted
    1533 
    1534 module_eval(<<'.,.,', 'C_parser.y.rb', 144)
    1535   def _reduce_45(val, _values, result)
     1644# reduce 46 omitted
     1645
     1646module_eval(<<'.,.,', 'C_parser.y.rb', 151)
     1647  def _reduce_47(val, _values, result)
    15361648     result = [ :OP_LSFT, val[0], val[2] ] 
    15371649    result
     
    15391651.,.,
    15401652
    1541 module_eval(<<'.,.,', 'C_parser.y.rb', 146)
    1542   def _reduce_46(val, _values, result)
     1653module_eval(<<'.,.,', 'C_parser.y.rb', 153)
     1654  def _reduce_48(val, _values, result)
    15431655     result = [ :OP_RSFT, val[0], val[2] ] 
    15441656    result
     
    15461658.,.,
    15471659
    1548 # reduce 47 omitted
    1549 
    1550 module_eval(<<'.,.,', 'C_parser.y.rb', 151)
    1551   def _reduce_48(val, _values, result)
     1660# reduce 49 omitted
     1661
     1662module_eval(<<'.,.,', 'C_parser.y.rb', 158)
     1663  def _reduce_50(val, _values, result)
    15521664     result = [ :OP_LT, val[0], val[2] ] 
    15531665    result
     
    15551667.,.,
    15561668
    1557 module_eval(<<'.,.,', 'C_parser.y.rb', 153)
    1558   def _reduce_49(val, _values, result)
     1669module_eval(<<'.,.,', 'C_parser.y.rb', 160)
     1670  def _reduce_51(val, _values, result)
    15591671     result = [ :OP_GT, val[0], val[2] ] 
    15601672    result
     
    15621674.,.,
    15631675
    1564 module_eval(<<'.,.,', 'C_parser.y.rb', 155)
    1565   def _reduce_50(val, _values, result)
     1676module_eval(<<'.,.,', 'C_parser.y.rb', 162)
     1677  def _reduce_52(val, _values, result)
    15661678     result = [ :OP_LE, val[0], val[2] ] 
    15671679    result
     
    15691681.,.,
    15701682
    1571 module_eval(<<'.,.,', 'C_parser.y.rb', 157)
    1572   def _reduce_51(val, _values, result)
     1683module_eval(<<'.,.,', 'C_parser.y.rb', 164)
     1684  def _reduce_53(val, _values, result)
    15731685     result = [ :OP_GE, val[0], val[2] ] 
    15741686    result
     
    15761688.,.,
    15771689
    1578 # reduce 52 omitted
    1579 
    1580 module_eval(<<'.,.,', 'C_parser.y.rb', 162)
    1581   def _reduce_53(val, _values, result)
     1690# reduce 54 omitted
     1691
     1692module_eval(<<'.,.,', 'C_parser.y.rb', 169)
     1693  def _reduce_55(val, _values, result)
    15821694     result = [ :OP_EQ, val[0], val[2] ] 
    15831695    result
     
    15851697.,.,
    15861698
    1587 module_eval(<<'.,.,', 'C_parser.y.rb', 164)
    1588   def _reduce_54(val, _values, result)
     1699module_eval(<<'.,.,', 'C_parser.y.rb', 171)
     1700  def _reduce_56(val, _values, result)
    15891701     result = [ :OP_NE, val[0], val[2] ] 
    15901702    result
     
    15921704.,.,
    15931705
    1594 # reduce 55 omitted
    1595 
    1596 module_eval(<<'.,.,', 'C_parser.y.rb', 169)
    1597   def _reduce_56(val, _values, result)
     1706# reduce 57 omitted
     1707
     1708module_eval(<<'.,.,', 'C_parser.y.rb', 176)
     1709  def _reduce_58(val, _values, result)
    15981710     result = [ :OP_AND, val[0], val[2] ] 
    15991711    result
     
    16011713.,.,
    16021714
    1603 # reduce 57 omitted
    1604 
    1605 module_eval(<<'.,.,', 'C_parser.y.rb', 174)
    1606   def _reduce_58(val, _values, result)
     1715# reduce 59 omitted
     1716
     1717module_eval(<<'.,.,', 'C_parser.y.rb', 181)
     1718  def _reduce_60(val, _values, result)
    16071719     result = [ :OP_EOR, val[0], val[2] ] 
    16081720    result
     
    16101722.,.,
    16111723
    1612 # reduce 59 omitted
    1613 
    1614 module_eval(<<'.,.,', 'C_parser.y.rb', 179)
    1615   def _reduce_60(val, _values, result)
     1724# reduce 61 omitted
     1725
     1726module_eval(<<'.,.,', 'C_parser.y.rb', 186)
     1727  def _reduce_62(val, _values, result)
    16161728     result = [ :OP_OR, val[0], val[2] ] 
    16171729    result
     
    16191731.,.,
    16201732
    1621 # reduce 61 omitted
    1622 
    1623 module_eval(<<'.,.,', 'C_parser.y.rb', 184)
    1624   def _reduce_62(val, _values, result)
     1733# reduce 63 omitted
     1734
     1735module_eval(<<'.,.,', 'C_parser.y.rb', 191)
     1736  def _reduce_64(val, _values, result)
    16251737     result = [ :OP_LAND, val[0], val[2] ] 
    16261738    result
     
    16281740.,.,
    16291741
    1630 # reduce 63 omitted
    1631 
    1632 module_eval(<<'.,.,', 'C_parser.y.rb', 189)
    1633   def _reduce_64(val, _values, result)
     1742# reduce 65 omitted
     1743
     1744module_eval(<<'.,.,', 'C_parser.y.rb', 196)
     1745  def _reduce_66(val, _values, result)
    16341746     result = [ :OP_LOR, val[0], val[2] ] 
    16351747    result
     
    16371749.,.,
    16381750
    1639 # reduce 65 omitted
    1640 
    1641 module_eval(<<'.,.,', 'C_parser.y.rb', 194)
    1642   def _reduce_66(val, _values, result)
     1751# reduce 67 omitted
     1752
     1753module_eval(<<'.,.,', 'C_parser.y.rb', 201)
     1754  def _reduce_68(val, _values, result)
    16431755     result = [ :OP_CEX, val[0], val[2].get_elements, val[4] ] 
    16441756    result
     
    16461758.,.,
    16471759
    1648 module_eval(<<'.,.,', 'C_parser.y.rb', 201)
    1649   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
     1786module_eval(<<'.,.,', 'C_parser.y.rb', 223)
     1787  def _reduce_82(val, _values, result)
    16501788                        result = Expression.new( val[0] )
    16511789                        # result.print
     
    16551793.,.,
    16561794
    1657 module_eval(<<'.,.,', 'C_parser.y.rb', 208)
    1658   def _reduce_68(val, _values, result)
     1795module_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
     1803module_eval(<<'.,.,', 'C_parser.y.rb', 234)
     1804  def _reduce_84(val, _values, result)
    16591805                        result = Expression.new( val[0] )
    16601806                        # result.print
     
    16711817.,.,
    16721818
    1673 # reduce 69 omitted
    1674 
    1675 module_eval(<<'.,.,', 'C_parser.y.rb', 237)
    1676   def _reduce_70(val, _values, result)
     1819# reduce 85 omitted
     1820
     1821module_eval(<<'.,.,', 'C_parser.y.rb', 261)
     1822  def _reduce_86(val, _values, result)
    16771823                        result = CIntType.new( -3 )    # storage class は無視
    16781824               
     
    16811827.,.,
    16821828
    1683 # reduce 71 omitted
    1684 
    1685 module_eval(<<'.,.,', 'C_parser.y.rb', 242)
    1686   def _reduce_72(val, _values, result)
     1829module_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
     1839module_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
     1847module_eval(<<'.,.,', 'C_parser.y.rb', 274)
     1848  def _reduce_90(val, _values, result)
    16871849                        result = CIntType.new( -3 )
    16881850                        result.set_qualifier val[0]
     
    16921854.,.,
    16931855
    1694 module_eval(<<'.,.,', 'C_parser.y.rb', 247)
    1695   def _reduce_73(val, _values, result)
    1696                         result = val[1]                # storage class は無視
    1697                
    1698     result
    1699   end
    1700 .,.,
    1701 
    1702 module_eval(<<'.,.,', 'C_parser.y.rb', 251)
    1703   def _reduce_74(val, _values, result)
    1704                         result = val[1].merge val[0]
    1705                
    1706     result
    1707   end
    1708 .,.,
    1709 
    1710 module_eval(<<'.,.,', 'C_parser.y.rb', 255)
    1711   def _reduce_75(val, _values, result)
     1856module_eval(<<'.,.,', 'C_parser.y.rb', 279)
     1857  def _reduce_91(val, _values, result)
    17121858                        val[1].set_qualifier val[0]
    1713                         result = val[1]
    1714                
    1715     result
    1716   end
    1717 .,.,
    1718 
    1719 module_eval(<<'.,.,', 'C_parser.y.rb', 262)
    1720   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
     1869module_eval(<<'.,.,', 'C_parser.y.rb', 287)
     1870  def _reduce_94(val, _values, result)
    17211871     result = [val[0]]
    17221872    result
     
    17241874.,.,
    17251875
    1726 module_eval(<<'.,.,', 'C_parser.y.rb', 264)
    1727   def _reduce_77(val, _values, result)
     1876module_eval(<<'.,.,', 'C_parser.y.rb', 289)
     1877  def _reduce_95(val, _values, result)
    17281878     result << val[2]
    17291879    result
     
    17311881.,.,
    17321882
    1733 # reduce 78 omitted
    1734 
    1735 module_eval(<<'.,.,', 'C_parser.y.rb', 269)
    1736   def _reduce_79(val, _values, result)
     1883# reduce 96 omitted
     1884
     1885module_eval(<<'.,.,', 'C_parser.y.rb', 294)
     1886  def _reduce_97(val, _values, result)
    17371887     val[0].set_initializer( val[2] )
    17381888    result
     
    17401890.,.,
    17411891
    1742 module_eval(<<'.,.,', 'C_parser.y.rb', 272)
    1743   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
     1900module_eval(<<'.,.,', 'C_parser.y.rb', 304)
     1901  def _reduce_102(val, _values, result)
    17441902     set_no_type_name true; result = CVoidType.new
    17451903    result
     
    17471905.,.,
    17481906
    1749 module_eval(<<'.,.,', 'C_parser.y.rb', 273)
    1750   def _reduce_81(val, _values, result)
     1907module_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
     1914module_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
     1921module_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
     1928module_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
     1935module_eval(<<'.,.,', 'C_parser.y.rb', 314)
     1936  def _reduce_107(val, _values, result)
    17511937     set_no_type_name true; result = CFloatType.new(-32)
    17521938    result
     
    17541940.,.,
    17551941
    1756 module_eval(<<'.,.,', 'C_parser.y.rb', 274)
    1757   def _reduce_82(val, _values, result)
     1942module_eval(<<'.,.,', 'C_parser.y.rb', 316)
     1943  def _reduce_108(val, _values, result)
    17581944     set_no_type_name true; result = CFloatType.new(-64)
    17591945    result
     
    17611947.,.,
    17621948
    1763 module_eval(<<'.,.,', 'C_parser.y.rb', 275)
    1764   def _reduce_83(val, _values, result)
    1765      set_no_type_name true; result = CBoolType.new
    1766     result
    1767   end
    1768 .,.,
    1769 
    1770 module_eval(<<'.,.,', 'C_parser.y.rb', 276)
    1771   def _reduce_84(val, _values, result)
    1772      set_no_type_name true; result = val[0]
    1773     result
    1774   end
    1775 .,.,
    1776 
    1777 module_eval(<<'.,.,', 'C_parser.y.rb', 277)
    1778   def _reduce_85(val, _values, result)
    1779      set_no_type_name true; result = CVoidType.new
    1780     result
    1781   end
    1782 .,.,
    1783 
    1784 module_eval(<<'.,.,', 'C_parser.y.rb', 278)
    1785   def _reduce_86(val, _values, result)
    1786      set_no_type_name true; result = CVoidType.new
    1787     result
    1788   end
    1789 .,.,
    1790 
    1791 module_eval(<<'.,.,', 'C_parser.y.rb', 279)
    1792   def _reduce_87(val, _values, result)
    1793      set_no_type_name true; result = CDefinedType.new( val[0].val )
    1794     result
    1795   end
    1796 .,.,
    1797 
    1798 module_eval(<<'.,.,', 'C_parser.y.rb', 281)
    1799   def _reduce_88(val, _values, result)
    1800      set_no_type_name true; result = CIntType.new(-11 )
    1801     result
    1802   end
    1803 .,.,
    1804 
    1805 module_eval(<<'.,.,', 'C_parser.y.rb', 282)
    1806   def _reduce_89(val, _values, result)
    1807      set_no_type_name true; result = CIntType.new( -2 )
    1808     result
    1809   end
    1810 .,.,
    1811 
    1812 module_eval(<<'.,.,', 'C_parser.y.rb', 283)
    1813   def _reduce_90(val, _values, result)
    1814      set_no_type_name true; result = CIntType.new( -3 )
    1815     result
    1816   end
    1817 .,.,
    1818 
    1819 module_eval(<<'.,.,', 'C_parser.y.rb', 284)
    1820   def _reduce_91(val, _values, result)
    1821      set_no_type_name true; result = CIntType.new( -4 )
    1822     result
    1823   end
    1824 .,.,
    1825 
    1826 module_eval(<<'.,.,', 'C_parser.y.rb', 287)
    1827   def _reduce_92(val, _values, result)
     1949module_eval(<<'.,.,', 'C_parser.y.rb', 319)
     1950  def _reduce_109(val, _values, result)
    18281951                        set_no_type_name true
    18291952                        result = CIntType.new( -3 )
     
    18341957.,.,
    18351958
    1836 module_eval(<<'.,.,', 'C_parser.y.rb', 293)
    1837   def _reduce_93(val, _values, result)
     1959module_eval(<<'.,.,', 'C_parser.y.rb', 325)
     1960  def _reduce_110(val, _values, result)
    18381961                        set_no_type_name true
    18391962                        result = CIntType.new( -3 )
     
    18441967.,.,
    18451968
    1846 module_eval(<<'.,.,', 'C_parser.y.rb', 301)
    1847   def _reduce_94(val, _values, result)
     1969module_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
     1976module_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
     1983module_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
     1990module_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
     1997module_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
     2004module_eval(<<'.,.,', 'C_parser.y.rb', 344)
     2005  def _reduce_116(val, _values, result)
    18482006     StructType.set_define( true ) 
    18492007    result
     
    18512009.,.,
    18522010
    1853 module_eval(<<'.,.,', 'C_parser.y.rb', 304)
    1854   def _reduce_95(val, _values, result)
     2011module_eval(<<'.,.,', 'C_parser.y.rb', 347)
     2012  def _reduce_117(val, _values, result)
    18552013                        StructType.end_of_parse
    18562014                        result = val[1]
     
    18602018.,.,
    18612019
    1862 module_eval(<<'.,.,', 'C_parser.y.rb', 309)
    1863   def _reduce_96(val, _values, result)
     2020module_eval(<<'.,.,', 'C_parser.y.rb', 353)
     2021  def _reduce_118(val, _values, result)
    18642022                        result = CStructType.new()
    18652023                        StructType.set_define( true )
     
    18692027.,.,
    18702028
    1871 module_eval(<<'.,.,', 'C_parser.y.rb', 314)
    1872   def _reduce_97(val, _values, result)
     2029module_eval(<<'.,.,', 'C_parser.y.rb', 358)
     2030  def _reduce_119(val, _values, result)
    18732031                        StructType.end_of_parse
    18742032                        result = val[1]
     
    18782036.,.,
    18792037
    1880 module_eval(<<'.,.,', 'C_parser.y.rb', 319)
    1881   def _reduce_98(val, _values, result)
     2038module_eval(<<'.,.,', 'C_parser.y.rb', 364)
     2039  def _reduce_120(val, _values, result)
    18822040                        StructType.set_define( false )
    18832041                        StructType.end_of_parse
     
    18882046.,.,
    18892047
    1890 # reduce 99 omitted
    1891 
    1892 # reduce 100 omitted
    1893 
    1894 module_eval(<<'.,.,', 'C_parser.y.rb', 331)
    1895   def _reduce_101(val, _values, result)
     2048module_eval(<<'.,.,', 'C_parser.y.rb', 370)
     2049  def _reduce_121(val, _values, result)
     2050     set_no_type_name true
     2051    result
     2052  end
     2053.,.,
     2054
     2055# reduce 122 omitted
     2056
     2057# reduce 123 omitted
     2058
     2059module_eval(<<'.,.,', 'C_parser.y.rb', 379)
     2060  def _reduce_124(val, _values, result)
    18962061                        result = CStructType.new( val[0].val )
    18972062                        set_no_type_name true
     
    19012066.,.,
    19022067
    1903 module_eval(<<'.,.,', 'C_parser.y.rb', 340)
    1904   def _reduce_102(val, _values, result)
     2068module_eval(<<'.,.,', 'C_parser.y.rb', 388)
     2069  def _reduce_125(val, _values, result)
    19052070                        val[1].each { |i|       # i: Decl
    19062071                                i.set_type( val[0] )
     
    19152080.,.,
    19162081
    1917 # reduce 103 omitted
    1918 
    1919 # reduce 104 omitted
    1920 
    1921 # reduce 105 omitted
    1922 
    1923 module_eval(<<'.,.,', 'C_parser.y.rb', 359)
    1924   def _reduce_106(val, _values, result)
     2082module_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
     2100module_eval(<<'.,.,', 'C_parser.y.rb', 417)
     2101  def _reduce_129(val, _values, result)
    19252102                        result = val[1].merge val[0]
    19262103               
     
    19292106.,.,
    19302107
    1931 module_eval(<<'.,.,', 'C_parser.y.rb', 363)
    1932   def _reduce_107(val, _values, result)
     2108# reduce 130 omitted
     2109
     2110module_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
     2119module_eval(<<'.,.,', 'C_parser.y.rb', 427)
     2120  def _reduce_132(val, _values, result)
    19332121                        result = CIntType.new( -3 )
    19342122                        result.set_qualifier val[0]
     
    19382126.,.,
    19392127
    1940 module_eval(<<'.,.,', 'C_parser.y.rb', 368)
    1941   def _reduce_108(val, _values, result)
    1942                         val[1].set_qualifier val[0]
    1943                         result = val[1]
    1944                
    1945     result
    1946   end
    1947 .,.,
    1948 
    1949 module_eval(<<'.,.,', 'C_parser.y.rb', 374)
    1950   def _reduce_109(val, _values, result)
     2128module_eval(<<'.,.,', 'C_parser.y.rb', 433)
     2129  def _reduce_133(val, _values, result)
    19512130     result = [ val[0] ]
    19522131    result
     
    19542133.,.,
    19552134
    1956 module_eval(<<'.,.,', 'C_parser.y.rb', 376)
    1957   def _reduce_110(val, _values, result)
     2135module_eval(<<'.,.,', 'C_parser.y.rb', 435)
     2136  def _reduce_134(val, _values, result)
    19582137     result << val[2]
    19592138    result
     
    19612140.,.,
    19622141
    1963 # reduce 111 omitted
    1964 
    1965 # reduce 112 omitted
    1966 
    1967 # reduce 113 omitted
    1968 
    1969 # reduce 114 omitted
    1970 
    1971 # reduce 115 omitted
    1972 
    1973 # reduce 116 omitted
    1974 
    1975 # reduce 117 omitted
    1976 
    1977 # reduce 118 omitted
    1978 
    1979 # reduce 119 omitted
    1980 
    1981 # reduce 120 omitted
    1982 
    1983 # reduce 121 omitted
    1984 
    1985 # reduce 122 omitted
    1986 
    1987 # reduce 123 omitted
    1988 
    1989 # reduce 124 omitted
    1990 
    1991 # reduce 125 omitted
    1992 
    1993 # reduce 126 omitted
    1994 
    1995 module_eval(<<'.,.,', 'C_parser.y.rb', 418)
    1996   def _reduce_127(val, _values, result)
    1997      result = CEnumType.new( -1 )
    1998     result
    1999   end
    2000 .,.,
    2001 
    2002 # reduce 128 omitted
    2003 
    2004 # reduce 129 omitted
    2005 
    2006 # reduce 130 omitted
    2007 
    2008 # reduce 131 omitted
    2009 
    2010 module_eval(<<'.,.,', 'C_parser.y.rb', 434)
    2011   def _reduce_132(val, _values, result)
     2142# reduce 135 omitted
     2143
     2144# reduce 136 omitted
     2145
     2146# reduce 137 omitted
     2147
     2148# reduce 138 omitted
     2149
     2150module_eval(<<'.,.,', 'C_parser.y.rb', 452)
     2151  def _reduce_139(val, _values, result)
     2152     set_no_type_name true
     2153    result
     2154  end
     2155.,.,
     2156
     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
     2203module_eval(<<'.,.,', 'C_parser.y.rb', 495)
     2204  def _reduce_163(val, _values, result)
    20122205     result = :CONST
    20132206    result
     
    20152208.,.,
    20162209
    2017 module_eval(<<'.,.,', 'C_parser.y.rb', 435)
    2018   def _reduce_133(val, _values, result)
     2210# reduce 164 omitted
     2211
     2212module_eval(<<'.,.,', 'C_parser.y.rb', 498)
     2213  def _reduce_165(val, _values, result)
    20192214     result = :VOLATILE
    20202215    result
     
    20222217.,.,
    20232218
    2024 module_eval(<<'.,.,', 'C_parser.y.rb', 440)
    2025   def _reduce_134(val, _values, result)
     2219# reduce 166 omitted
     2220
     2221# reduce 167 omitted
     2222
     2223# reduce 168 omitted
     2224
     2225# reduce 169 omitted
     2226
     2227module_eval(<<'.,.,', 'C_parser.y.rb', 509)
     2228  def _reduce_170(val, _values, result)
    20262229                        val[1].set_type( val[0] )
    20272230                        result = val[1]
     
    20312234.,.,
    20322235
    2033 # reduce 135 omitted
    2034 
    2035 module_eval(<<'.,.,', 'C_parser.y.rb', 446)
    2036   def _reduce_136(val, _values, result)
     2236# reduce 171 omitted
     2237
     2238module_eval(<<'.,.,', 'C_parser.y.rb', 515)
     2239  def _reduce_172(val, _values, result)
    20372240                        result = Decl.new( val[1].val )
    20382241                        result.set_type( val[0] )
     
    20422245.,.,
    20432246
    2044 module_eval(<<'.,.,', 'C_parser.y.rb', 452)
    2045   def _reduce_137(val, _values, result)
     2247module_eval(<<'.,.,', 'C_parser.y.rb', 521)
     2248  def _reduce_173(val, _values, result)
    20462249     result = Decl.new( val[0].val )
    20472250    result
     
    20492252.,.,
    20502253
    2051 module_eval(<<'.,.,', 'C_parser.y.rb', 454)
    2052   def _reduce_138(val, _values, result)
     2254module_eval(<<'.,.,', 'C_parser.y.rb', 523)
     2255  def _reduce_174(val, _values, result)
    20532256     result = val[1]
    20542257    result
     
    20562259.,.,
    20572260
    2058 module_eval(<<'.,.,', 'C_parser.y.rb', 457)
    2059   def _reduce_139(val, _values, result)
     2261module_eval(<<'.,.,', 'C_parser.y.rb', 526)
     2262  def _reduce_175(val, _values, result)
    20602263                        val[0].set_type( CArrayType.new( val[2] ) )
    20612264                        result = val[0]
     
    20652268.,.,
    20662269
    2067 module_eval(<<'.,.,', 'C_parser.y.rb', 462)
    2068   def _reduce_140(val, _values, result)
     2270module_eval(<<'.,.,', 'C_parser.y.rb', 531)
     2271  def _reduce_176(val, _values, result)
    20692272                        val[0].set_type( CArrayType.new )
    20702273                        result = val[0]
     
    20742277.,.,
    20752278
    2076 module_eval(<<'.,.,', 'C_parser.y.rb', 467)
    2077   def _reduce_141(val, _values, result)
     2279module_eval(<<'.,.,', 'C_parser.y.rb', 536)
     2280  def _reduce_177(val, _values, result)
    20782281                #       Generator.warning( "W6001 need 'void' for no parameter"  )
    20792282                        val[0].set_type( CFuncType.new )
     
    20842287.,.,
    20852288
    2086 module_eval(<<'.,.,', 'C_parser.y.rb', 475)
    2087   def _reduce_142(val, _values, result)
     2289# reduce 178 omitted
     2290
     2291module_eval(<<'.,.,', 'C_parser.y.rb', 543)
     2292  def _reduce_179(val, _values, result)
    20882293                #       Generator.warning( "W6002 need 'void' for no parameter"  )
    20892294                        val[0].set_type( CFuncType.new )
     
    20942299.,.,
    20952300
    2096 module_eval(<<'.,.,', 'C_parser.y.rb', 482)
    2097   def _reduce_143(val, _values, result)
     2301module_eval(<<'.,.,', 'C_parser.y.rb', 550)
     2302  def _reduce_180(val, _values, result)
    20982303     result = CPtrType.new
    20992304    result
     
    21012306.,.,
    21022307
    2103 module_eval(<<'.,.,', 'C_parser.y.rb', 485)
    2104   def _reduce_144(val, _values, result)
     2308module_eval(<<'.,.,', 'C_parser.y.rb', 553)
     2309  def _reduce_181(val, _values, result)
    21052310                        result = CPtrType.new
    21062311                        result.set_qualifier( val[1] )
     
    21102315.,.,
    21112316
    2112 module_eval(<<'.,.,', 'C_parser.y.rb', 490)
    2113   def _reduce_145(val, _values, result)
     2317module_eval(<<'.,.,', 'C_parser.y.rb', 558)
     2318  def _reduce_182(val, _values, result)
    21142319                        val[1].set_type(CPtrType.new)
    21152320                        result = val[1]
     
    21192324.,.,
    21202325
    2121 module_eval(<<'.,.,', 'C_parser.y.rb', 495)
    2122   def _reduce_146(val, _values, result)
     2326module_eval(<<'.,.,', 'C_parser.y.rb', 563)
     2327  def _reduce_183(val, _values, result)
    21232328                        ptrtype = CPtrType.new
    21242329                        ptrtype.set_qualifier( val[1] )
     
    21302335.,.,
    21312336
    2132 # reduce 147 omitted
    2133 
    2134 # reduce 148 omitted
    2135 
    2136 # reduce 149 omitted
    2137 
    2138 # reduce 150 omitted
    2139 
    2140 # reduce 151 omitted
    2141 
    2142 # reduce 152 omitted
    2143 
    2144 # reduce 153 omitted
    2145 
    2146 # reduce 154 omitted
    2147 
    2148 # reduce 155 omitted
    2149 
    2150 # reduce 156 omitted
    2151 
    2152 # reduce 157 omitted
    2153 
    2154 # reduce 158 omitted
    2155 
    2156 # reduce 159 omitted
    2157 
    2158 # reduce 160 omitted
    2159 
    2160 # reduce 161 omitted
    2161 
    2162 # reduce 162 omitted
    2163 
    2164 # reduce 163 omitted
    2165 
    2166 module_eval(<<'.,.,', 'C_parser.y.rb', 559)
    2167   def _reduce_164(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
     2379module_eval(<<'.,.,', 'C_parser.y.rb', 630)
     2380  def _reduce_205(val, _values, result)
    21682381                        Generator.warning( "W6003 need 'void' for no parameter"  )
    21692382               
     
    21722385.,.,
    21732386
    2174 # reduce 165 omitted
    2175 
    2176 module_eval(<<'.,.,', 'C_parser.y.rb', 564)
    2177   def _reduce_166(val, _values, result)
     2387# reduce 206 omitted
     2388
     2389module_eval(<<'.,.,', 'C_parser.y.rb', 635)
     2390  def _reduce_207(val, _values, result)
    21782391                        Generator.warning( "W6004 need 'void' for no parameter"  )
    21792392               
     
    21822395.,.,
    21832396
    2184 # reduce 167 omitted
    2185 
    2186 module_eval(<<'.,.,', 'C_parser.y.rb', 571)
    2187   def _reduce_168(val, _values, result)
     2397# reduce 208 omitted
     2398
     2399module_eval(<<'.,.,', 'C_parser.y.rb', 642)
     2400  def _reduce_209(val, _values, result)
    21882401     result = val[0]
    21892402    result
     
    21912404.,.,
    21922405
    2193 module_eval(<<'.,.,', 'C_parser.y.rb', 573)
    2194   def _reduce_169(val, _values, result)
     2406module_eval(<<'.,.,', 'C_parser.y.rb', 644)
     2407  def _reduce_210(val, _values, result)
    21952408     result = val[1]
    21962409    result
     
    21982411.,.,
    21992412
    2200 module_eval(<<'.,.,', 'C_parser.y.rb', 575)
    2201   def _reduce_170(val, _values, result)
     2413module_eval(<<'.,.,', 'C_parser.y.rb', 646)
     2414  def _reduce_211(val, _values, result)
    22022415     result = val[1]
    22032416    result
     
    22052418.,.,
    22062419
    2207 module_eval(<<'.,.,', 'C_parser.y.rb', 577)
    2208   def _reduce_171(val, _values, result)
     2420module_eval(<<'.,.,', 'C_parser.y.rb', 648)
     2421  def _reduce_212(val, _values, result)
    22092422     result = C_EXP.new( val[2] )
    22102423    result
     
    22122425.,.,
    22132426
    2214 module_eval(<<'.,.,', 'C_parser.y.rb', 582)
    2215   def _reduce_172(val, _values, result)
     2427module_eval(<<'.,.,', 'C_parser.y.rb', 653)
     2428  def _reduce_213(val, _values, result)
    22162429                        result = [ val[0] ]
    22172430               
     
    22202433.,.,
    22212434
    2222 module_eval(<<'.,.,', 'C_parser.y.rb', 586)
    2223   def _reduce_173(val, _values, result)
     2435module_eval(<<'.,.,', 'C_parser.y.rb', 657)
     2436  def _reduce_214(val, _values, result)
    22242437                        val[0] << val[2]
    22252438                        result = val[0]
     
    22292442.,.,
    22302443
    2231 # reduce 174 omitted
    2232 
    2233 # reduce 175 omitted
    2234 
    2235 # reduce 176 omitted
    2236 
    2237 # reduce 177 omitted
    2238 
    2239 # reduce 178 omitted
    2240 
    2241 # reduce 179 omitted
    2242 
    2243 # reduce 180 omitted
    2244 
    2245 # reduce 181 omitted
    2246 
    2247 # reduce 182 omitted
    2248 
    2249 # reduce 183 omitted
    2250 
    2251 # reduce 184 omitted
    2252 
    2253 module_eval(<<'.,.,', 'C_parser.y.rb', 614)
    2254   def _reduce_185(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
     2466module_eval(<<'.,.,', 'C_parser.y.rb', 685)
     2467  def _reduce_226(val, _values, result)
    22552468                        val[2].each{ |i|
    22562469                           i.set_kind( :TYPEDEF )
     
    22632476.,.,
    22642477
    2265 module_eval(<<'.,.,', 'C_parser.y.rb', 623)
    2266   def _reduce_186(val, _values, result)
     2478module_eval(<<'.,.,', 'C_parser.y.rb', 694)
     2479  def _reduce_227(val, _values, result)
    22672480     result = [ val[0] ]
    22682481    result
     
    22702483.,.,
    22712484
    2272 module_eval(<<'.,.,', 'C_parser.y.rb', 625)
    2273   def _reduce_187(val, _values, result)
     2485module_eval(<<'.,.,', 'C_parser.y.rb', 696)
     2486  def _reduce_228(val, _values, result)
    22742487     result << val[2]
    22752488    result
     
    22772490.,.,
    22782491
    2279 # reduce 188 omitted
    2280 
    2281 # reduce 189 omitted
    2282 
    2283 # reduce 190 omitted
    2284 
    2285 # reduce 191 omitted
    2286 
    2287 # reduce 192 omitted
    2288 
    2289 # reduce 193 omitted
    2290 
    2291 # reduce 194 omitted
    2292 
    2293 # reduce 195 omitted
    2294 
    2295 # reduce 196 omitted
    2296 
    2297 # reduce 197 omitted
    2298 
    2299 # reduce 198 omitted
    2300 
    2301 # reduce 199 omitted
    2302 
    2303 # reduce 200 omitted
    2304 
    2305 # reduce 201 omitted
    2306 
    2307 # reduce 202 omitted
    2308 
    2309 # reduce 203 omitted
    2310 
    2311 # reduce 204 omitted
    2312 
    2313 # reduce 205 omitted
    2314 
    2315 # reduce 206 omitted
    2316 
    2317 # reduce 207 omitted
    2318 
    2319 # reduce 208 omitted
    2320 
    2321 # reduce 209 omitted
    2322 
    2323 # reduce 210 omitted
    2324 
    2325 # reduce 211 omitted
    2326 
    2327 # reduce 212 omitted
    2328 
    2329 # reduce 213 omitted
    2330 
    2331 # reduce 214 omitted
    2332 
    2333 # reduce 215 omitted
    2334 
    2335 # reduce 216 omitted
    2336 
    2337 # reduce 217 omitted
    2338 
    2339 # reduce 218 omitted
    2340 
    2341 # reduce 219 omitted
    2342 
    2343 # reduce 220 omitted
    2344 
    2345 # reduce 221 omitted
    2346 
    2347 # reduce 222 omitted
    2348 
    2349 # reduce 223 omitted
    2350 
    2351 # reduce 224 omitted
    2352 
    2353 # reduce 225 omitted
    2354 
    2355 # reduce 226 omitted
    2356 
    2357 # reduce 227 omitted
    2358 
    2359 # reduce 228 omitted
    2360 
    23612492# reduce 229 omitted
    23622493
     
    23772508# reduce 237 omitted
    23782509
    2379 module_eval(<<'.,.,', 'C_parser.y.rb', 706)
    2380   def _reduce_238(val, _values, result)
     2510# reduce 238 omitted
     2511
     2512# reduce 239 omitted
     2513
     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
     2564module_eval(<<'.,.,', 'C_parser.y.rb', 761)
     2565  def _reduce_265(val, _values, result)
    23812566     result = NamespacePath.new( val[0].val, false )
    23822567    result
     
    23842569.,.,
    23852570
    2386 module_eval(<<'.,.,', 'C_parser.y.rb', 707)
    2387   def _reduce_239(val, _values, result)
     2571module_eval(<<'.,.,', 'C_parser.y.rb', 762)
     2572  def _reduce_266(val, _values, result)
    23882573     result = NamespacePath.new( val[1].val, true )
    23892574    result
     
    23912576.,.,
    23922577
    2393 module_eval(<<'.,.,', 'C_parser.y.rb', 709)
    2394   def _reduce_240(val, _values, result)
     2578module_eval(<<'.,.,', 'C_parser.y.rb', 764)
     2579  def _reduce_267(val, _values, result)
    23952580     result = val[0].append!( val[2].val )
     2581    result
     2582  end
     2583.,.,
     2584
     2585module_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               
    23962598    result
    23972599  end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/C_parser.y.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    8 #   上記著作権者は,以下の(1)(4)の条件を満たす場合に限り,本ソフトウェ
     8#   上記著作権者は,以下の(1)(4)の条件を満たす場合に限り,本ソフトウェ
    99#   ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
    1010#   変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
     
    3535#   の責任を負わない.
    3636
    37 #   $Id$
     37#   $Id: C_parser.y.rb 2810 2018-03-11 13:20:03Z okuma-top $
    3838#++
    3939
     
    4848# argument_expression_list(関数引数), assignment_expression(代入)がない
    4949# 式の result は、すべて配列で第一要素が識別シンボル、第二要素以下が引数
     50#
     51# 2019/3/28 長島 下記のC99の構文に近づくよう変更
     52#(読めないヘッダーファイルがあったため)
     53# http://www.quut.com/c/ANSI-C-grammar-y-1999.html
     54# 元々のコメントと合わなくなっています
    5055
    5156primary_expression
    52         : namespace_identifier
     57                : namespace_identifier
    5358                { result = [ :IDENTIFIER, val[0] ] }     #1ok
    5459#        : IDENTIFIER   # mikan namespace への対応
     
    5863#        | FALSE
    5964#               { result = [ :BOOL_CONSTANT, false ] }
    60         | INTEGER_CONSTANT
     65                | INTEGER_CONSTANT
    6166                { result = [ :INTEGER_CONSTANT, val[0] ] }
    62         | FLOATING_CONSTANT
     67                | FLOATING_CONSTANT
    6368                { result = [ :FLOATING_CONSTANT, val[0] ] }
    64         | OCTAL_CONSTANT
     69                | OCTAL_CONSTANT
    6570                { result = [ :OCTAL_CONSTANT, val[0] ] }
    66         | HEX_CONSTANT
     71                | HEX_CONSTANT
    6772                { result = [ :HEX_CONSTANT, val[0] ] }
    68         | CHARACTER_LITERAL
     73                | CHARACTER_LITERAL
    6974                { result = [ :CHARACTER_LITERAL, val[0] ] }
    70         | string_literal_list
     75                | string_literal_list
    7176                { result = [ :STRING_LITERAL_LIST, val[0] ] }
    72         | '(' expression ')'
     77                | '(' expression ')'
    7378                { result = [ :PARENTHESES, val[1].get_elements ] }
    7479
    7580string_literal_list
    76         : STRING_LITERAL
     81                : STRING_LITERAL
    7782                { result = [val[0]] }
    78         | string_literal_list STRING_LITERAL
     83                | string_literal_list STRING_LITERAL
    7984                { result << val[1] }
    8085
    8186# 関数呼び出しと後置インクリメント、デクリメント演算子がない
    8287postfix_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 ']'
    8790                { 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
    8995                { result = [ :OP_DOT, val[0], val[2] ] }
    90         | postfix_expression '->' IDENTIFIER
     96                | postfix_expression '->' IDENTIFIER
    9197                { 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
     103argument_expression_list
     104                : assignment_expression
     105                | argument_expression_list ',' assignment_expression
    99106
    100107
    101108# 前置インクリメント、デクリメント演算子がない
    102109unary_expression
    103         : postfix_expression
    104         | unary_operator cast_expression
     110                : postfix_expression
     111                | unary_operator cast_expression
    105112                { result = [ val[0], val[1] ] }
    106         | SIZEOF unary_expression
     113                | SIZEOF unary_expression
    107114                { result = [ :OP_SIZEOF_EXPR, val[1] ] }
    108         | SIZEOF '(' type_name ')'
     115                | SIZEOF '(' type_name ')'
    109116                { result = [ :OP_SIZEOF_TYPE, val[1] ] }
    110117                | '++' unary_expression                 { result = val[1] }   # ++, -- は無視する
     
    112119
    113120unary_operator
    114         : '&'   { result = :OP_U_AMP }
    115         | '*'   { result = :OP_U_ASTER }
    116         | '+'   { result = :OP_U_PLUS }
    117         | '-'   { result = :OP_U_MINUS }
    118         | '~'   { result = :OP_U_TILDE }
    119         | '!'   { result = :OP_U_EXCLAM }
     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 }
    120127
    121128cast_expression
    122         : unary_expression
    123         | '(' type_name ')' cast_expression
     129                : unary_expression
     130                | '(' type_name ')' cast_expression
    124131                {  result = [ :CAST, val[1], val[3] ] }
    125132
    126133multiplicative_expression
    127         : cast_expression
    128         | multiplicative_expression '*' cast_expression
     134                : cast_expression
     135                | multiplicative_expression '*' cast_expression
    129136                { result = [ :OP_MULT, val[0], val[2] ]  }
    130         | multiplicative_expression '/' cast_expression
     137                | multiplicative_expression '/' cast_expression
    131138                { result = [ :OP_DIV, val[0], val[2] ]  }
    132         | multiplicative_expression '%' cast_expression
     139                | multiplicative_expression '%' cast_expression
    133140                { result = [ :OP_REMAIN, val[0], val[2] ]  }
    134141
    135142additive_expression
    136         : multiplicative_expression
    137         | additive_expression '+' multiplicative_expression
     143                : multiplicative_expression
     144                | additive_expression '+' multiplicative_expression
    138145                { result = [ :OP_ADD, val[0], val[2] ]  }
    139         | additive_expression '-' multiplicative_expression
     146                | additive_expression '-' multiplicative_expression
    140147                { result = [ :OP_SUB, val[0], val[2] ]  }
    141148
    142149shift_expression
    143         : additive_expression
    144         | shift_expression '<<' additive_expression
     150                : additive_expression
     151                | shift_expression '<<' additive_expression
    145152                { result = [ :OP_LSFT, val[0], val[2] ]  }
    146         | shift_expression '>>' additive_expression
     153                | shift_expression '>>' additive_expression
    147154                { result = [ :OP_RSFT, val[0], val[2] ]  }
    148155
    149156relational_expression
    150         : shift_expression
    151         | relational_expression '<' shift_expression
     157                : shift_expression
     158                | relational_expression '<' shift_expression
    152159                { result = [ :OP_LT, val[0], val[2] ]  }
    153         | relational_expression '>' shift_expression
     160                | relational_expression '>' shift_expression
    154161                { result = [ :OP_GT, val[0], val[2] ]  }
    155         | relational_expression '<=' shift_expression
     162                | relational_expression '<=' shift_expression
    156163                { result = [ :OP_LE, val[0], val[2] ]  }
    157         | relational_expression '>=' shift_expression
     164                | relational_expression '>=' shift_expression
    158165                { result = [ :OP_GE, val[0], val[2] ]  }
    159166
    160167equality_expression
    161         : relational_expression
    162         | equality_expression '==' relational_expression
     168                : relational_expression
     169                | equality_expression '==' relational_expression
    163170                { result = [ :OP_EQ, val[0], val[2] ]  }
    164         | equality_expression '!=' relational_expression
     171                | equality_expression '!=' relational_expression
    165172                { result = [ :OP_NE, val[0], val[2] ]  }
    166173
    167174and_expression
    168         : equality_expression
    169         | and_expression '&' equality_expression
     175                : equality_expression
     176                | and_expression '&' equality_expression
    170177                { result = [ :OP_AND, val[0], val[2] ]  }
    171178
    172179exclusive_or_expression
    173         : and_expression
    174         | exclusive_or_expression '^' and_expression
     180                : and_expression
     181                | exclusive_or_expression '^' and_expression
    175182                { result = [ :OP_EOR, val[0], val[2] ]  }
    176183
    177184inclusive_or_expression
    178         : exclusive_or_expression
    179         | inclusive_or_expression '|' exclusive_or_expression
     185                : exclusive_or_expression
     186                | inclusive_or_expression '|' exclusive_or_expression
    180187                { result = [ :OP_OR, val[0], val[2] ]  }
    181188
    182189logical_and_expression
    183         : inclusive_or_expression
    184         | logical_and_expression '&&' inclusive_or_expression
     190                : inclusive_or_expression
     191                | logical_and_expression '&&' inclusive_or_expression
    185192                { result = [ :OP_LAND, val[0], val[2] ]  }
    186193
    187194logical_or_expression
    188         : logical_and_expression
    189         | logical_or_expression '||' logical_and_expression
     195                : logical_and_expression
     196                | logical_or_expression '||' logical_and_expression
    190197                { result = [ :OP_LOR, val[0], val[2] ]  }
    191198
    192199conditional_expression
    193         : logical_or_expression
    194         | logical_or_expression '?' expression ':' conditional_expression
     200                : logical_or_expression
     201                | logical_or_expression '?' expression ':' conditional_expression
    195202                { result = [ :OP_CEX, val[0], val[2].get_elements, val[4] ]  }
    196203
    197 
    198 # コンマ演算子が使えない
     204assignment_expression
     205                : conditional_expression
     206                | unary_expression assignment_operator assignment_expression
     207
     208assignment_operator
     209                : '='
     210                | '+='
     211                | '-='
     212                | '*='
     213                | '/='
     214                | '%='
     215                | '<<='
     216                | '>>='
     217                | '&='
     218                | '|='
     219                | '^='
     220
    199221expression
    200         : conditional_expression
     222                : assignment_expression
    201223                {
    202224                        result = Expression.new( val[0] )
    203225                        # result.print
    204226                }
     227                | expression ',' assignment_expression
     228                {
     229                        result = Expression.new( val[2] )    # ',' の後ろを採用
     230                }
    205231
    206232constant_expression
    207         : conditional_expression
     233                : conditional_expression
    208234                {
    209235                        result = Expression.new( val[0] )
     
    218244                }
    219245
    220 
    221 
    222246# Types
    223247##########################  宣言  ##########################
     
    227251# K&Rとの違い: storage classが指定できない、型が省略できない
    228252declaration
    229         : declaration_specifiers init_declarator_list ';'
    230 #        : type_specifier_qualifier_list init_declarator_list ';'
     253                : declaration_specifiers init_declarator_list ';'
     254#        : specifier_qualifier_list init_declarator_list ';'
    231255
    232256# declaration_specifiersは関数のパラメータで使われるが、
    233 # type_specifier_qualifier_listで十分かもしれない
     257# specifier_qualifier_listで十分かもしれない
    234258
    235259declaration_specifiers
    236         : storage_class
     260                : storage_class_specifier
    237261                {
    238262                        result = CIntType.new( -3 )    # storage class は無視
    239263                }
    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
    242274                {
    243275                        result = CIntType.new( -3 )
    244276                        result.set_qualifier val[0]
    245277                }
    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
    255279                {
    256280                        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
    260285
    261286init_declarator_list
    262         : init_declarator
     287                : init_declarator
    263288                { result = [val[0]] }
    264         | init_declarator_list ',' init_declarator
     289                | init_declarator_list ',' init_declarator
    265290                { result << val[2] }
    266291
    267292init_declarator
    268         : declarator
    269         | declarator '=' initializer
     293                : declarator
     294                | declarator '=' initializer
    270295                { val[0].set_initializer( val[2] ) }
    271296
     297storage_class_specifier
     298                : EXTERN
     299                | STATIC
     300                | AUTO
     301                | REGISTER
     302
    272303type_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
    287319                {
    288320                        set_no_type_name true
     
    290322                        result.set_sign :SIGNED
    291323                }
    292         | UNSIGNED
     324                | UNSIGNED
    293325                {
    294326                        set_no_type_name true
     
    296328                        result.set_sign :UNSIGNED
    297329                }
     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 ) }
    298340
    299341# mikan K&Rのstruct_or_union_specifierに相当するが、unionは使えない, bit field にも対応しない
    300342struct_specifier                # mikan
    301         : STRUCT struct_tag '{'
     343#        : STRUCT struct_tag '{'
     344                : struct_term struct_tag '{'
    302345                { StructType.set_define( true )  }
    303            struct_declaration_list '}'
     346                struct_declaration_list '}'
    304347                {
    305348                        StructType.end_of_parse
    306349                        result = val[1]
    307350                }
    308         | STRUCT
     351#        | STRUCT
     352                | struct_term
    309353                {
    310354                        result = CStructType.new()
    311355                        StructType.set_define( true )
    312356                }
    313            '{' struct_declaration_list '}'
     357                '{' struct_declaration_list '}'
    314358                {
    315359                        StructType.end_of_parse
    316360                        result = val[1]
    317361                }
    318         | STRUCT struct_tag   # mikan struct_tag は namespace 対応が必要
     362#        | STRUCT struct_tag   # mikan struct_tag は namespace 対応が必要
     363                | struct_term struct_tag   # mikan struct_tag は namespace 対応が必要
    319364                {
    320365                        StructType.set_define( false )
     
    323368                }
    324369
     370struct_term
     371                : STRUCT { set_no_type_name true }
     372
    325373struct_declaration_list
    326         : struct_declaration
    327         | struct_declaration_list struct_declaration
     374                : struct_declaration
     375                | struct_declaration_list struct_declaration
    328376
    329377struct_tag:
    330         IDENTIFIER
     378                IDENTIFIER
    331379                {
    332380                        result = CStructType.new( val[0].val )
     
    336384# ポインタ修飾子を追加
    337385struct_declaration
    338         : declaration_specifiers struct_declarator_list ';'
    339 #        :                                type_specifier_qualifier_list struct_declarator_list ';'
     386                : declaration_specifiers struct_declarator_list ';'
     387#        :                                specifier_qualifier_list struct_declarator_list ';'
    340388                {
    341389                        val[1].each { |i|       # i: Decl
     
    347395                        result = val[1]
    348396                }
    349         | union_specifier ';'                       # 無名
    350         | 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 ';'                       # 無名
    351410
    352411
     
    354413# K&Rのspecifier_qualifier_listと同じ
    355414# 名前がまぎらわしかったのでtype_を付けた
    356 type_specifier_qualifier_list
    357         : type_specifier
    358         | type_specifier type_specifier_qualifier_list
     415specifier_qualifier_list
     416                : type_specifier specifier_qualifier_list
    359417                {
    360418                        result = val[1].merge val[0]
    361419                }
    362         | 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
    363427                {
    364428                        result = CIntType.new( -3 )
    365429                        result.set_qualifier val[0]
    366430                }
    367         | type_qualifier type_specifier_qualifier_list
    368                 {
    369                         val[1].set_qualifier val[0]
    370                         result = val[1]
    371                 }
    372431
    373432struct_declarator_list
    374         : struct_declarator
     433                : struct_declarator
    375434                { result = [ val[0] ] }
    376         | struct_declarator_list ',' struct_declarator
     435                | struct_declarator_list ',' struct_declarator
    377436                { result << val[2] }
    378437
    379438# ビットフィールドは使えない
    380439struct_declarator
    381         : declarator
    382 
    383 
     440                : declarator
     441#               | ':' constant_expression
     442#               | declarator ':' constant_expression
    384443
    385444union_specifier
    386         : UNION union_tag '{' union_declaration_list '}'
    387         | UNION '{' union_declaration_list '}'
    388         | UNION union_tag   # mikan struct_tag は namespace 対応が必要
     445#        : UNION union_tag '{' union_declaration_list '}'
     446#        | UNION '{' union_declaration_list '}'
     447#        | UNION union_tag   # mikan struct_tag は namespace 対応が必要
     448                : union_term union_tag '{' union_declaration_list '}'
     449                | union_term '{' union_declaration_list '}'
     450                | union_term union_tag   # mikan struct_tag は namespace 対応が必要
     451
     452union_term
     453                : UNION { set_no_type_name true }
    389454
    390455union_declaration_list
    391         : union_declaration
    392         | union_declaration_list union_declaration
     456                : union_declaration
     457                | union_declaration_list union_declaration
    393458
    394459union_tag:
     
    396461
    397462union_declaration
    398         : declaration_specifiers union_declarator_list ';'
     463                : declaration_specifiers union_declarator_list ';'
    399464                | union_specifier ';'                       # 無名
    400465                | struct_specifier ';'                      # 無名
    401466
    402467union_declarator_list
    403         : union_declarator
    404         | union_declarator_list ',' union_declarator
    405 
    406 # ビットフィールドは使えない
     468                : union_declarator
     469                | union_declarator_list ',' union_declarator
     470
    407471union_declarator
    408         : declarator
    409 
    410 
    411 
    412 # enumの種類を追加
    413 enum_specifier          # mikan
    414         : enum_type            '{' enumerator_list '}'
    415         | enum_type IDENTIFIER '{' enumerator_list '}'
    416         | enum_type IDENTIFIER
    417 
    418 enum_type
    419         : ENUM  { result = CEnumType.new( -1 ) }
    420 #        | ENUM8        { result = CEnumType.new( 8 ) }
    421 #        | ENUM16       { result = CEnumType.new( 16 ) }
    422 #        | ENUM32       { result = CEnumType.new( 32 ) }
    423 #        | ENUM64       { result = CEnumType.new( 64 ) }
    424 #        | ENUM128      { result = CEnumType.new( 128 ) }
     472                : declarator
     473                | ':' constant_expression
     474                | declarator ':' constant_expression
     475
     476enum_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
    425485
    426486enumerator_list
    427         : enumerator
    428         | enumerator_list ',' enumerator
     487                : enumerator
     488                | enumerator_list ',' enumerator
    429489
    430490enumerator
    431         : IDENTIFIER
    432         | IDENTIFIER '=' constant_expression
     491                : IDENTIFIER
     492                | IDENTIFIER '=' constant_expression
    433493
    434494type_qualifier
    435         : CONST { result = :CONST }
    436         | VOLATILE      { result = :VOLATILE }
     495                : CONST
     496                { result = :CONST }
     497                | RESTRICT
     498                | VOLATILE
     499                { result = :VOLATILE }
     500
     501function_specifier
     502                : __INLINE__
     503                | INLINE
     504                | __INLINE
     505                | CINLINE
    437506
    438507declarator
    439         : pointer direct_declarator
     508                : pointer direct_declarator
    440509                {
    441510                        val[1].set_type( val[0] )
    442511                        result = val[1]
    443512                }
    444         | direct_declarator
    445         | pointer TYPE_NAME     # 関数ポインタの typedef が二重定義の場合
     513                | direct_declarator
     514                | pointer TYPE_NAME     # 関数ポインタの typedef が二重定義の場合
    446515                {
    447516                        result = Decl.new( val[1].val )
     
    450519
    451520direct_declarator               # mikan
    452         : IDENTIFIER
     521                : IDENTIFIER
    453522                { result = Decl.new( val[0].val ) }
    454         | '(' declarator ')'
     523                | '(' declarator ')'
    455524                { result = val[1] }
    456         | direct_declarator '[' constant_expression ']'
     525                | direct_declarator '[' constant_expression ']'
    457526                {
    458527                        val[0].set_type( CArrayType.new( val[2] ) )
    459528                        result = val[0]
    460529                }
    461         | direct_declarator '[' ']'
     530                | direct_declarator '[' ']'
    462531                {
    463532                        val[0].set_type( CArrayType.new )
    464533                        result = val[0]
    465534                }
    466         | direct_declarator '(' parameter_type_list ')'
     535                | direct_declarator '(' parameter_type_list ')'
    467536                {
    468537                #       Generator.warning( "W6001 need 'void' for no parameter"  )
     
    470539                        result = val[0]
    471540                }
    472 
    473 #        | direct_declarator '(' identifier_list ')'  # これは何のために必要? 060211
    474         | direct_declarator '(' ')'
     541                | direct_declarator '(' identifier_list ')'  # これは何のために必要? 060211
     542                | direct_declarator '(' ')'
    475543                {
    476544                #       Generator.warning( "W6002 need 'void' for no parameter"  )
     
    480548
    481549pointer
    482         : '*'
     550                : '*'
    483551                { result = CPtrType.new }
    484         | '*' type_qualifier
     552                | '*' type_qualifier_list
    485553                {
    486554                        result = CPtrType.new
    487555                        result.set_qualifier( val[1] )
    488556                }
    489         | '*' pointer
     557                | '*' pointer
    490558                {
    491559                        val[1].set_type(CPtrType.new)
    492560                        result = val[1]
    493561                }
    494         | '*' type_qualifier pointer
     562                | '*' type_qualifier_list pointer
    495563                {
    496564                        ptrtype = CPtrType.new
     
    500568                }
    501569
     570type_qualifier_list
     571                : type_qualifier
     572                | type_qualifier_list type_qualifier
    502573
    503574parameter_type_list
    504         : parameter_list
    505         | parameter_list ',' '.' '.' '.'
     575                : parameter_list
     576                | parameter_list ',' '.' '.' '.'
    506577                # mikan 可変長パラメータ,  ... の間のスペースが許される(手抜き)
    507578
    508579parameter_list
    509         : parameter_declaration
     580                : parameter_declaration
    510581#               { result = ParamList.new( val[0] ) }
    511         | parameter_list ',' parameter_declaration
     582                | parameter_list ',' parameter_declaration
    512583#               {
    513584#                       val[0].add_param( val[2] )
     
    518589# パラメータ修飾子を追加
    519590parameter_declaration
    520         : declaration_specifiers declarator
     591                : declaration_specifiers declarator
    521592#               {
    522593#                       decl = ParamDecl.new( val[1], val[0], [] )
     
    533604#                       result = nil
    534605#               }
    535         | declaration_specifiers abstract_declarator    # 仮引数なし
    536         | declaration_specifiers                                                # 仮引数なし
    537 
    538 
    539 #identifier_list       # 060211  不用になった
    540 #        : IDENTIFIER
    541 #        | identifier_list ',' IDENTIFIER
     606                | declaration_specifiers abstract_declarator    # 仮引数なし
     607                | declaration_specifiers                                                # 仮引数なし
     608
     609
     610identifier_list       # 060211  不用になった
     611        : IDENTIFIER
     612        | identifier_list ',' IDENTIFIER
    542613
    543614type_name
    544         : type_specifier_qualifier_list
    545         | type_specifier_qualifier_list abstract_declarator
     615                : specifier_qualifier_list
     616                | specifier_qualifier_list abstract_declarator
    546617
    547618abstract_declarator             # mikan
    548         : pointer
    549         | direct_abstract_declarator
    550         | pointer direct_abstract_declarator
     619                : pointer
     620                | direct_abstract_declarator
     621                | pointer direct_abstract_declarator
    551622
    552623direct_abstract_declarator
    553         : '(' abstract_declarator ')'
    554         | '[' ']'
    555         | '[' constant_expression ']'
    556         | direct_abstract_declarator '[' ']'
    557         | direct_abstract_declarator '[' constant_expression ']'
    558         | '(' ')'
     624                : '(' abstract_declarator ')'
     625                | '[' ']'
     626                | '[' assignment_expression ']'
     627                | direct_abstract_declarator '[' ']'
     628                | direct_abstract_declarator '[' assignment_expression ']'
     629                | '(' ')'
    559630                {
    560631                        Generator.warning( "W6003 need 'void' for no parameter"  )
    561632                }
    562         | '(' parameter_type_list ')'
    563         | direct_abstract_declarator '(' ')'
     633                | '(' parameter_type_list ')'
     634                | direct_abstract_declarator '(' ')'
    564635                {
    565636                        Generator.warning( "W6004 need 'void' for no parameter"  )
    566637                }
    567         | direct_abstract_declarator '(' parameter_type_list ')'
     638                | direct_abstract_declarator '(' parameter_type_list ')'
    568639
    569640# assignment_expressionをconstant_expressionに変更
    570641initializer                     # mikan
    571         : constant_expression
     642                : assignment_expression
    572643                { result = val[0] }
    573         | '{' initializer_list '}'
     644                | '{' initializer_list '}'
    574645                { result = val[1] }
    575         | '{' initializer_list ',' '}'
     646                | '{' initializer_list ',' '}'
    576647                { result = val[1] }
    577         | C_EXP '(' STRING_LITERAL ')'
     648                | C_EXP '(' STRING_LITERAL ')'
    578649                { result = C_EXP.new( val[2] ) }
    579650
    580651initializer_list
    581         : initializer
     652                : initializer
    582653                {
    583654                        result = [ val[0] ]
    584655                }
    585         | initializer_list ',' initializer
     656                | initializer_list ',' initializer
    586657                {
    587658                        val[0] << val[2]
     
    594665#トップレベルの構文規則
    595666C_parser
    596         :
    597         | C_parser extension_statement
     667                :
     668                | C_parser extension_statement
    598669
    599670extension_statement
    600         : statement
    601         | EXTENSION statement
    602 
    603 statement
    604         : typedef
    605         | func_def
    606         | enum_specifier ';'
    607         | struct_specifier ';'
    608         | declaration
    609         | ';'
    610         | error   # エラー回復ポイント
     671                : cdl_statement
     672                | EXTENSION cdl_statement
     673
     674cdl_statement
     675                : typedef
     676                | func_def
     677                | enum_specifier ';'
     678                | struct_specifier ';'
     679                | declaration
     680                | ';'
     681                | error   # エラー回復ポイント
    611682
    612683typedef
    613         : TYPEDEF type_specifier_qualifier_list declarator_list ';'
     684        : TYPEDEF specifier_qualifier_list declarator_list ';'
    614685                {
    615686                        val[2].each{ |i|
     
    621692
    622693declarator_list
    623         : declarator
     694                : declarator
    624695                { result = [ val[0] ] }
    625         | declarator_list ',' declarator
     696                | declarator_list ',' declarator
    626697                { result << val[2] }
    627698
    628699func_def
    629         : declaration_specifiers declarator compoundstatement
    630 
    631 infunc_statement_list
    632         :
    633         | infunc_statement_list infunc_statement
    634 
    635 infunc_statement
    636         : declaration
    637         | ifstatement
    638         | whilestatement
    639         | dowhilestatement
    640         | forstatement
    641         | switchstatement
    642         | labelstatement
    643         | compoundstatement
    644         | gotostatement
    645         | expressionstatement
    646         | ';'
     700                : declaration_specifiers declarator compound_statement
     701
     702statement
     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
     714labeled_statement
     715                : IDENTIFIER ':' statement
     716                | CASE constant_expression ':' statement
     717                | DEFAULT ':' statement
     718
     719compound_statement
     720                : '{' '}'
     721                | '{' block_item_list '}'
     722
     723block_item_list
     724                : block_item
     725                | block_item_list block_item
     726
     727block_item
     728                : declaration
     729                | statement
     730
     731expression_statement
     732                : ';'
     733                | expression ';'
    647734
    648735ifstatement
    649         : IF '(' expression ')' infunc_statement
    650         | IF '(' expression ')' infunc_statement ELSE infunc_statement
     736                : IF '(' expression ')' statement
     737                | IF '(' expression ')' statement ELSE statement
     738
     739switchstatement
     740                : SWITCH '(' expression ')' compound_statement
    651741
    652742whilestatement
    653         : WHILE '(' expression ')' infunc_statement
     743                : WHILE '(' expression ')' statement
    654744
    655745dowhilestatement
    656         : DO infunc_statement WHILE '(' expression ')' ';'
     746                : DO statement WHILE '(' expression ')' ';'
    657747
    658748forstatement
    659         : FOR '(' expression ';' expression ';' expression ')' infunc_statement
    660 
    661 switchstatement
    662         : SWITCH '(' expression ')'  infunc_statment
    663 
    664 labelstatement
    665         : IDENTIFIER ':' infunc_statement
    666         | CASE constant_expression ':' infunc_statement
    667         | DEFAULT ':' infunc_statement
    668 
    669 compoundstatement
    670         : '{' infunc_statement_list '}'
    671 
    672 gotostatement
    673         : GOTO IDENTIFIER ';'
    674         | CONTINUE ';'
    675         | BREAK ';'
    676         | RETURN expression ';'
    677         | RETURN ';'
    678 
    679 expressionstatement
    680         : expression ';'
    681         | unary_expression assignment_operator expression ';'
    682 
    683 assignment_operator
    684         : '='
    685         | '+='
    686         | '-='
    687         | '*='
    688         | '/='
    689         | '%='
    690         | '<<='
    691         | '>>='
    692         | '&='
    693         | '|='
    694         | '^='
    695 
    696 storage_class
    697         : __INLINE__
    698         | INLINE
    699         | __INLINE
    700         | CINLINE
    701         | EXTERN
    702         | STATIC
    703         | AUTO
    704         | 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
     754jump_statement
     755                : GOTO IDENTIFIER ';'
     756                | CONTINUE ';'
     757                | BREAK ';'
     758                | RETURN ';'
     759                | RETURN expression ';'
    705760
    706761namespace_identifier
    707         : IDENTIFIER            { result = NamespacePath.new( val[0].val, false ) }
    708         | '::' IDENTIFIER       { result = NamespacePath.new( val[1].val, true ) }
    709         | namespace_identifier '::' IDENTIFIER
     762                : IDENTIFIER            { result = NamespacePath.new( val[0].val, false ) }
     763                | '::' IDENTIFIER       { result = NamespacePath.new( val[1].val, true ) }
     764                | namespace_identifier '::' IDENTIFIER
    710765                { result = val[0].append!( val[2].val ) }
    711766
     767asm_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
    712781end
    713782
    714783---- inner
    715784
    716   RESERVED = {
    717     # keyword
    718     'typedef' => :TYPEDEF,
    719     'struct' => :STRUCT,
    720     'union' => :UNION,
    721     'sizeof' => :SIZEOF,
    722     'throw' => :THROW,
    723 
    724     # specifier
    725     # types
    726     'void'    => :VOID,
    727     'char'    => :CHAR,
    728     'short'   => :SHORT,
    729 
    730     'volatile'=> :VOLATILE,
    731     'const'   => :CONST,
    732     'extern'   => :EXTERN,
    733 
    734     'long'    => :LONG,
    735     'float'   => :FLOAT,
    736     'double'  => :DOUBLE,
    737     'signed'  => :SIGNED,
    738     'unsigned'=> :UNSIGNED,
    739 
    740     'int'     => :INT,
    741     'enum'    => :ENUM,
    742 
    743     'if'      => :IF,
    744     'else'    => :ELSE,
    745     'while'   => :WHILE,
    746     'do'      => :DO,
    747     'for'     => :FOR,
    748     'case'    => :CASE,
    749     'default' => :DEFAULT,
    750     'goto'    => :GOTO,
    751     'continue' => :CONTINUE,
    752     'break'   => :BREAK,
    753     'return'  => :RETURN,
    754     '__inline__'  => :__INLINE__,
    755     'inline'  => :INLINE,
    756     '__inline'  => :__INLINE,
    757     'Inline'  => :CINLINE,        # inline starting with Capital letter
    758     'static'  => :STATIC,
    759     'register' => :REGISTER,
    760     'auto'    => :AUTO,
    761     '__extension__'    => :EXTENSION,
    762 
    763   }
    764 
    765   @@generator_nest = -1
    766   @@generator_stack = []
    767   @@current_locale = []
    768 
    769   def finalize
    770 
    771     # mikan Namespace.pop
    772     Celltype.pop
    773     Cell.pop
    774     CompositeCelltype.pop
    775     Region.pop
    776 
    777   end
    778 
    779   def set_plugin( plugin )
    780     @plugin = plugin
    781   end
    782 
    783   def self.get_plugin
    784     @@generator_stack[@@generator_nest].get_plugin
    785   end
    786 
    787   def get_plugin
    788     @plugin
    789   end
    790 
    791   def parse(files)
    792 
    793     # mikan Namespace.push
    794     Celltype.push
    795     Cell.push
    796     CompositeCelltype.push
    797     Region.push
    798 
    799     @@generator_nest += 1
    800     @@generator_stack[@@generator_nest] = self
    801     @b_no_type_name = false
    802 
    803    begin
    804 
    805     @q = []
    806     comment = false
    807 
    808     # euc のコメントを utf8 として扱うと、コメントの終わりを誤る問題の対策
    809     TECS_LANG::set_kcode_binary
    810 
    811     # 800U, 0xffLL など (整数リテラルに共通の修飾子)
    812     integer_qualifier = "([Uu][Ll][Ll]|[Uu][Ll]|[Uu]|[Ll][Ll]|[Ll])?"
    813 
    814     files.each {|file|
    815       lineno = 1
    816      begin
    817 #2.0       IO.foreach(file) {|line|
    818        TECSIO.foreach(file) {|line|
    819         col = 1
    820         line.rstrip!
    821 
    822         until line.empty?
    823 
    824           if comment
    825             case line
    826             # コメント終了
    827             when /\A\*\//
    828               comment = false
    829             when /\A./
    830               ;
    831             end
    832           else
    833             case line
    834             # 空白、プリプロセスディレクティブ
    835             when /\A\s+/
    836               ;
    837             # 識別子
    838             when /\A[a-zA-Z_]\w*/
    839               word = $&
    840               @q << [RESERVED[word] || :IDENTIFIER, Token.new(word.intern, file, lineno, col)]
    841             # 16 進数定数
    842             when /\A0x[0-9A-Fa-f]+#{integer_qualifier}/
    843               @q << [:HEX_CONSTANT, Token.new($&, file, lineno, col)]
    844             # 8 進数定数
    845             when /\A0[0-7]+#{integer_qualifier}/
    846               @q << [:OCTAL_CONSTANT, Token.new($&, file, lineno, col)]
    847             # 浮動小数定数
    848             when /\A[0-9]+\.([0-9]*)?([Ee][+-]?[0-9]+)?/
    849               @q << [:FLOATING_CONSTANT, Token.new($&, file, lineno, col)]
    850             # 整数定数
    851             when /\A\d+#{integer_qualifier}/
    852             # when /\A\d+/
    853               @q << [:INTEGER_CONSTANT, Token.new($&.to_i, file, lineno, col)]
    854             # 文字
    855             when /\A'(?:[^'\\]|\\.)'/
    856               @q << [:CHARACTER_LITERAL, Token.new($&, file, lineno, col)]
    857             # 文字列
    858 #              "#include  #include #include \"../systask/logtask.cfg\"       最後の " 忘れ)で無限ループ
    859 #            when /\A"(?:[^"\\]+|\\.)*"/
    860             when /\A"(?:[^"\\]|\\.)*"/   # これはうまく行くようだ
    861               @q << [:STRING_LITERAL, Token.new($&, file, lineno, col)]
    862             # 行コメント
    863             when /\A\/\/.*$/
    864               # 読み飛ばすだけ
    865             # コメント開始
    866             when /\A\/\*/
    867               comment = true
    868             when /\A>>=/, /\A<<=/, /\A>>/,  /\A<</
    869               @q << [$&, Token.new($&, file, lineno, col)]
    870             when /\A\+=/, /\A\-=/, /\A\*=/, /\A\/=/, /\A%=/, /\A&=/, /\A\|=/, /\A\^=/
    871               @q << [$&, Token.new($&, file, lineno, col)]
    872             when /\A::/, /\A==/, /\A!=/, /\A>=/, /\A<=/, /\A\->/, /\A\+\+/, /\A\-\-/
    873               @q << [$&, Token.new($&, file, lineno, col)]
    874             when /\A./
    875               @q << [$&, Token.new($&, file, lineno, col)]
    876             else
    877               raise
    878             end
    879           end
    880 
    881           line = $'
    882           col += $&.length
    883         end
    884 
    885         lineno += 1
    886       }
    887 
    888      rescue => evar
    889        Generator.error( "B1002 while open or reading \'$1\'" , file )
    890        print_exception( evar )
    891      end
    892     }
    893 
    894     # 終了の印
    895     @q << nil
    896 
    897     @yydebug = true
    898     do_parse
    899 
    900    ensure
    901     @@generator_nest -= 1
    902     TECS_LANG::reset_kcode
    903    end
    904 
    905   end
    906 
    907 
    908   def next_token
    909     token = @q.shift
    910 
    911     if token then
    912       @@current_locale[@@generator_nest] = token[1].locale
    913 
    914       case token[1].val
    915       when ";", ":", ",", "(", ")", "{", "}"
    916         set_no_type_name false
    917       when ".", "->"
    918         set_no_type_name true
    919       end
    920 
    921       # TYPE_NAME トークンへ置き換え
    922       if @b_no_type_name == false
    923         if token[0] == :IDENTIFIER && Namespace.is_typename?( token[1].val ) then
    924           token[0] = :TYPE_NAME
    925         end
    926       end
    927 
    928       if $debug then     # 070107 token 無効時ここを通さないようした (through 対応 -d の時に例外発生)
    929         locale = @@current_locale[@@generator_nest]
    930         if token then
    931           print( "#{locale[0]}: line #{locale[1]} : #{token[0]} '#{token[1].val}'\n" )
    932         else
    933           print( "#{locale[0]}: line #{locale[1]} : EOF\n" )
    934         end
    935       end
    936     end
    937 
    938     token
    939   end
    940 
    941   def on_error(t, v, vstack)
    942     if v == "$" then
    943      Generator.error( "B1003 Unexpected EOF"  )
    944     else
    945      Generator.error( "B1004 syntax error near \'$1\'" , v.val )
    946     end
    947 
    948   end
    949 
    950   def self.current_locale
    951     @@current_locale[ @@generator_nest ]
    952   end
    953 
    954   @@n_error = 0
    955   @@n_warning = 0
    956 
    957   # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でエラー発生は不適切)
    958   def self.error( msg )
    959     @@n_error += 1
    960     locale = @@current_locale[ @@generator_nest ]
    961 
    962     if locale then
    963       Console.puts "error: #{locale[0]}: line #{locale[1]} #{msg}"
    964     else
    965       Console.puts "error: #{msg}"
    966     end
    967   end
    968 
    969   # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でウォーニング発生は不適切)
    970   def self.warning( msg )
    971     @@n_warning += 1
    972     locale = @@current_locale[ @@generator_nest ]
    973     Console.puts "warning: #{locale[0]}: line #{locale[1]} #{msg}"
    974   end
    975 
    976   def self.get_n_error
    977     @@n_error
    978   end
    979 
    980   def self.get_n_warning
    981     @@n_warning
    982   end
    983 
    984   def self.get_nest
    985     @@generator_nest
    986   end
    987 
    988   def set_no_type_name b_no_type_name
    989     # print "b_no_type_name=#{b_no_type_name}\n"
    990     @b_no_type_name = b_no_type_name
    991   end
     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]
     1002#print( "#{locale[0]}: line #{locale[1]} : #{token[0]} '#{token[1].val}: type_name'\n" )
     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 "#{locale[0]}:#{locale[1]}: error: #{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 "#{locale[0]}:#{locale[1]}: warning: #{msg}"
     1053        end
     1054
     1055        # このメソッドは構文解析、意味解析からのみ呼出し可
     1056        def self.info( msg )
     1057                @@n_info += 1
     1058                locale = @@current_locale[ @@generator_nest ]
     1059                Console.puts "#{locale[0]}:#{locale[1]}: info: #{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 ]
     1076#print "b_no_type_name=#{b_no_type_name} #{locale[0]}: line #{locale[1]}\n"
     1077                @b_no_type_name = b_no_type_name
     1078        end
    9921079
    9931080---- footer
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/bnf.tab.rb

    r321 r429  
    11#
    22# DO NOT MODIFY!!!!
    3 # This file is automatically generated by Racc 1.4.12
     3# This file is automatically generated by Racc 1.4.14
    44# from Racc grammer file "".
    55#
     
    88class Generator < Racc::Parser
    99
    10 module_eval(<<'...end bnf.y.rb/module_eval...', 'bnf.y.rb', 1504)
     10module_eval(<<'...end bnf.y.rb/module_eval...', 'bnf.y.rb', 1534)
    1111
    1212  RESERVED = {
     
    3030    'import_C' => :IMPORT_C,
    3131    'generate' => :GENERATE,
     32    '__tool_info__' => :TOOL_INFO,
    3233
    3334    # types
     
    165166  # すべての構文解析が完了した
    166167  @@b_end_all_parse = false
     168
     169  # tag なし struct
     170  @@no_struct_tag_num = 0
    167171
    168172  def self.parse( file_name, plugin = nil, b_reuse = false )
     
    280284                  string += line
    281285                  # この位置では error メソッドは使えない (token 読出し前)
    282                   puts "error: #{file} line #{lineno}: string literal has newline without escape"
     286                  puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape"
    283287                  @@n_error += 1
    284288                end
     
    321325                  b_in_string = true
    322326                  # この位置では error メソッドは使えない (token 読出し前) # mikan cdl_error ではない
    323                   puts "error: #{file} line #{lineno}: string literal has newline without escape"
     327                  puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape"
    324328                  @@n_error += 1
    325329                # 山括弧で囲まれた文字列
    326                 when /\A<[0-9A-Za-z_\. \/]+>/   # AB: angle bracke
     330                # when /\A<[0-9A-Za-z_\. \/]+>/   # AB: angle bracke
     331                when /\A<(?:[^>\\]|\\.)*>/   # これはうまく行くようだ
    327332                  @q << [:AB_STRING_LITERAL, Token.new($&, file, lineno, col)]
    328333                # 行コメント
     
    420425  @@n_error = 0
    421426  @@n_warning = 0
     427  @@n_info = 0
    422428
    423429  # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でエラー発生は不適切)
     
    453459      end
    454460      if locale then
    455         Console.puts "error: #{locale[0]}: line #{locale[1]} #{msg}"
     461        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: error: #{msg}"
    456462      else
    457463        Console.puts "error: #{msg}"
     
    486492      end
    487493      if locale then
    488         Console.puts "warning: #{locale[0]}: line #{locale[1]} #{msg}"
     494        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: warning: #{msg}"
    489495      else
    490496        Console.puts "warning: #{msg}"
     
    493499  end
    494500
     501  # このメソッドは構文解析、意味解析からのみ呼出し可
     502  def self.info( msg, *arg )
     503    locale = nil
     504    self.info2( locale, msg, *arg )
     505  end
     506
     507  def self.info2( locale, msg, *arg )
     508    @@n_info += 1
     509
     510    msg = TECSMsg.get_info_message( msg )
     511    # $1, $2, ... を arg で置換
     512    count = 1
     513    arg.each{ |a|
     514      str = TECSIO.str_code_convert( msg, a.to_s )
     515      msg.sub!( /\$#{count}/, str )
     516      count += 1
     517    }
     518
     519    # import_C の中でのウォーニング?
     520    if @@import_C then
     521      C_parser.info( msg )
     522    else
     523      if @@b_end_all_parse == false || locale == nil then
     524        locale = @@current_locale[ @@generator_nest ]
     525      end
     526      if locale then
     527        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: info: #{msg}"
     528      else
     529        Console.puts "info: #{msg}"
     530      end
     531    end
     532  end
     533
    495534  def self.get_n_error
    496535    @@n_error
     
    501540  end
    502541
     542  def self.get_n_info
     543    @@n_info
     544  end
     545
    503546  def self.get_nest
    504547    @@generator_nest
     548  end
     549
     550  def self.parsing_C?
     551    @@import_C
    505552  end
    506553
     
    543590
    544591clist = [
    545 '65,566,323,779,733,806,77,346,347,323,77,77,77,160,194,195,196,197,198',
    546 '199,200,202,174,203,664,133,860,133,99,207,208,209,210,211,212,213,663',
    547 '244,831,551,394,512,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25',
    548 '26,27,28,29,30,31,32,33,34,35,38,678,395,459,309,696,42,43,44,45,46',
    549 '47,48,49,858,98,654,827,440,133,133,826,133,133,133,133,133,65,186,186',
    550 '186,186,69,67,68,308,70,71,77,72,323,73,299,300,319,819,133,175,133',
    551 '134,320,134,322,186,74,74,74,75,76,76,76,133,86,186,186,186,186,78,85',
    552 '5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32',
    553 '33,34,35,38,77,420,186,358,359,42,43,44,45,46,47,48,49,186,134,134,134',
    554 '65,134,134,134,134,134,133,133,87,571,77,77,570,323,69,67,68,325,70',
    555 '71,133,72,799,73,530,134,341,134,299,300,319,342,343,397,798,682,320',
    556 '74,322,75,134,76,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26',
    557 '27,28,29,30,31,32,33,34,35,38,444,48,49,352,353,42,43,44,45,46,47,48',
    558 '49,328,329,509,510,65,299,300,301,186,302,303,305,306,683,606,77,134',
    559 '134,69,67,68,856,70,71,272,72,607,73,77,177,134,643,299,300,319,77,77',
    560 '636,203,780,320,74,322,75,684,76,5,6,7,10,13,14,15,16,17,18,19,20,21',
    561 '22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,795,160,610,676,855,42',
    562 '43,44,45,46,47,48,49,160,637,403,470,86,160,471,633,426,781,85,793,470',
    563 '87,87,471,502,705,69,67,68,758,70,71,397,72,396,73,159,625,402,194,195',
    564 '196,197,198,199,200,202,614,203,74,792,75,133,76,207,208,209,210,211',
    565 '212,213,299,300,301,160,302,303,305,306,194,195,196,197,198,199,200',
    566 '202,160,203,624,609,283,133,626,207,208,209,210,211,212,213,867,742',
    567 '809,194,195,196,197,198,199,200,202,335,203,336,159,337,133,229,207',
    568 '208,209,210,211,212,213,194,195,196,197,198,199,200,202,810,203,251',
    569 '160,230,133,409,207,208,209,210,211,212,213,229,649,707,666,400,837',
    570 '79,134,496,277,676,251,571,704,846,570,160,539,845,393,230,848,596,408',
    571 '818,229,748,147,619,630,146,706,648,684,667,401,838,134,761,495,278',
    572 '675,250,705,167,230,620,229,86,847,760,86,817,86,85,177,618,85,87,85',
    573 '341,87,134,87,270,342,343,230,632,177,194,195,196,197,198,199,200,202',
    574 '173,203,614,744,869,133,134,207,208,209,210,211,212,213,194,195,196',
    575 '197,198,199,200,202,147,203,650,146,651,133,172,207,208,209,210,211',
    576 '212,213,194,195,196,197,198,199,200,202,171,203,388,389,390,133,170',
    577 '207,208,209,210,211,212,213,194,195,196,197,198,199,200,202,169,203',
    578 '388,389,390,133,659,207,208,209,210,211,212,213,348,349,350,351,194',
    579 '195,196,197,198,199,200,202,168,203,583,330,660,133,134,207,208,209',
    580 '210,211,212,213,194,195,196,197,198,199,200,202,661,203,344,345,165',
    581 '133,134,207,208,209,210,211,212,213,194,195,196,197,198,199,200,202',
    582 '164,203,282,283,665,133,134,207,208,209,210,211,212,213,194,195,196',
    583 '197,198,199,200,202,668,203,352,353,670,133,134,207,208,209,210,211',
    584 '212,213,348,349,350,351,194,195,196,197,198,199,200,202,431,203,346',
    585 '347,671,133,134,207,208,209,210,211,212,213,672,448,673,376,377,378',
    586 '430,432,433,434,435,431,346,347,134,371,372,373,374,375,379,229,450',
    587 '451,452,449,348,349,350,351,674,430,432,433,434,435,134,341,142,143',
    588 '677,230,342,343,194,195,196,197,198,199,200,202,163,203,346,347,203',
    589 '133,134,207,208,209,210,211,212,213,346,347,344,345,194,195,196,197',
    590 '198,199,200,202,680,203,344,345,162,133,134,207,208,209,210,211,212',
    591 '213,194,195,196,197,198,199,200,202,161,203,398,330,689,133,160,207',
    592 '208,209,210,211,212,213,194,195,196,197,198,199,200,202,691,203,719',
    593 '510,692,133,693,207,208,209,210,211,212,213,194,195,196,197,198,199',
    594 '200,202,160,203,376,377,378,133,134,207,208,209,210,211,212,213,371',
    595 '372,373,374,375,379,102,103,104,105,106,107,108,109,110,111,112,695',
    596 '134,697,698,699,700,703,708,229,20,21,22,23,24,25,26,27,28,29,30,31',
    597 '32,33,134,711,562,74,714,230,715,716,194,195,196,197,198,199,200,202',
    598 '717,203,157,744,720,133,134,207,208,209,210,211,212,213,194,195,196',
    599 '197,198,199,200,202,721,203,722,599,724,133,134,207,208,209,210,211',
    600 '212,213,194,195,196,197,198,199,200,202,725,203,726,728,614,133,731',
    601 '207,208,209,210,211,212,213,194,195,196,197,198,199,200,202,732,203',
    602 '156,153,736,133,152,207,208,209,210,211,212,213,739,743,751,752,194',
    603 '195,196,197,198,199,200,202,144,203,754,576,755,133,134,207,208,209',
    604 '210,211,212,213,194,195,196,197,198,199,200,202,757,203,759,762,763',
    605 '133,134,207,208,209,210,211,212,213,194,195,196,197,198,199,200,202',
    606 '764,203,767,768,769,133,134,207,208,209,210,211,212,213,194,195,196',
    607 '197,198,199,200,202,770,203,643,232,703,133,134,207,208,209,210,211',
    608 '212,213,86,86,86,229,177,775,85,85,85,86,87,87,87,776,86,85,777,778',
    609 '134,87,85,141,711,230,87,786,194,195,196,197,198,199,200,202,140,203',
    610 '788,138,132,133,134,207,208,209,210,211,212,213,194,195,196,197,198',
    611 '199,200,202,791,203,130,796,128,133,134,207,208,209,210,211,212,213',
    612 '194,195,196,197,198,199,200,202,800,203,801,-383,802,133,134,207,208',
    613 '209,210,211,212,213,194,195,196,197,198,199,200,202,803,203,804,124',
    614 '123,133,807,207,208,209,210,211,212,213,767,203,813,816,194,195,196',
    615 '197,198,199,200,202,821,203,822,94,824,133,134,207,208,209,210,211,212',
    616 '213,194,195,196,197,198,199,200,202,828,203,829,830,90,133,134,207,208',
    617 '209,210,211,212,213,194,195,196,197,198,199,200,202,833,203,834,89,836',
    618 '133,134,207,208,209,210,211,212,213,194,195,196,197,198,199,200,202',
    619 '798,203,839,840,323,133,134,207,208,209,210,211,212,213,842,843,844',
    620 '849,194,195,196,197,198,199,200,202,850,203,851,88,857,133,134,207,208',
    621 '209,210,211,212,213,194,195,196,197,198,199,200,202,357,203,356,362',
    622 '363,133,134,207,208,209,210,211,212,213,194,195,196,197,198,199,200',
    623 '202,365,203,366,122,861,133,134,207,208,209,210,211,212,213,194,195',
    624 '196,197,198,199,200,202,3,203,156,355,399,133,134,207,208,209,210,211',
    625 '212,213,404,140,406,407,194,195,196,197,198,199,200,202,410,203,411',
    626 '412,413,133,134,207,208,209,210,211,212,213,194,195,196,197,198,199',
    627 '200,202,414,203,415,354,862,133,134,207,208,209,210,211,212,213,194',
    628 '195,196,197,198,199,200,202,438,203,439,442,453,133,134,207,208,209',
    629 '210,211,212,213,194,195,196,197,198,199,200,202,330,203,456,457,186',
    630 '133,134,207,208,209,210,211,212,213,464,465,466,473,194,195,196,197',
    631 '198,199,200,202,474,203,307,285,284,133,134,207,208,209,210,211,212',
    632 '213,194,195,196,197,198,199,200,202,281,203,280,279,276,133,134,207',
    633 '208,209,210,211,212,213,194,195,196,197,198,199,200,202,275,203,274',
    634 '267,177,133,134,207,208,209,210,211,212,213,194,195,196,197,198,199',
    635 '200,202,265,203,203,259,203,133,134,207,208,209,210,211,212,213,156',
    636 '503,504,505,194,195,196,197,198,199,200,202,506,203,507,863,513,133',
    637 '134,207,208,209,210,211,212,213,194,195,196,197,198,199,200,202,514',
    638 '203,515,259,517,133,134,207,208,209,210,211,212,213,86,86,86,86,252',
    639 '265,85,85,85,85,87,87,87,87,134,299,300,301,520,302,303,305,306,521',
    640 '194,195,196,197,198,199,200,202,203,203,524,203,134,133,203,207,208',
    641 '209,210,211,212,213,177,528,194,195,196,197,198,199,200,202,529,203',
    642 '532,533,534,133,134,207,208,209,210,211,212,213,115,116,117,118,119',
    643 '120,121,115,116,117,118,119,120,121,134,536,537,540,186,5,6,7,10,13',
    644 '14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38',
    645 '265,865,550,554,160,42,43,44,45,46,47,48,49,134,194,195,196,197,198',
    646 '199,200,202,556,203,866,186,560,133,562,207,208,209,210,211,212,213',
    647 '323,134,565,87,242,190,578,579,354,355,356,357,580,189,188,186,185,184',
    648 '183,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31',
    649 '32,33,34,35,38,182,181,596,597,599,42,43,44,45,46,47,48,49,194,195,196',
    650 '197,198,199,200,202,600,203,330,601,603,133,604,207,208,209,210,211',
    651 '212,213,605,,134,194,195,196,197,198,199,200,339,,203,,,,133,,207,208',
    652 '209,210,211,212,213,194,195,196,197,198,199,200,202,,203,,685,,133,',
    653 '207,208,209,210,211,212,213,194,195,196,197,198,199,200,202,,203,,,',
    654 '133,,207,208,209,210,211,212,213,,194,195,196,197,198,199,200,202,,203',
    655 ',576,,133,134,207,208,209,210,211,212,213,,,,194,195,196,197,198,199',
    656 '200,202,,203,,655,,133,134,207,208,209,210,211,212,213,194,195,196,197',
    657 '198,199,200,202,,203,,,,133,134,207,208,209,210,211,212,213,194,195',
    658 '196,197,198,199,200,202,,203,,,,133,134,207,208,209,210,211,212,213',
    659 ',194,195,196,197,198,199,200,202,,203,,,,133,134,207,208,209,210,211',
    660 '212,213,,,,194,195,196,197,198,199,200,202,,203,,,,133,134,207,208,209',
    661 '210,211,212,213,194,195,196,197,198,199,200,202,,203,,,,133,134,207',
    662 '208,209,210,211,212,213,194,195,196,197,198,199,200,202,,203,,,,133',
    663 '134,207,208,209,210,211,212,213,,194,195,196,197,198,199,200,202,,203',
    664 ',,,133,134,207,208,209,210,211,212,213,,,,194,195,196,197,198,199,200',
    665 '202,,203,,,,133,134,207,208,209,210,211,212,213,102,103,104,105,106',
    666 '107,108,109,110,111,112,,,,134,,,,,,,,,,,,,,,,,,,,,,134,,115,116,117',
    667 '118,119,120,121,,,229,581,,,470,574,,573,,,,,134,,87,,,,,,230,,,,,,',
    668 ',,,,,,,,,,134,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27',
    669 '28,29,30,31,32,33,34,35,38,236,,77,,,42,43,44,45,46,47,48,49,,,,,,,',
    670 ',,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28',
    671 '29,30,31,32,33,34,35,38,657,,77,,,42,43,44,45,46,47,48,49,,,,,,,,,,',
    672 ',,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29',
    673 '30,31,32,33,34,35,38,77,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,',
    674 ',,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31',
    675 '32,33,34,35,38,77,,,,,42,43,44,45,46,47,48,49,498,,,,,,,,,,,,,,,,,,5',
     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',
     595'25,26,27,28,29,30,31,32,33,34,35,38,465,189,693,333,334,42,43,44,45',
     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',
     706'135,136,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207',
     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',
     730'29,30,31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,',
     731',,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30',
     732'31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5',
    676733'6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33',
    677 '34,35,38,126,381,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7',
    678 '10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34',
    679 '35,38,77,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14',
    680 '15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,77',
    681 ',,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17',
    682 '18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,77,,,,,42,43',
    683 '44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20',
    684 '21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,77,422,,,,42,43,44,45',
    685 '46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22',
    686 '23,24,25,26,27,28,29,30,31,32,33,34,35,38,77,508,,,,42,43,44,45,46,47',
     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',
     740'43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19',
     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',
    687744'48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24',
    688 '25,26,27,28,29,30,31,32,33,34,35,38,77,,,,,42,43,44,45,46,47,48,49,',
    689 ',,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26',
    690 '27,28,29,30,31,32,33,34,35,38,77,,,,,42,43,44,45,46,47,48,49,,,,,,,',
     745'25,26,27,28,29,30,31,32,33,34,35,38,78,387,,,,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',
     747'27,28,29,30,31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,,,,,,,',
    691748',,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28',
    692 '29,30,31,32,33,34,35,38,77,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,',
    693 ',,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30',
    694 '31,32,33,34,35,38,77,621,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,',
    695 ',,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31',
    696 '32,33,34,35,38,77,627,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5',
    697 '6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33',
    698 '34,35,38,,646,,,,42,43,44,45,46,47,48,49,102,103,104,105,106,107,108',
    699 '109,110,111,112,,,,,,,,,,,,,,,,,,,,,,,,,,,,115,116,117,118,119,120,121',
     749'29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6,7,10,13,14',
     750'15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,,',
     751',,,42,43,44,45,46,47,48,49,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23',
     752'24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48,49',
    700753'5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32',
    701754'33,34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6,7,10,13,14,15,16,17,18',
     
    707760'23,24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48',
    708761'49,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31',
    709 '32,33,34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6,7,10,13,14,15,16,17',
    710 '18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43',
    711 '44,45,46,47,48,49,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26',
    712 '27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47' ]
    713         racc_action_table = arr = ::Array.new(3597, nil)
     762'32,33,34,35,38,,,,,,42,43,44,45,46,47' ]
     763        racc_action_table = arr = ::Array.new(3593, nil)
    714764        idx = 0
    715765        clist.each do |str|
     
    721771
    722772clist = [
    723 '2,463,803,749,688,787,189,218,218,189,602,2,324,386,714,714,714,714',
    724 '714,714,714,714,123,714,586,754,854,714,41,714,714,714,714,714,714,714',
    725 '585,151,815,441,257,386,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2',
    726 '2,2,2,2,2,2,602,257,324,187,631,2,2,2,2,2,2,2,2,854,41,567,810,303,298',
    727 '550,810,90,620,328,74,320,286,749,688,787,463,2,2,2,187,2,2,286,2,555',
    728 '2,189,189,189,803,799,123,504,754,189,714,189,586,602,2,324,2,602,2',
    729 '324,503,83,815,441,585,151,2,83,286,286,286,286,286,286,286,286,286',
    730 '286,286,286,286,286,286,286,286,286,286,286,286,286,286,286,286,286',
    731 '286,286,184,286,631,225,225,286,286,286,286,286,286,286,286,567,303',
    732 '298,550,158,90,620,328,74,320,281,706,87,469,310,158,469,310,286,286',
    733 '286,191,286,286,464,286,776,286,416,799,480,504,555,555,555,480,480',
    734 '614,776,614,555,286,555,286,503,286,158,158,158,158,158,158,158,158',
    735 '158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158',
    736 '158,158,158,310,87,87,220,220,158,158,158,158,158,158,158,158,191,191',
    737 '383,383,182,184,184,184,416,184,184,184,184,615,528,182,281,706,158',
    738 '158,158,852,158,158,169,158,529,158,553,169,464,553,310,310,310,289',
    739 '750,552,530,750,310,158,310,158,615,158,182,182,182,182,182,182,182',
    740 '182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182',
    741 '182,182,182,182,772,369,535,723,852,182,182,182,182,182,182,182,182',
    742 '100,553,264,334,125,536,334,552,289,750,125,765,468,334,125,468,369',
    743 '772,182,182,182,723,182,182,259,182,259,182,100,545,264,705,705,705',
    744 '705,705,705,705,705,540,705,182,765,182,705,182,705,705,705,705,705',
    745 '705,705,289,289,289,701,289,289,289,289,761,761,761,761,761,761,761',
    746 '761,564,761,545,531,531,761,545,761,761,761,761,761,761,761,865,701',
    747 '794,760,760,760,760,760,760,760,760,205,760,205,564,205,760,705,760',
    748 '760,760,760,760,760,760,720,720,720,720,720,720,720,720,794,720,253',
    749 '428,705,720,273,720,720,720,720,720,720,720,761,559,645,588,262,825',
    750 '3,705,360,173,598,154,569,642,838,569,113,428,838,253,761,839,728,273',
    751 '801,760,705,145,541,549,145,642,559,645,588,262,825,761,728,360,173',
    752 '598,154,642,113,760,541,720,681,839,728,510,801,283,681,124,541,510',
    753 '681,283,479,510,760,283,168,479,479,720,551,168,704,704,704,704,704',
    754 '704,704,704,122,704,556,704,868,704,720,704,704,704,704,704,704,704',
    755 '699,699,699,699,699,699,699,699,84,699,561,84,563,699,121,699,699,699',
    756 '699,699,699,699,695,695,695,695,695,695,695,695,120,695,512,512,512',
    757 '695,117,695,695,695,695,695,695,695,691,691,691,691,691,691,691,691',
    758 '116,691,249,249,249,691,572,691,691,691,691,691,691,691,219,219,219',
    759 '219,667,667,667,667,667,667,667,667,115,667,497,497,575,667,704,667',
    760 '667,667,667,667,667,667,285,285,285,285,285,285,285,285,577,285,217',
    761 '217,112,285,699,285,285,285,285,285,285,285,252,252,252,252,252,252',
    762 '252,252,108,252,178,178,587,252,695,252,252,252,252,252,252,252,229',
    763 '229,229,229,229,229,229,229,589,229,489,489,593,229,691,229,229,229',
    764 '229,229,229,229,488,488,488,488,861,861,861,861,861,861,861,861,539',
    765 '861,486,486,594,861,667,861,861,861,861,861,861,861,595,313,596,241',
    766 '241,241,539,539,539,539,539,292,485,485,285,241,241,241,241,241,241',
    767 '229,313,313,313,313,487,487,487,487,597,292,292,292,292,292,252,216',
    768 '80,80,600,229,216,216,848,848,848,848,848,848,848,848,106,848,484,484',
    769 '605,848,229,848,848,848,848,848,848,848,483,483,482,482,821,821,821',
    770 '821,821,821,821,821,608,821,481,481,104,821,861,821,821,821,821,821',
    771 '821,821,818,818,818,818,818,818,818,818,102,818,260,260,621,818,623',
    772 '818,818,818,818,818,818,818,807,807,807,807,807,807,807,807,625,807',
    773 '669,669,626,807,627,807,807,807,807,807,807,807,798,798,798,798,798',
    774 '798,798,798,629,798,502,502,502,798,848,798,798,798,798,798,798,798',
    775 '502,502,502,502,502,502,159,159,159,159,159,159,159,159,159,159,159',
    776 '630,821,632,633,635,637,640,646,807,36,36,36,36,36,36,36,36,36,36,36',
    777 '36,36,36,818,650,651,652,653,807,654,656,795,795,795,795,795,795,795',
    778 '795,658,795,99,795,673,795,807,795,795,795,795,795,795,795,786,786,786',
    779 '786,786,786,786,786,674,786,676,677,678,786,798,786,786,786,786,786',
    780 '786,786,775,775,775,775,775,775,775,775,679,775,680,682,684,775,685',
    781 '775,775,775,775,775,775,775,770,770,770,770,770,770,770,770,686,770',
    782 '98,93,692,770,92,770,770,770,770,770,770,770,696,703,710,712,471,471',
    783 '471,471,471,471,471,471,82,471,715,471,718,471,795,471,471,471,471,471',
    784 '471,471,144,144,144,144,144,144,144,144,721,144,727,732,733,144,786',
    785 '144,144,144,144,144,144,144,466,466,466,466,466,466,466,466,735,466',
    786 '736,738,739,466,775,466,466,466,466,466,466,466,146,146,146,146,146',
    787 '146,146,146,740,146,741,146,742,146,770,146,146,146,146,146,146,146',
    788 '240,86,4,144,743,744,240,86,4,591,240,86,4,745,418,591,747,748,471,591',
    789 '418,78,752,144,418,753,867,867,867,867,867,867,867,867,76,867,757,75',
    790 '73,867,144,867,867,867,867,867,867,867,397,397,397,397,397,397,397,397',
    791 '763,397,72,774,71,397,466,397,397,397,397,397,397,397,359,359,359,359',
    792 '359,359,359,359,778,359,779,780,781,359,146,359,359,359,359,359,359',
    793 '359,358,358,358,358,358,358,358,358,784,358,785,69,68,358,788,358,358',
    794 '358,358,358,358,358,793,796,797,800,357,357,357,357,357,357,357,357',
    795 '805,357,806,38,809,357,867,357,357,357,357,357,357,357,163,163,163,163',
    796 '163,163,163,163,811,163,812,814,16,163,397,163,163,163,163,163,163,163',
    797 '356,356,356,356,356,356,356,356,819,356,820,9,822,356,359,356,356,356',
    798 '356,356,356,356,355,355,355,355,355,355,355,355,828,355,831,832,833',
    799 '355,358,355,355,355,355,355,355,355,835,836,837,840,354,354,354,354',
    800 '354,354,354,354,841,354,842,8,853,354,357,354,354,354,354,354,354,354',
    801 '353,353,353,353,353,353,353,353,224,353,223,230,231,353,163,353,353',
    802 '353,353,353,353,353,352,352,352,352,352,352,352,352,235,352,237,67,856',
    803 '352,356,352,352,352,352,352,352,352,351,351,351,351,351,351,351,351',
    804 '1,351,251,222,261,351,355,351,351,351,351,351,351,351,266,267,269,271',
    805 '350,350,350,350,350,350,350,350,275,350,276,277,278,350,354,350,350',
    806 '350,350,350,350,350,349,349,349,349,349,349,349,349,279,349,280,221',
    807 '857,349,353,349,349,349,349,349,349,349,348,348,348,348,348,348,348',
    808 '348,301,348,302,304,319,348,352,348,348,348,348,348,348,348,347,347',
    809 '347,347,347,347,347,347,201,347,321,322,193,347,351,347,347,347,347',
    810 '347,347,347,329,331,332,336,346,346,346,346,346,346,346,346,337,346',
    811 '186,181,180,346,350,346,346,346,346,346,346,346,345,345,345,345,345',
    812 '345,345,345,176,345,175,174,172,345,349,345,345,345,345,345,345,345',
    813 '344,344,344,344,344,344,344,344,171,344,170,166,165,344,348,344,344',
    814 '344,344,344,344,344,343,343,343,343,343,343,343,343,164,343,162,161',
    815 '362,343,347,343,343,343,343,343,343,343,157,374,375,376,342,342,342',
    816 '342,342,342,342,342,377,342,378,860,388,342,346,342,342,342,342,342',
    817 '342,342,341,341,341,341,341,341,341,341,389,341,390,395,396,341,345',
    818 '341,341,341,341,341,341,341,424,367,248,143,156,401,424,367,248,143',
    819 '424,367,248,143,344,538,538,538,402,538,538,538,538,403,335,335,335',
    820 '335,335,335,335,335,404,335,405,406,343,335,407,335,335,335,335,335',
    821 '335,335,408,410,339,339,339,339,339,339,339,339,413,339,419,420,422',
    822 '339,342,339,339,339,339,339,339,339,255,255,255,255,255,255,255,167',
    823 '167,167,167,167,167,167,341,425,426,431,436,339,339,339,339,339,339',
    824 '339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339',
    825 '339,339,339,339,339,437,863,440,444,446,339,339,339,339,339,339,339',
    826 '339,335,202,202,202,202,202,202,202,202,448,202,864,454,455,202,456',
    827 '202,202,202,202,202,202,202,457,339,459,149,148,139,472,475,490,491',
    828 '492,493,494,137,136,135,134,131,129,202,202,202,202,202,202,202,202',
    829 '202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202',
    830 '202,202,202,127,126,517,518,520,202,202,202,202,202,202,202,202,206',
    831 '206,206,206,206,206,206,206,521,206,522,523,525,206,526,206,206,206',
    832 '206,206,206,206,527,,202,207,207,207,207,207,207,207,207,,207,,,,207',
    833 ',207,207,207,207,207,207,207,619,619,619,619,619,619,619,619,,619,,619',
    834 ',619,,619,619,619,619,619,619,619,580,580,580,580,580,580,580,580,,580',
    835 ',,,580,,580,580,580,580,580,580,580,,573,573,573,573,573,573,573,573',
    836 ',573,,573,,573,206,573,573,573,573,573,573,573,,,,570,570,570,570,570',
    837 '570,570,570,,570,,570,,570,207,570,570,570,570,570,570,570,566,566,566',
    838 '566,566,566,566,566,,566,,,,566,619,566,566,566,566,566,566,566,515',
    839 '515,515,515,515,515,515,515,,515,,,,515,580,515,515,515,515,515,515',
    840 '515,,514,514,514,514,514,514,514,514,,514,,,,514,573,514,514,514,514',
    841 '514,514,514,,,,513,513,513,513,513,513,513,513,,513,,,,513,570,513,513',
    842 '513,513,513,513,513,507,507,507,507,507,507,507,507,,507,,,,507,566',
    843 '507,507,507,507,507,507,507,506,506,506,506,506,506,506,506,,506,,,',
    844 '506,515,506,506,506,506,506,506,506,,505,505,505,505,505,505,505,505',
    845 ',505,,,,505,514,505,505,505,505,505,505,505,,,,496,496,496,496,496,496',
    846 '496,496,,496,,,,496,513,496,496,496,496,496,496,496,458,458,458,458',
    847 '458,458,458,458,458,458,458,,,,507,,,,,,,,,,,,,,,,,,,,,,506,,458,458',
    848 '458,458,458,458,458,,,496,496,,,470,470,,470,,,,,505,,470,,,,,,496,',
    849 ',,,,,,,,,,,,,,,496,470,470,470,470,470,470,470,470,470,470,470,470,470',
    850 '470,470,470,470,470,470,470,470,470,470,470,470,470,470,470,147,,147',
    851 ',,470,470,470,470,470,470,470,470,,,,,,,,,,,,,,,,,,,,,147,147,147,147',
    852 '147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147',
    853 '147,147,147,147,147,147,147,571,,571,,,147,147,147,147,147,147,147,147',
    854 ',,,,,,,,,,,,,,,,,,,,571,571,571,571,571,571,571,571,571,571,571,571',
    855 '571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,366',
    856 ',,,,571,571,571,571,571,571,571,571,,,,,,,,,,,,,,,,,,,366,366,366,366',
    857 '366,366,366,366,366,366,366,366,366,366,366,366,366,366,366,366,366',
    858 '366,366,366,366,366,366,366,246,,,,,366,366,366,366,366,366,366,366',
    859 '366,,,,,,,,,,,,,,,,,,246,246,246,246,246,246,246,246,246,246,246,246',
    860 '246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,70,246',
    861 ',,,246,246,246,246,246,246,246,246,,,,,,,,,,,,,,,,,,,70,70,70,70,70',
    862 '70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70',
    863 '153,,,,,70,70,70,70,70,70,70,70,,,,,,,,,,,,,,,,,,,153,153,153,153,153',
    864 '153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153',
    865 '153,153,153,153,153,153,245,,,,,153,153,153,153,153,153,153,153,,,,',
    866 ',,,,,,,,,,,,,,245,245,245,245,245,245,245,245,245,245,245,245,245,245',
    867 '245,245,245,245,245,245,245,245,245,245,245,245,245,245,288,,,,,245',
    868 '245,245,245,245,245,245,245,,,,,,,,,,,,,,,,,,,288,288,288,288,288,288',
    869 '288,288,288,288,288,288,288,288,288,288,288,288,288,288,288,288,288',
    870 '288,288,288,288,288,380,288,,,,288,288,288,288,288,288,288,288,,,,,',
    871 ',,,,,,,,,,,,,380,380,380,380,380,380,380,380,380,380,380,380,380,380',
    872 '380,380,380,380,380,380,380,380,380,380,380,380,380,380,438,380,,,,380',
    873 '380,380,380,380,380,380,380,,,,,,,,,,,,,,,,,,,438,438,438,438,438,438',
    874 '438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438',
    875 '438,438,438,438,438,439,,,,,438,438,438,438,438,438,438,438,,,,,,,,',
    876 ',,,,,,,,,,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439',
    877 '439,439,439,439,439,439,439,439,439,439,439,439,439,453,,,,,439,439',
    878 '439,439,439,439,439,439,,,,,,,,,,,,,,,,,,,453,453,453,453,453,453,453',
    879 '453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,453,453',
    880 '453,453,453,453,542,,,,,453,453,453,453,453,453,453,453,,,,,,,,,,,,',
    881 ',,,,,,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542',
    882 '542,542,542,542,542,542,542,542,542,542,542,542,546,542,,,,542,542,542',
    883 '542,542,542,542,542,,,,,,,,,,,,,,,,,,,546,546,546,546,546,546,546,546',
    884 '546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546',
    885 '546,546,546,557,546,,,,546,546,546,546,546,546,546,546,,,,,,,,,,,,,',
    886 ',,,,,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557',
    887 '557,557,557,557,557,557,557,557,557,557,557,557,,557,,,,557,557,557',
    888 '557,557,557,557,557,53,53,53,53,53,53,53,53,53,53,53,,,,,,,,,,,,,,,',
    889 ',,,,,,,,,,,,53,53,53,53,53,53,53,694,694,694,694,694,694,694,694,694',
    890 '694,694,694,694,694,694,694,694,694,694,694,694,694,694,694,694,694',
    891 '694,694,,,,,,694,694,694,694,694,694,694,694,690,690,690,690,690,690',
    892 '690,690,690,690,690,690,690,690,690,690,690,690,690,690,690,690,690',
    893 '690,690,690,690,690,,,,,,690,690,690,690,690,690,690,690,239,239,239',
    894 '239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239',
    895 '239,239,239,239,239,239,239,239,,,,,,239,239,239,239,239,239,239,239',
    896 '40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40',
    897 '40,40,40,40,40,,,,,,40,40,40,40,40,40,40,40,284,284,284,284,284,284',
    898 '284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284',
    899 '284,284,284,284,284,,,,,,284,284,284,284,284,284,284,284,511,511,511',
    900 '511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511',
    901 '511,511,511,511,511,511,511,511,,,,,,511,511,511,511,511,511,511,511',
    902 '611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,611',
    903 '611,611,611,611,611,611,611,611,611,611,611,,,,,,611,611,611,611,611',
    904 '611,611,611,234,234,234,234,234,234,234,234,234,234,234,234,234,234',
    905 '234,234,234,234,234,234,234,234,234,234,234,234,234,234,,,,,,234,234',
    906 '234,234,234,234' ]
    907         racc_action_check = arr = ::Array.new(3597, nil)
     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',
     790'291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,291',
     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',
     833'207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207',
     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',
     909'150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150',
     910'150,150,372,,,,,150,150,150,150,150,150,150,150,,,,,,,,,,,,,,,,,,,372',
     911'372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372',
     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',
     938'250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250',
     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',
     949'244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244',
     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',
     953'709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709',
     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)
    908961        idx = 0
    909962        clist.each do |str|
     
    915968
    916969racc_action_pointer = [
    917    nil,  1429,    -1,   489,  1138,   nil,   nil,   nil,  1326,  1278,
    918    nil,   nil,   nil,   nil,   nil,   nil,  1288,   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,
    919972   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    920    nil,   nil,   nil,   nil,   nil,   nil,   889,   nil,  1259,   nil,
    921   3351,    13,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    922    nil,   nil,   nil,  3134,   nil,   nil,   nil,   nil,   nil,   nil,
    923    nil,   nil,   nil,   nil,   nil,   nil,   nil,  1401,  1240,  1239,
    924   2552,  1190,  1188,  1168,    79,  1167,  1164,   nil,  1095,   nil,
    925    757,   nil,  1023,   122,   574,   nil,  1137,   172,   nil,   nil,
    926     76,   nil,   974,   971,   nil,   nil,   nil,   nil,  1026,   904,
    927    340,   nil,   850,   nil,   832,   nil,   802,   nil,   688,   nil,
    928    nil,   nil,   670,   486,   nil,   644,   618,   602,   nil,   nil,
    929    596,   580,   550,    11,   523,   348,  1803,  1804,   nil,  1775,
    930    nil,  1774,   nil,   nil,  1829,  1735,  1827,  1770,   nil,  1762,
    931    nil,   nil,   nil,  1669,  1077,   501,  1121,  2314,  1822,  1812,
    932    nil,    27,   nil,  2611,   453,   nil,  1637,  1612,   182,   831,
    933    nil,  1601,  1604,  1283,  1598,  1580,  1465,  1622,   537,   280,
    934   1578,  1576,  1558,   482,  1562,  1561,  1528,   nil,   659,   nil,
    935   1538,  1541,   269,   nil,   154,   nil,  1534,    33,   nil,    -6,
    936    nil,   128,   nil,  1417,   nil,   nil,   nil,   nil,   nil,   nil,
    937    nil,  1510,  1804,   nil,   nil,   435,  1886,  1911,   nil,   nil,
    938    nil,   nil,   nil,   nil,   nil,   nil,   777,   657,   -19,   613,
    939    224,  1462,  1398,  1352,  1349,   132,   nil,   nil,   nil,   709,
    940   1379,  1376,   nil,   nil,  3515,  1397,   nil,  1368,   nil,  3310,
    941   1136,   689,   nil,   nil,   nil,  2670,  2493,   nil,  1668,   556,
    942    nil,  1416,   687,   430,   nil,  1615,   nil,    30,   nil,   365,
    943    851,  1423,   477,   nil,   341,   nil,  1402,  1429,   nil,  1404,
    944    nil,  1405,   nil,   465,   nil,  1414,  1447,  1418,  1448,  1437,
    945   1439,   174,   nil,   527,  3392,   665,    95,   nil,  2729,   289,
    946    nil,   nil,   678,   nil,   nil,   nil,   nil,   nil,    73,   nil,
    947    nil,  1428,  1430,    72,  1431,   nil,   nil,   nil,   nil,   nil,
    948    181,   nil,   nil,   668,   nil,   nil,   nil,   nil,   nil,  1432,
    949     80,  1395,  1510,   nil,     0,   nil,   nil,   nil,    78,  1526,
    950    nil,  1526,  1527,   nil,   347,  1697,  1523,  1532,   nil,  1721,
    951    nil,  1651,  1629,  1603,  1581,  1559,  1537,  1511,  1489,  1467,
    952   1445,  1419,  1397,  1375,  1353,  1327,  1305,  1261,  1235,  1213,
    953    450,   nil,  1606,   nil,   nil,   nil,  2434,  1667,   nil,   328,
    954    nil,   nil,   nil,   nil,  1619,  1620,  1621,  1630,  1632,   nil,
    955   2788,   nil,   nil,   228,   nil,   nil,     0,   nil,  1634,  1652,
    956   1654,   nil,   nil,   nil,   nil,  1649,  1650,  1191,   nil,   nil,
    957    nil,  1665,  1622,  1683,  1696,  1638,  1699,  1702,  1706,   nil,
    958   1711,   nil,   nil,  1721,   nil,   nil,   166,   nil,  1150,  1723,
    959   1694,   nil,  1695,   nil,  1666,  1650,  1721,   nil,   459,   nil,
    960    nil,  1753,   nil,   nil,   nil,   nil,  1655,  1777,  2847,  2906,
    961   1752,    25,   nil,   nil,  1755,   nil,  1783,   nil,  1805,   nil,
    962    nil,   nil,   nil,  2965,  1709,  1803,  1805,  1813,  2119,  1790,
    963    nil,   nil,   nil,    -8,   188,   nil,  1099,   nil,   356,   183,
    964   2253,  1055,  1821,   nil,   nil,  1825,   nil,   nil,   nil,   524,
    965    190,   819,   807,   799,   787,   745,   721,   757,   705,   689,
    966   1818,  1803,  1803,  1803,  1801,   nil,  2187,   645,   nil,   nil,
    967    nil,   nil,   832,   115,   102,  2162,  2139,  2117,   nil,   nil,
    968    525,  3433,   534,  2095,  2070,  2047,   nil,  1863,  1865,   nil,
    969   1864,  1854,  1887,  1889,   nil,  1890,  1892,  1869,   270,   252,
    970    293,   385,   nil,   nil,   nil,   302,   345,   nil,  1573,   653,
    971    377,   499,  3024,   nil,   nil,   308,  3083,   nil,   nil,   438,
    972     74,   536,   288,   282,   nil,    94,   548,  3142,   nil,   444,
    973    nil,   571,   nil,   459,   409,   nil,  2025,    71,   nil,   486,
    974   2003,  2375,   623,  1978,   nil,   647,   nil,   662,   nil,   nil,
    975   1955,   nil,   nil,   nil,   nil,    26,    14,   691,   476,   709,
    976    nil,  1145,   nil,   713,   739,   749,   746,   775,   452,   nil,
    977    728,   nil,    -2,   nil,   nil,   804,   nil,   nil,   827,   nil,
    978    nil,  3474,   nil,   nil,   204,   269,   nil,   nil,   nil,  1933,
    979     77,   823,   nil,   852,   nil,   872,   843,   847,   nil,   890,
    980    925,    60,   896,   897,   nil,   929,   nil,   899,   nil,   nil,
    981    814,   nil,   484,   nil,   nil,   475,   901,   nil,   nil,   nil,
    982    943,   944,   835,   920,   948,   nil,   951,   nil,   963,   nil,
    983    nil,   nil,   nil,   nil,   nil,   nil,   nil,   643,   nil,   843,
    984    nil,   nil,   nil,   935,   980,   nil,   982,   983,   959,  1007,
    985    979,   522,  1005,   nil,  1006,   983,  1026,   nil,   -10,   nil,
    986   3269,   617,   972,   nil,  3228,   595,  1038,   nil,   nil,   573,
    987    nil,   396,   nil,  1045,   551,   382,   175,   nil,   nil,   nil,
    988   1015,   nil,  1042,   nil,    12,   939,   nil,   nil,  1059,   nil,
    989    459,  1073,   nil,   302,   nil,   nil,   nil,  1049,   491,   nil,
    990    nil,   nil,  1050,  1076,   nil,  1099,  1100,   nil,  1102,  1073,
    991   1090,  1118,  1009,  1134,  1108,  1145,   nil,  1121,  1148,   -11,
    992    290,   nil,  1152,  1129,    10,   nil,   nil,  1166,   nil,   nil,
    993    437,   412,   nil,  1161,   nil,   323,   nil,   nil,   nil,   nil,
    994   1029,   nil,   328,   nil,  1163,  1007,   175,   nil,  1208,  1210,
    995   1098,  1187,   nil,   nil,  1117,  1207,   985,    -9,  1209,   nil,
    996    nil,   nil,   nil,  1248,   428,   963,  1249,  1221,   893,   100,
    997   1222,   495,   nil,   -13,   nil,  1230,  1258,   871,   nil,  1235,
    998     75,  1280,  1285,   nil,  1256,    24,   nil,   nil,   849,  1301,
    999   1277,   827,  1309,   nil,   nil,   478,   nil,   nil,  1295,   nil,
    1000    nil,  1324,  1327,  1326,   nil,  1341,  1281,  1313,   486,   492,
    1001   1314,  1323,  1294,   nil,   nil,   nil,   nil,   nil,   801,   nil,
    1002    nil,   nil,   272,  1354,    11,   nil,  1402,  1441,   nil,   nil,
    1003   1633,   735,   nil,  1778,  1806,   395,   nil,  1169,   555,   nil ]
     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,
     1061   nil ]
    10041062
    10051063racc_action_default = [
    1006   -194,  -418,    -1,  -418,  -418,   -69,   -70,   -71,   -72,   -73,
    1007    -74,   -75,   -76,   -77,   -78,   -79,  -418,   -81,   -82,   -83,
     1064  -195,  -442,    -1,  -442,  -442,   -69,   -70,   -71,   -72,   -73,
     1065   -74,   -75,   -76,   -77,   -78,   -79,  -442,   -81,   -82,   -83,
    10081066   -84,   -85,   -86,   -87,   -88,   -89,   -90,   -91,   -92,   -93,
    1009    -94,   -95,   -96,   -97,   -98,   -99,  -418,  -101,  -104,  -118,
    1010   -418,  -418,  -126,  -127,  -128,  -129,  -130,  -131,  -136,  -137,
    1011   -192,  -193,  -195,  -418,  -197,  -198,  -199,  -200,  -201,  -202,
    1012   -203,  -206,  -207,  -208,  -209,  -210,  -234,  -418,  -418,  -418,
    1013   -418,  -418,  -418,  -418,  -418,  -418,  -418,  -405,  -418,   870,
    1014   -418,   -65,   -67,  -418,  -139,  -140,  -418,  -146,  -205,  -204,
    1015   -418,  -100,  -106,  -418,  -109,   -72,   -73,  -119,  -418,  -125,
    1016   -418,  -211,  -418,  -214,  -418,  -216,  -418,  -218,  -418,  -220,
    1017   -221,  -222,  -418,  -418,  -386,  -418,  -418,  -418,  -394,  -395,
    1018   -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -247,  -418,
    1019   -254,  -418,  -260,  -250,  -418,  -327,  -418,  -418,  -350,  -418,
    1020   -398,  -410,   -62,  -418,  -418,  -138,  -418,  -418,  -418,  -147,
    1021   -148,  -418,  -102,  -418,  -418,  -132,  -134,  -418,  -418,  -418,
    1022   -406,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,
    1023   -418,  -418,  -418,  -418,  -418,  -418,  -418,  -337,  -418,  -244,
    1024   -418,  -242,  -418,  -255,  -418,  -251,  -418,  -418,  -328,  -418,
    1025   -399,  -418,   -66,    -2,    -3,    -4,    -5,    -6,    -7,    -8,
    1026     -9,   -10,  -418,   -12,   -14,   -18,  -418,  -418,   -22,   -23,
    1027    -24,   -25,   -26,   -27,   -28,   -30,   -34,   -37,   -40,   -45,
    1028    -48,   -50,   -52,   -54,   -56,   -58,   -61,   -68,  -186,  -418,
    1029   -418,  -418,  -143,   -63,  -418,  -418,  -145,  -150,  -152,  -418,
    1030   -156,  -418,  -141,  -149,   -80,  -418,  -418,  -107,  -418,  -418,
    1031   -123,  -418,  -418,  -418,  -196,  -418,  -212,  -418,  -224,  -418,
    1032   -418,  -418,  -418,  -228,  -418,  -291,  -418,  -418,  -387,  -418,
    1033   -389,  -418,  -391,  -418,  -404,  -418,  -418,  -418,  -418,  -418,
    1034   -418,  -418,  -240,  -418,  -418,  -418,  -418,  -248,  -418,  -418,
    1035   -261,  -263,  -418,  -265,  -266,  -267,  -268,  -269,  -418,  -288,
    1036   -289,  -418,  -418,  -418,  -418,  -313,  -314,  -252,  -324,  -326,
    1037   -418,  -351,  -353,  -418,  -355,  -356,  -357,  -358,  -365,  -418,
    1038   -418,  -418,  -418,  -381,  -418,  -407,  -408,  -409,  -418,  -418,
    1039    -13,  -418,  -418,   -60,  -172,  -418,  -418,  -418,   -19,  -418,
    1040    -20,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,
    1041   -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,
    1042   -418,  -190,  -418,  -142,   -64,  -144,  -418,  -157,  -155,  -418,
    1043   -159,  -161,  -162,  -163,  -418,  -418,  -166,  -418,  -418,  -171,
    1044   -418,  -105,  -108,  -418,  -120,  -122,  -418,  -112,  -114,  -418,
    1045   -418,  -133,  -135,  -124,  -213,  -418,  -418,  -418,  -215,  -217,
    1046   -219,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -418,  -393,
    1047   -418,  -397,  -235,  -418,  -237,  -238,  -418,  -245,  -418,  -418,
    1048   -418,  -249,  -418,  -256,  -418,  -418,  -418,  -262,  -418,  -270,
    1049   -272,  -418,  -274,  -275,  -276,  -277,  -290,  -418,  -418,  -418,
    1050   -250,  -418,  -315,  -329,  -418,  -352,  -418,  -359,  -418,  -361,
    1051   -362,  -363,  -364,  -418,  -372,  -418,  -418,  -418,  -418,  -418,
    1052   -400,  -401,  -402,  -418,  -418,   -11,  -418,  -173,  -174,  -175,
    1053   -418,  -418,  -418,   -16,   -17,  -418,   -31,   -32,   -33,   -35,
    1054    -36,   -38,   -39,   -41,   -42,   -43,   -44,   -46,   -47,   -49,
    1055    -51,   -53,   -55,   -57,  -418,  -187,  -418,  -418,  -151,  -153,
    1056   -154,  -158,  -418,  -418,  -418,  -418,  -418,  -418,  -103,  -110,
    1057   -418,  -418,  -418,  -418,  -418,  -418,  -225,  -418,  -418,  -229,
    1058   -418,  -418,  -338,  -418,  -399,  -418,  -418,  -418,  -418,  -418,
    1059   -418,  -418,  -243,  -246,  -253,  -418,  -418,  -259,  -418,  -418,
    1060   -418,  -418,  -418,  -294,  -296,  -418,  -418,  -305,  -307,  -418,
    1061   -418,  -418,  -418,  -418,  -349,  -418,  -418,  -418,  -367,  -418,
    1062   -373,  -418,  -382,  -418,  -418,  -385,  -418,  -418,   -29,  -176,
    1063   -418,  -418,  -418,  -405,  -182,  -418,  -178,  -418,   -15,   -21,
    1064   -418,  -188,  -191,  -189,  -160,  -418,  -418,  -418,  -418,  -418,
    1065   -121,  -418,  -113,  -418,  -418,  -418,  -418,  -418,  -418,  -232,
    1066   -418,  -223,  -418,  -388,  -390,  -418,  -396,  -236,  -418,  -241,
    1067   -257,  -418,  -264,  -271,  -418,  -418,  -278,  -279,  -284,  -418,
    1068   -418,  -418,  -295,  -418,  -298,  -418,  -418,  -418,  -306,  -418,
    1069   -418,  -418,  -418,  -418,  -316,  -418,  -319,  -418,  -330,  -331,
    1070   -418,  -333,  -418,  -343,  -354,  -418,  -418,  -368,  -369,  -371,
    1071   -418,  -418,  -418,  -418,  -418,  -180,  -418,  -184,  -418,  -177,
    1072   -183,  -179,   -59,  -164,  -165,  -167,  -168,  -418,  -170,  -418,
    1073   -115,  -116,  -117,  -418,  -418,  -230,  -418,  -418,  -418,  -418,
    1074   -418,  -418,  -418,  -273,  -418,  -418,  -418,  -292,  -418,  -293,
    1075   -418,  -418,  -418,  -304,  -418,  -418,  -418,  -310,  -312,  -418,
    1076   -325,  -418,  -335,  -418,  -418,  -418,  -418,  -360,  -366,  -374,
    1077   -418,  -383,  -418,  -403,  -418,  -418,  -181,  -185,  -418,  -111,
    1078   -418,  -418,  -233,  -418,  -384,  -392,  -239,  -418,  -418,  -280,
    1079   -281,  -285,  -418,  -418,  -297,  -418,  -418,  -308,  -418,  -418,
    1080   -418,  -418,  -418,  -418,  -418,  -418,  -348,  -418,  -418,  -418,
    1081   -418,  -379,  -418,  -418,  -418,  -169,  -226,  -418,  -231,  -258,
    1082   -418,  -418,  -286,  -418,  -299,  -418,  -302,  -303,  -309,  -311,
    1083   -418,  -332,  -418,  -334,  -418,  -418,  -418,  -341,  -418,  -418,
    1084   -343,  -418,  -375,  -376,  -418,  -418,  -418,  -418,  -418,  -282,
    1085   -283,  -287,  -300,  -418,  -418,  -418,  -418,  -418,  -418,  -418,
    1086   -418,  -418,  -370,  -418,  -380,  -418,  -418,  -418,  -301,  -418,
    1087   -418,  -418,  -418,  -339,  -418,  -418,  -342,  -344,  -418,  -418,
    1088   -418,  -418,  -418,  -227,  -317,  -418,  -320,  -322,  -418,  -336,
    1089   -340,  -418,  -418,  -418,  -378,  -418,  -418,  -418,  -418,  -418,
    1090   -418,  -418,  -418,  -417,  -318,  -321,  -323,  -346,  -418,  -345,
    1091   -377,  -413,  -418,  -418,  -418,  -415,  -418,  -418,  -411,  -412,
    1092   -418,  -418,  -347,  -418,  -418,  -418,  -416,  -418,  -418,  -414 ]
     1067   -94,   -95,   -96,   -97,   -98,   -99,  -442,  -101,  -104,  -118,
     1068  -442,  -442,  -126,  -127,  -128,  -129,  -130,  -131,  -136,  -137,
     1069  -192,  -193,  -194,  -196,  -442,  -198,  -199,  -200,  -201,  -202,
     1070  -203,  -204,  -207,  -208,  -209,  -210,  -211,  -235,  -442,  -442,
     1071  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -408,  -442,
     1072  -442,   911,  -442,   -65,   -67,  -442,  -139,  -140,  -442,  -146,
     1073  -206,  -205,  -442,  -100,  -106,  -442,  -109,   -72,   -73,  -119,
     1074  -442,  -125,  -442,  -212,  -442,  -215,  -442,  -217,  -442,  -219,
     1075  -442,  -221,  -222,  -223,  -442,  -442,  -389,  -442,  -442,  -442,
     1076  -397,  -398,  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -442,
     1077  -248,  -442,  -255,  -442,  -261,  -251,  -442,  -328,  -442,  -442,
     1078  -351,  -442,  -401,  -413,  -442,   -62,  -442,  -442,  -138,  -442,
     1079  -442,  -442,  -147,  -148,  -442,  -102,  -442,  -442,  -132,  -134,
     1080  -442,  -442,  -442,  -409,  -442,  -442,  -442,  -442,  -442,  -442,
     1081  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -442,
     1082  -338,  -442,  -245,  -442,  -243,  -442,  -256,  -442,  -252,  -442,
     1083  -442,  -329,  -442,  -402,  -442,  -442,  -435,   -66,    -2,    -3,
     1084    -4,    -5,    -6,    -7,    -8,    -9,   -10,  -442,   -12,   -14,
     1085   -18,  -442,  -442,   -22,   -23,   -24,   -25,   -26,   -27,   -28,
     1086   -30,   -34,   -37,   -40,   -45,   -48,   -50,   -52,   -54,   -56,
     1087   -58,   -61,   -68,  -186,  -442,  -442,  -442,  -143,   -63,  -442,
     1088  -442,  -145,  -150,  -152,  -442,  -156,  -442,  -141,  -149,   -80,
     1089  -442,  -442,  -107,  -442,  -442,  -123,  -442,  -442,  -442,  -197,
     1090  -442,  -213,  -442,  -225,  -442,  -442,  -442,  -442,  -229,  -442,
     1091  -292,  -442,  -442,  -390,  -442,  -392,  -442,  -394,  -442,  -407,
     1092  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -241,  -442,  -442,
     1093  -442,  -442,  -249,  -442,  -442,  -262,  -264,  -442,  -266,  -267,
     1094  -268,  -269,  -270,  -442,  -289,  -290,  -442,  -442,  -442,  -442,
     1095  -314,  -315,  -253,  -325,  -327,  -442,  -352,  -354,  -442,  -356,
     1096  -357,  -358,  -359,  -367,  -442,  -442,  -442,  -442,  -384,  -442,
     1097  -410,  -411,  -412,  -442,  -442,  -442,   -13,  -442,  -442,   -60,
     1098  -172,  -442,  -442,  -442,   -19,  -442,   -20,  -442,  -442,  -442,
     1099  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -442,
     1100  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -190,  -442,  -142,
     1101   -64,  -144,  -442,  -157,  -155,  -442,  -159,  -161,  -162,  -163,
     1102  -442,  -442,  -166,  -442,  -442,  -171,  -442,  -105,  -108,  -442,
     1103  -120,  -122,  -442,  -112,  -114,  -442,  -442,  -133,  -135,  -124,
     1104  -214,  -442,  -442,  -442,  -216,  -218,  -220,  -442,  -442,  -442,
     1105  -442,  -442,  -442,  -442,  -442,  -396,  -442,  -400,  -236,  -442,
     1106  -238,  -239,  -442,  -246,  -442,  -442,  -442,  -250,  -442,  -257,
     1107  -442,  -442,  -442,  -263,  -442,  -271,  -273,  -442,  -275,  -276,
     1108  -277,  -278,  -291,  -442,  -442,  -442,  -251,  -442,  -316,  -330,
     1109  -442,  -353,  -442,  -360,  -442,  -363,  -364,  -365,  -366,  -442,
     1110  -374,  -442,  -442,  -442,  -442,  -442,  -403,  -404,  -405,  -442,
     1111  -442,  -421,  -442,   -11,  -442,  -173,  -174,  -175,  -442,  -442,
     1112  -442,   -16,   -17,  -442,   -31,   -32,   -33,   -35,   -36,   -38,
     1113   -39,   -41,   -42,   -43,   -44,   -46,   -47,   -49,   -51,   -53,
     1114   -55,   -57,  -442,  -187,  -442,  -442,  -151,  -153,  -154,  -158,
     1115  -442,  -442,  -442,  -442,  -442,  -442,  -103,  -110,  -442,  -442,
     1116  -442,  -442,  -442,  -442,  -226,  -442,  -442,  -230,  -442,  -442,
     1117  -339,  -442,  -402,  -442,  -442,  -442,  -442,  -442,  -442,  -442,
     1118  -244,  -247,  -254,  -442,  -442,  -260,  -442,  -442,  -442,  -442,
     1119  -442,  -295,  -297,  -442,  -442,  -306,  -308,  -442,  -442,  -442,
     1120  -442,  -442,  -350,  -442,  -442,  -442,  -442,  -369,  -442,  -375,
     1121  -442,  -385,  -442,  -442,  -388,  -442,  -442,  -442,  -442,   -29,
     1122  -176,  -442,  -442,  -442,  -408,  -182,  -442,  -178,  -442,   -15,
     1123   -21,  -442,  -188,  -191,  -189,  -160,  -442,  -442,  -442,  -442,
     1124  -442,  -121,  -442,  -113,  -442,  -442,  -442,  -442,  -442,  -442,
     1125  -233,  -442,  -224,  -442,  -391,  -393,  -442,  -399,  -237,  -442,
     1126  -242,  -258,  -442,  -265,  -272,  -442,  -442,  -279,  -280,  -285,
     1127  -442,  -442,  -442,  -296,  -442,  -299,  -442,  -442,  -442,  -307,
     1128  -442,  -442,  -442,  -442,  -442,  -317,  -442,  -320,  -442,  -331,
     1129  -332,  -442,  -334,  -442,  -344,  -355,  -361,  -442,  -442,  -370,
     1130  -371,  -373,  -442,  -442,  -442,  -442,  -442,  -422,  -442,  -442,
     1131  -180,  -442,  -184,  -442,  -177,  -183,  -179,   -59,  -164,  -165,
     1132  -167,  -168,  -442,  -170,  -442,  -115,  -116,  -117,  -442,  -442,
     1133  -231,  -442,  -442,  -442,  -442,  -442,  -442,  -442,  -274,  -442,
     1134  -442,  -442,  -293,  -442,  -294,  -442,  -442,  -442,  -305,  -442,
     1135  -442,  -442,  -311,  -313,  -442,  -326,  -442,  -336,  -442,  -442,
     1136  -442,  -442,  -362,  -368,  -376,  -442,  -386,  -442,  -406,  -442,
     1137  -442,  -442,  -423,  -425,  -426,  -427,  -428,  -429,  -430,  -442,
     1138  -436,  -437,  -442,  -442,  -181,  -185,  -442,  -111,  -442,  -442,
     1139  -234,  -442,  -387,  -395,  -240,  -442,  -442,  -281,  -282,  -286,
     1140  -442,  -442,  -298,  -442,  -442,  -309,  -442,  -442,  -442,  -442,
     1141  -442,  -442,  -442,  -442,  -349,  -442,  -442,  -442,  -442,  -382,
     1142  -442,  -442,  -442,  -442,  -442,  -432,  -433,  -438,  -439,  -440,
     1143  -441,  -169,  -227,  -442,  -232,  -259,  -442,  -442,  -287,  -442,
     1144  -300,  -442,  -303,  -304,  -310,  -312,  -442,  -333,  -442,  -335,
     1145  -442,  -442,  -442,  -342,  -442,  -442,  -344,  -442,  -377,  -378,
     1146  -379,  -442,  -442,  -442,  -442,  -424,  -431,  -442,  -442,  -283,
     1147  -284,  -288,  -301,  -442,  -442,  -442,  -442,  -442,  -442,  -442,
     1148  -442,  -442,  -372,  -442,  -383,  -442,  -442,  -434,  -442,  -302,
     1149  -442,  -442,  -442,  -442,  -340,  -442,  -442,  -343,  -345,  -442,
     1150  -442,  -442,  -442,  -442,  -228,  -318,  -442,  -321,  -323,  -442,
     1151  -337,  -341,  -442,  -442,  -442,  -381,  -442,  -442,  -442,  -442,
     1152  -442,  -442,  -442,  -442,  -420,  -319,  -322,  -324,  -347,  -442,
     1153  -346,  -380,  -416,  -442,  -442,  -442,  -418,  -442,  -442,  -414,
     1154  -415,  -442,  -442,  -348,  -442,  -442,  -442,  -419,  -442,  -442,
     1155  -417 ]
    10931156
    10941157racc_goto_table = [
    1095     53,   135,    82,   227,   260,   176,   149,   333,   231,   233,
    1096    158,   258,   100,   150,    97,   318,   235,   151,   563,   383,
    1097    462,   178,    50,   166,   324,   261,   523,   461,   525,   526,
    1098    387,   370,     9,     8,   338,   429,   263,   638,   561,    81,
    1099    139,   598,   311,   382,   125,   467,   266,   332,   547,   269,
    1100    271,   702,   290,   246,   154,   543,   745,   615,   766,   642,
    1101    710,   483,   484,   485,   486,   137,   234,   487,   488,   310,
    1102    558,   544,   548,   645,   644,   243,   479,   480,   481,   482,
    1103    446,   447,   557,   455,   148,   559,   544,   750,   361,   709,
    1104    333,   783,   268,   273,   191,   326,   364,   327,   854,   859,
    1105      1,   233,   852,     2,   340,   489,   490,   491,   492,   493,
    1106     80,   367,    91,   253,   392,   808,    92,   245,    93,   386,
    1107    590,   391,   419,   179,   145,   499,   369,   248,   569,   360,
    1108     51,   254,   256,   257,   262,   541,   318,   180,   127,   286,
    1109    333,    82,   129,   288,   333,   380,   423,   811,   131,   289,
    1110    612,   249,   608,   773,   428,   628,   255,   427,   234,   622,
    1111    784,   729,   785,   445,   333,   437,   686,   542,   623,   476,
    1112    477,   478,   472,   765,   647,   544,   334,   382,   192,   548,
    1113     53,   572,   292,   546,   475,   629,   552,   313,     9,     8,
    1114    544,   634,   635,   825,   136,   187,   494,   553,   723,   443,
    1115    639,   701,   287,   771,   497,   nil,   nil,   nil,   416,   nil,
    1116    nil,   nil,     9,     8,   nil,   nil,   nil,   nil,   nil,   248,
    1117    248,   nil,   nil,   nil,   nil,   436,   nil,   679,   233,   nil,
    1118    441,   405,   nil,   712,   782,   nil,   nil,   nil,   368,   nil,
    1119    nil,   nil,   nil,   249,   249,   516,   522,   454,   522,   522,
    1120    nil,   nil,   nil,   nil,   nil,   463,   nil,   nil,   418,   518,
    1121    468,   nil,   424,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1122    nil,   nil,   nil,   519,   nil,   nil,   nil,   nil,   nil,   501,
    1123    nil,   417,   613,   nil,    53,   234,   425,   292,   nil,   527,
    1124    nil,   nil,   584,   592,   568,   nil,   511,   nil,   462,   nil,
    1125    nil,   nil,   nil,   nil,   nil,   461,   421,   nil,   313,   nil,
    1126    333,   333,   333,   334,   531,   nil,     9,     8,   333,   333,
    1127    333,   nil,   458,   734,   nil,   nil,   nil,   737,   nil,   nil,
    1128    nil,   nil,   233,   577,   nil,   nil,   nil,   nil,   538,   575,
    1129    nil,   nil,   587,   588,   589,   nil,   nil,   nil,   713,   nil,
    1130    593,   594,   595,   nil,   248,   582,   555,   nil,   602,   nil,
    1131    nil,   nil,   669,   nil,   820,   500,   nil,   nil,   nil,   nil,
    1132    nil,   nil,   522,   nil,   nil,   nil,   nil,   nil,   249,   nil,
    1133    nil,   318,   nil,   nil,   nil,   662,   nil,   nil,   nil,   234,
    1134    nil,   567,   nil,   nil,   841,   nil,   468,   nil,   nil,   nil,
     1158    54,   137,   232,    84,   236,   265,   263,   161,   179,   195,
     1159   339,   152,   240,   572,   238,   102,   153,    99,   154,   323,
     1160   169,   266,   389,   329,   531,   468,   533,   534,   467,   393,
     1161     9,   181,   425,   435,    50,   376,   453,   344,   268,   570,
     1162     8,   552,   556,   649,   650,   609,   141,   732,   127,    83,
     1163   271,   388,   251,   274,   276,   338,   552,   475,   316,   717,
     1164   773,   725,   295,   555,   157,   551,   802,   626,   491,   492,
     1165   493,   494,   239,   487,   488,   495,   496,   489,   490,   248,
     1166   567,   452,   566,   480,   657,   461,   568,   151,   778,   367,
     1167   724,   819,   273,   339,   278,   194,   331,   332,   895,   900,
     1168   893,   471,   577,   370,     1,   784,     2,   502,   238,   346,
     1169   497,   498,   398,   499,   500,   501,    82,   786,   373,    93,
     1170    94,   250,    95,   392,   258,   601,   182,   397,   148,   507,
     1171   375,   580,   366,   253,    51,   849,    52,   259,   261,   262,
     1172   267,   549,   323,   183,   339,    84,   386,   552,   339,   129,
     1173   291,   556,   619,   131,   254,   293,   429,   133,   294,   260,
     1174   623,   825,   434,   552,   757,   443,   239,   701,   339,   433,
     1175   550,   633,   639,   484,   485,   486,   852,   821,   809,   822,
     1176   634,   451,   801,    54,   340,   297,   388,   659,   554,     9,
     1177   318,   197,   640,   483,   560,   583,   645,   646,   866,     8,
     1178   138,   190,   561,   449,   716,   847,   807,   808,   505,   751,
     1179   139,   315,   422,     9,   655,   nil,   nil,   292,   nil,   nil,
     1180   nil,   nil,   nil,     8,   nil,   nil,   nil,   253,   253,   442,
     1181   694,   nil,   nil,   nil,   447,   nil,   238,   nil,   nil,   nil,
     1182   727,   411,   nil,   524,   374,   nil,   nil,   nil,   254,   254,
     1183   530,   460,   530,   530,   nil,   598,   599,   600,   526,   469,
     1184   818,   820,   nil,   604,   605,   606,   424,   476,   nil,   nil,
     1185   430,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   527,   nil,
     1186   509,   nil,   656,   624,   nil,   nil,   nil,   423,   nil,    54,
     1187   nil,   431,   297,   nil,   239,   603,   535,   519,   nil,   595,
     1188   579,   nil,   762,   nil,   nil,   nil,   765,   nil,   nil,   468,
     1189   nil,   nil,   467,   318,   nil,   nil,   339,   339,   339,     9,
     1190   nil,   nil,   340,   427,   339,   339,   339,   464,   539,     8,
     1191   nil,   nil,   nil,   nil,   588,   nil,   nil,   578,   nil,   546,
     1192   586,   nil,   238,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1193   nil,   nil,   nil,   nil,   nil,   nil,   nil,   563,   nil,   593,
     1194   728,   nil,   613,   253,   nil,   nil,   nil,   nil,   nil,   nil,
     1195   nil,   684,   508,   nil,   nil,   nil,   nil,   nil,   530,   nil,
     1196   nil,   nil,   nil,   nil,   254,   nil,   nil,   nil,   nil,   nil,
     1197   323,   nil,   nil,   861,   677,   nil,   576,   nil,   nil,   nil,
     1198   239,   nil,   nil,   nil,   nil,   476,   nil,   nil,   nil,   nil,
    11351199   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1136    nil,   nil,   nil,   nil,   nil,   nil,   179,   564,   812,   nil,
    1137    nil,   nil,   535,   nil,   nil,   nil,   nil,   nil,   653,   nil,
    1138    585,   586,   656,   233,   nil,   577,   545,   549,   nil,   nil,
    1139    658,   nil,   nil,   nil,   nil,   nil,   611,   522,   nil,   nil,
    1140    nil,   545,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1200   nil,   nil,   nil,   182,   882,   573,   nil,   nil,   nil,   543,
     1201   665,   nil,   nil,   nil,   nil,   nil,   671,   596,   597,   588,
     1202   nil,   nil,   553,   557,   673,   nil,   238,   nil,   763,   622,
     1203   853,   nil,   766,   nil,   610,   nil,   530,   553,   nil,   nil,
    11411204   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1142    nil,   nil,   nil,   nil,   652,   nil,   nil,   631,   nil,   nil,
    1143    nil,   687,   nil,   nil,   nil,   591,   nil,   nil,   nil,   nil,
    1144    234,   nil,   nil,   nil,   nil,   nil,   333,   nil,   nil,   nil,
    1145    333,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1205   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   664,   nil,
     1206   nil,   nil,   nil,   nil,   642,   702,   nil,   nil,   nil,   nil,
     1207   nil,   nil,   nil,   nil,   nil,   nil,   602,   nil,   nil,   nil,
     1208   nil,   nil,   nil,   nil,   239,   nil,   nil,   nil,   nil,   339,
     1209   nil,   nil,   nil,   339,   nil,   nil,   nil,   nil,   nil,   nil,
    11461210   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1147    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   735,   718,
    1148    nil,   nil,   738,   690,   730,   nil,   nil,   nil,   nil,   694,
    1149    545,   nil,   nil,   nil,   549,   nil,   nil,   688,   nil,   nil,
    1150    nil,   640,   nil,   nil,   nil,   545,   nil,   nil,   nil,   nil,
    1151    nil,   740,   nil,   nil,   747,   nil,   746,   nil,   nil,   nil,
    1152    nil,   nil,   nil,   nil,   nil,   nil,   753,   nil,   nil,   756,
    1153    333,   nil,   nil,   nil,   nil,   681,   nil,   nil,   nil,   nil,
     1211   nil,   nil,   nil,   731,   nil,   nil,   nil,   746,   nil,   705,
     1212   nil,   758,   nil,   nil,   nil,   709,   nil,   nil,   553,   nil,
     1213   nil,   nil,   557,   837,   nil,   nil,   nil,   703,   nil,   651,
     1214   nil,   nil,   nil,   nil,   553,   nil,   nil,   nil,   nil,   768,
     1215   nil,   nil,   nil,   nil,   774,   775,   nil,   nil,   nil,   nil,
     1216   855,   nil,   nil,   nil,   781,   nil,   nil,   nil,   nil,   nil,
     1217   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   696,
     1218   nil,   873,   nil,   792,   nil,   nil,   nil,   nil,   nil,   nil,
     1219   nil,   464,   nil,   nil,   339,   nil,   nil,   750,   610,   nil,
     1220   nil,   769,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1221   nil,   894,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1222   nil,   339,   nil,   nil,   nil,   nil,   nil,   777,   nil,   nil,
     1223   nil,   829,   830,   810,   nil,   nil,   nil,   nil,   nil,   nil,
     1224   nil,   834,   339,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1225   nil,   nil,   nil,   nil,   nil,   nil,   530,   nil,   845,   nil,
    11541226   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1155    458,   nil,   nil,   333,   nil,   nil,   nil,   nil,   nil,   nil,
    1156    nil,   741,   797,   nil,   nil,   nil,   nil,   nil,   nil,   789,
    1157    790,   nil,   nil,   333,   774,   nil,   nil,   nil,   nil,   nil,
    1158    nil,   nil,   794,   749,   nil,   814,   nil,   nil,   522,   nil,
    1159    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   805,   nil,
    1160    nil,   nil,   nil,   333,   nil,   832,   nil,   746,   nil,   nil,
    1161    nil,   nil,   nil,   nil,   nil,   nil,   823,   nil,   nil,   nil,
    1162    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   727,
    1163    nil,   787,   nil,   835,   nil,   853,   nil,   nil,   nil,   nil,
     1227   774,   nil,   339,   nil,   nil,   755,   nil,   nil,   nil,   nil,
     1228   nil,   nil,   nil,   864,   nil,   nil,   nil,   nil,   824,   nil,
     1229   nil,   nil,   nil,   nil,   nil,   nil,   nil,   876,   nil,   nil,
    11641230   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    11651231   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    11661232   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1167    nil,   nil,   nil,   864,   nil,   nil,   815,   nil,   nil,   868,
     1233   nil,   nil,   nil,   nil,   nil,   nil,   nil,   905,   nil,   nil,
     1234   nil,   nil,   nil,   909,   nil,   856,   nil,   nil,   nil,   nil,
     1235   nil,   nil,   nil,   nil,   nil,   nil,   651 ]
     1236
     1237racc_goto_check = [
     1238    45,     4,    32,    31,    23,     5,    85,    47,    83,   167,
     1239    22,    29,    55,   153,    28,    68,    53,    25,     4,   101,
     1240    47,    23,    44,   157,    84,    74,    84,    84,    76,    48,
     1241    34,    89,     6,   106,    64,    60,   145,    10,    86,   154,
     1242    33,    24,    24,   129,   130,    88,   156,   170,    25,    30,
     1243    83,    43,    40,    83,    83,    11,    24,    61,   138,   133,
     1244   135,   152,    98,   118,    51,   113,   116,   107,    14,    14,
     1245    14,    14,    29,    12,    12,    15,    15,    13,    13,    53,
     1246   113,   140,   146,     6,   107,   147,   148,    31,   149,    32,
     1247   150,   151,   158,    22,   159,   161,   162,   163,   164,   165,
     1248   166,   168,   169,    28,     1,   173,     2,     6,    28,     8,
     1249    16,    17,    23,    18,    19,    20,    26,   170,    27,    37,
     1250    39,    41,    42,    46,    51,    49,    31,    52,    54,    57,
     1251    59,    62,    63,    25,    65,   116,    66,    67,    80,    81,
     1252    82,    87,   101,    90,    22,    31,    40,    24,    22,    91,
     1253    92,    24,    84,    93,    45,    94,    95,    96,    97,    45,
     1254    99,   170,   100,    24,   108,   110,    29,   111,    22,    98,
     1255   112,   113,   118,    10,    10,    10,   135,   152,   133,   152,
     1256   114,   138,   115,    45,    25,    45,    43,   113,   117,    34,
     1257    45,    30,   119,    11,   121,    61,   122,   123,   124,    33,
     1258   125,   126,   127,   128,   131,   170,   132,   134,     5,    88,
     1259   136,   137,     4,    34,   139,   nil,   nil,    64,   nil,   nil,
     1260   nil,   nil,   nil,    33,   nil,   nil,   nil,    25,    25,     4,
     1261    84,   nil,   nil,   nil,     4,   nil,    28,   nil,   nil,   nil,
     1262   154,   156,   nil,    85,    31,   nil,   nil,   nil,    45,    45,
     1263     5,     4,     5,     5,   nil,     6,     6,     6,    23,     4,
     1264   129,   130,   nil,     6,     6,     6,    25,    53,   nil,   nil,
     1265    25,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    86,   nil,
     1266    47,   nil,   145,   106,   nil,   nil,   nil,    31,   nil,    45,
     1267   nil,    45,    45,   nil,    29,    48,    83,    47,   nil,    60,
     1268    10,   nil,    24,   nil,   nil,   nil,    24,   nil,   nil,    74,
     1269   nil,   nil,    76,    45,   nil,   nil,    22,    22,    22,    34,
     1270   nil,   nil,    25,    64,    22,    22,    22,    45,    89,    33,
     1271   nil,   nil,   nil,   nil,    23,   nil,   nil,   167,   nil,    47,
     1272    55,   nil,    28,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1273   nil,   nil,   nil,   nil,   nil,   nil,   nil,    47,   nil,    32,
     1274    74,   nil,   157,    25,   nil,   nil,   nil,   nil,   nil,   nil,
     1275   nil,    44,    31,   nil,   nil,   nil,   nil,   nil,     5,   nil,
     1276   nil,   nil,   nil,   nil,    45,   nil,   nil,   nil,   nil,   nil,
     1277   101,   nil,   nil,   153,    22,   nil,     4,   nil,   nil,   nil,
     1278    29,   nil,   nil,   nil,   nil,    53,   nil,   nil,   nil,   nil,
    11681279   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1169    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   640 ]
    1170 
    1171 racc_goto_check = [
    1172     45,     4,    31,    32,     5,    82,    29,    22,    23,    28,
    1173     47,    84,    67,    53,    25,   100,    55,     4,   152,    44,
    1174     73,    88,    64,    47,   156,    23,    83,    75,    83,    83,
    1175     48,    60,    34,    33,    10,   105,    85,   128,   153,    30,
    1176    155,    87,   137,    43,    25,    61,    82,    11,   117,    82,
    1177     82,   132,    97,    40,    51,   112,   134,   106,   115,   133,
    1178    151,    14,    14,    14,    14,   135,    29,    15,    15,   136,
    1179    112,    24,    24,   106,   138,    53,    12,    12,    13,    13,
    1180    139,   144,   145,   146,    31,   147,    24,   148,    32,   149,
    1181     22,   150,   157,   158,   160,   161,    28,   162,   163,   164,
    1182      1,    28,   165,     2,     8,    16,    17,    18,    19,    20,
    1183     26,    27,    37,    51,    23,   115,    39,    41,    42,    46,
    1184     49,    52,     6,    31,    54,    57,    59,    25,    62,    63,
    1185     65,    66,    79,    80,    81,    86,   100,    89,    90,    91,
    1186     22,    31,    92,    93,    22,    40,    94,   134,    95,    96,
    1187     98,    45,    83,   132,    99,   117,    45,    97,    29,   112,
    1188    151,   107,   151,   137,    22,   109,   110,   111,   113,    10,
    1189     10,    10,     6,   114,   112,    24,    25,    43,    30,    24,
    1190     45,    61,    45,   116,    11,   118,   120,    45,    34,    33,
    1191     24,   121,   122,   123,   124,   125,     6,   126,    87,   127,
    1192    129,   130,    64,   131,     5,   nil,   nil,   nil,     4,   nil,
    1193    nil,   nil,    34,    33,   nil,   nil,   nil,   nil,   nil,    25,
    1194     25,   nil,   nil,   nil,   nil,     4,   nil,    83,    28,   nil,
    1195      4,   155,   nil,   153,   128,   nil,   nil,   nil,    31,   nil,
    1196    nil,   nil,   nil,    45,    45,    84,     5,     4,     5,     5,
    1197    nil,   nil,   nil,   nil,   nil,     4,   nil,   nil,    25,    23,
    1198     53,   nil,    25,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1199    nil,   nil,   nil,    85,   nil,   nil,   nil,   nil,   nil,    47,
    1200    nil,    31,   105,   nil,    45,    29,    45,    45,   nil,    82,
    1201    nil,   nil,    60,    48,    10,   nil,    47,   nil,    73,   nil,
    1202    nil,   nil,   nil,   nil,   nil,    75,    64,   nil,    45,   nil,
    1203     22,    22,    22,    25,    88,   nil,    34,    33,    22,    22,
    1204     22,   nil,    45,    24,   nil,   nil,   nil,    24,   nil,   nil,
    1205    nil,   nil,    28,    23,   nil,   nil,   nil,   nil,    47,    55,
    1206    nil,   nil,     6,     6,     6,   nil,   nil,   nil,    73,   nil,
    1207      6,     6,     6,   nil,    25,    32,    47,   nil,   156,   nil,
    1208    nil,   nil,    44,   nil,   152,    31,   nil,   nil,   nil,   nil,
    1209    nil,   nil,     5,   nil,   nil,   nil,   nil,   nil,    45,   nil,
    1210    nil,   100,   nil,   nil,   nil,    22,   nil,   nil,   nil,    29,
    1211    nil,     4,   nil,   nil,   152,   nil,    53,   nil,   nil,   nil,
     1280   nil,   nil,   nil,    31,   153,    68,   nil,   nil,   nil,    31,
     1281    23,   nil,   nil,   nil,   nil,   nil,    23,     4,     4,    23,
     1282   nil,   nil,    45,    45,    55,   nil,    28,   nil,     6,    47,
     1283    84,   nil,     6,   nil,     4,   nil,     5,    45,   nil,   nil,
    12121284   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1213    nil,   nil,   nil,   nil,   nil,   nil,    31,    67,    83,   nil,
    1214    nil,   nil,    31,   nil,   nil,   nil,   nil,   nil,    23,   nil,
    1215      4,     4,    23,    28,   nil,    23,    45,    45,   nil,   nil,
    1216     55,   nil,   nil,   nil,   nil,   nil,    47,     5,   nil,   nil,
    1217    nil,    45,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1285   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    47,   nil,
     1286   nil,   nil,   nil,   nil,     4,    23,   nil,   nil,   nil,   nil,
     1287   nil,   nil,   nil,   nil,   nil,   nil,    25,   nil,   nil,   nil,
     1288   nil,   nil,   nil,   nil,    29,   nil,   nil,   nil,   nil,    22,
     1289   nil,   nil,   nil,    22,   nil,   nil,   nil,   nil,   nil,   nil,
    12181290   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1219    nil,   nil,   nil,   nil,    47,   nil,   nil,     4,   nil,   nil,
    1220    nil,    23,   nil,   nil,   nil,    25,   nil,   nil,   nil,   nil,
    1221     29,   nil,   nil,   nil,   nil,   nil,    22,   nil,   nil,   nil,
    1222     22,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1291   nil,   nil,   nil,   167,   nil,   nil,   nil,    23,   nil,    47,
     1292   nil,    85,   nil,   nil,   nil,    47,   nil,   nil,    45,   nil,
     1293   nil,   nil,    45,     6,   nil,   nil,   nil,     4,   nil,    45,
     1294   nil,   nil,   nil,   nil,    45,   nil,   nil,   nil,   nil,    23,
     1295   nil,   nil,   nil,   nil,    23,    32,   nil,   nil,   nil,   nil,
     1296     6,   nil,   nil,   nil,    23,   nil,   nil,   nil,   nil,   nil,
     1297   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    25,
     1298   nil,     6,   nil,    32,   nil,   nil,   nil,   nil,   nil,   nil,
     1299   nil,    45,   nil,   nil,    22,   nil,   nil,     4,     4,   nil,
     1300   nil,    47,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1301   nil,     6,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1302   nil,    22,   nil,   nil,   nil,   nil,   nil,     4,   nil,   nil,
     1303   nil,    32,    32,    83,   nil,   nil,   nil,   nil,   nil,   nil,
     1304   nil,    23,    22,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1305   nil,   nil,   nil,   nil,   nil,   nil,     5,   nil,    23,   nil,
    12231306   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1224    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,     6,    23,
    1225    nil,   nil,     6,    47,    84,   nil,   nil,   nil,   nil,    47,
    1226     45,   nil,   nil,   nil,    45,   nil,   nil,     4,   nil,   nil,
    1227    nil,    45,   nil,   nil,   nil,    45,   nil,   nil,   nil,   nil,
    1228    nil,    23,   nil,   nil,    32,   nil,    23,   nil,   nil,   nil,
    1229    nil,   nil,   nil,   nil,   nil,   nil,    23,   nil,   nil,    32,
    1230     22,   nil,   nil,   nil,   nil,    25,   nil,   nil,   nil,   nil,
    1231    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1232     45,   nil,   nil,    22,   nil,   nil,   nil,   nil,   nil,   nil,
    1233    nil,    47,     6,   nil,   nil,   nil,   nil,   nil,   nil,    32,
    1234     32,   nil,   nil,    22,    82,   nil,   nil,   nil,   nil,   nil,
    1235    nil,   nil,    23,     4,   nil,     6,   nil,   nil,     5,   nil,
    1236    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    23,   nil,
    1237    nil,   nil,   nil,    22,   nil,     6,   nil,    23,   nil,   nil,
    1238    nil,   nil,   nil,   nil,   nil,   nil,    32,   nil,   nil,   nil,
    1239    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    31,
    1240    nil,     4,   nil,    23,   nil,     6,   nil,   nil,   nil,   nil,
     1307    23,   nil,    22,   nil,   nil,    31,   nil,   nil,   nil,   nil,
     1308   nil,   nil,   nil,    32,   nil,   nil,   nil,   nil,     4,   nil,
     1309   nil,   nil,   nil,   nil,   nil,   nil,   nil,    23,   nil,   nil,
    12411310   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    12421311   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    12431312   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1244    nil,   nil,   nil,    23,   nil,   nil,     4,   nil,   nil,    23,
     1313   nil,   nil,   nil,   nil,   nil,   nil,   nil,    23,   nil,   nil,
     1314   nil,   nil,   nil,    23,   nil,     4,   nil,   nil,   nil,   nil,
     1315   nil,   nil,   nil,   nil,   nil,   nil,    45 ]
     1316
     1317racc_goto_pointer = [
     1318   nil,   104,   106,   nil,   -74,  -160,  -258,   nil,  -103,   nil,
     1319  -174,  -152,  -277,  -275,  -286,  -283,  -250,  -250,  -249,  -249,
     1320  -249,   nil,  -197,  -145,  -403,   -23,   112,  -126,  -136,   -78,
     1321    45,    -1,  -145,    38,    28,   nil,   nil,    83,   nil,    82,
     1322  -104,   -34,    84,  -200,  -231,    -2,  -131,   -95,  -225,  -393,
     1323   nil,   -36,  -129,   -73,    43,  -138,   nil,  -243,   nil,  -116,
     1324  -211,  -283,  -345,  -102,    32,   132,   134,   -24,   -39,   nil,
     1325   nil,   nil,   nil,   nil,  -304,   nil,  -301,   nil,   nil,   nil,
     1326   -24,   -25,   -27,  -118,  -386,  -158,  -129,  -302,  -483,   -96,
     1327    15,    77,   -35,    80,   -31,  -137,    83,   -29,  -125,  -386,
     1328  -135,  -173,   nil,   nil,   nil,   nil,  -264,  -481,  -535,   nil,
     1329  -138,  -463,  -274,  -379,  -373,  -582,  -698,  -257,  -382,  -365,
     1330   nil,  -254,  -364,  -363,  -653,   125,    63,  -247,  -110,  -518,
     1331  -517,  -447,  -563,  -592,  -562,  -659,   134,    19,  -134,  -349,
     1332  -237,   nil,   nil,   nil,   nil,  -282,  -377,  -240,  -375,  -636,
     1333  -570,  -687,  -601,  -450,  -423,   nil,   -31,  -170,   -78,   -79,
     1334   nil,   -48,   -98,   -97,  -794,  -796,  -784,  -135,  -234,  -370,
     1335  -622,   nil,   nil,  -634 ]
     1336
     1337racc_goto_default = [
     1338   nil,   nil,   nil,   209,   198,   206,   337,   210,   219,   211,
     1339   220,   nil,   221,   222,   223,   224,   225,   226,   227,   228,
     1340   229,   230,   231,   233,    67,     4,   nil,   245,    39,    40,
     1341   nil,   391,   nil,    97,    98,    11,    12,    37,    36,   nil,
     1342   nil,   nil,   nil,   252,   nil,   246,   nil,   nil,   nil,   390,
     1343    41,   nil,   158,    85,    86,   nil,   242,   243,   244,   nil,
     1344   nil,   nil,   477,   nil,   nil,   nil,   nil,    53,   nil,    55,
     1345    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
     1346   103,   nil,   nil,   nil,   nil,   628,   nil,   269,   nil,   nil,
     1347   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   296,
     1348   nil,   298,   299,   300,   301,   302,   nil,   nil,   627,   303,
    12451349   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1246    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    45 ]
    1247 
    1248 racc_goto_pointer = [
    1249    nil,   100,   103,   nil,   -73,  -158,  -163,   nil,  -103,   nil,
    1250   -172,  -155,  -268,  -268,  -287,  -285,  -249,  -249,  -249,  -249,
    1251   -249,   nil,  -195,  -138,  -367,   -26,   106,  -128,  -138,   -81,
    1252     35,    -2,  -141,    31,    30,   nil,   nil,    76,   nil,    78,
    1253   -100,   -35,    80,  -203,  -229,    -2,  -130,   -90,  -219,  -390,
    1254    nil,   -44,  -130,   -74,    41,  -131,   nil,  -241,   nil,  -115,
    1255   -210,  -289,  -340,  -100,    20,   128,   -27,   -41,   nil,   nil,
    1256    nil,   nil,   nil,  -304,   nil,  -297,   nil,   nil,   nil,   -27,
    1257    -28,   -30,  -119,  -378,  -150,  -128,  -302,  -479,  -104,    11,
    1258     67,   -43,    70,   -40,  -142,    75,   -35,  -132,  -388,  -138,
    1259   -174,   nil,   nil,   nil,   nil,  -257,  -483,  -523,   nil,  -133,
    1260   -453,  -271,  -383,  -377,  -563,  -678,  -256,  -391,  -364,   nil,
    1261   -256,  -361,  -360,  -617,   120,    59,  -246,  -109,  -516,  -353,
    1262   -439,  -538,  -589,  -494,  -648,   -10,  -120,  -147,  -481,  -233,
    1263    nil,   nil,   nil,   nil,  -232,  -371,  -237,  -370,  -622,  -559,
    1264   -659,  -590,  -439,  -418,   nil,   -36,  -166,   -75,   -77,   nil,
    1265    -47,   -96,   -94,  -753,  -755,  -741 ]
    1266 
    1267 racc_goto_default = [
    1268    nil,   nil,   nil,   204,   193,   201,   331,   205,   214,   206,
    1269    215,   nil,   216,   217,   218,   219,   220,   221,   222,   223,
    1270    224,   225,   226,   228,    66,     4,   nil,   240,    39,    40,
    1271    nil,   385,   nil,    95,    96,    11,    12,    37,    36,   nil,
    1272    nil,   nil,   nil,   247,   nil,   241,   nil,   nil,   nil,   384,
    1273     41,   nil,   155,    83,    84,   nil,   237,   238,   239,   nil,
    1274    nil,   nil,   469,   nil,   nil,   nil,    52,   nil,    54,    55,
    1275     56,    57,    58,    59,    60,    61,    62,    63,    64,   101,
    1276    nil,   nil,   nil,   nil,   617,   nil,   264,   nil,   nil,   nil,
    1277    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   291,   nil,
    1278    293,   294,   295,   296,   297,   nil,   nil,   616,   298,   nil,
    1279    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   304,
    1280    nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
    1281    nil,   641,   nil,   772,   nil,   nil,   nil,   nil,   312,   nil,
    1282    314,   315,   316,   317,   nil,   nil,   nil,   nil,   nil,   nil,
    1283    nil,   nil,   321,   nil,   113,   nil,   nil,   114,   nil,   460,
    1284    nil,   nil,   nil,   nil,   nil,   nil ]
     1350   309,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
     1351   nil,   nil,   652,   nil,   653,   nil,   nil,   nil,   nil,   317,
     1352   nil,   319,   320,   321,   322,   nil,   nil,   nil,   nil,   nil,
     1353   nil,   nil,   nil,   326,   nil,   115,   nil,   nil,   116,   nil,
     1354   466,   nil,   nil,   nil,   nil,   nil,   nil,   733,   735,   nil,
     1355   nil,   734,   736,   nil ]
    12851356
    12861357racc_reduce_table = [
    12871358  0, 0, :racc_error,
    1288   1, 141, :_reduce_none,
    1289   1, 143, :_reduce_2,
    1290   1, 143, :_reduce_3,
    1291   1, 143, :_reduce_4,
    1292   1, 143, :_reduce_5,
    1293   1, 143, :_reduce_6,
    1294   1, 143, :_reduce_7,
    1295   1, 143, :_reduce_8,
    1296   1, 143, :_reduce_9,
    1297   1, 143, :_reduce_10,
    1298   3, 143, :_reduce_11,
    1299   1, 145, :_reduce_none,
    1300   2, 145, :_reduce_13,
    1301   1, 147, :_reduce_none,
    1302   4, 147, :_reduce_15,
    1303   3, 147, :_reduce_16,
    1304   3, 147, :_reduce_17,
     1359  1, 142, :_reduce_none,
     1360  1, 144, :_reduce_2,
     1361  1, 144, :_reduce_3,
     1362  1, 144, :_reduce_4,
     1363  1, 144, :_reduce_5,
     1364  1, 144, :_reduce_6,
     1365  1, 144, :_reduce_7,
     1366  1, 144, :_reduce_8,
     1367  1, 144, :_reduce_9,
     1368  1, 144, :_reduce_10,
     1369  3, 144, :_reduce_11,
     1370  1, 146, :_reduce_none,
     1371  2, 146, :_reduce_13,
    13051372  1, 148, :_reduce_none,
    1306   2, 148, :_reduce_19,
    1307   2, 148, :_reduce_20,
    1308   4, 148, :_reduce_21,
    1309   1, 149, :_reduce_22,
    1310   1, 149, :_reduce_23,
    1311   1, 149, :_reduce_24,
    1312   1, 149, :_reduce_25,
    1313   1, 149, :_reduce_26,
    1314   1, 149, :_reduce_27,
    1315   1, 150, :_reduce_none,
    1316   4, 150, :_reduce_29,
    1317   1, 152, :_reduce_none,
    1318   3, 152, :_reduce_31,
    1319   3, 152, :_reduce_32,
    1320   3, 152, :_reduce_33,
     1373  4, 148, :_reduce_15,
     1374  3, 148, :_reduce_16,
     1375  3, 148, :_reduce_17,
     1376  1, 149, :_reduce_none,
     1377  2, 149, :_reduce_19,
     1378  2, 149, :_reduce_20,
     1379  4, 149, :_reduce_21,
     1380  1, 150, :_reduce_22,
     1381  1, 150, :_reduce_23,
     1382  1, 150, :_reduce_24,
     1383  1, 150, :_reduce_25,
     1384  1, 150, :_reduce_26,
     1385  1, 150, :_reduce_27,
     1386  1, 151, :_reduce_none,
     1387  4, 151, :_reduce_29,
    13211388  1, 153, :_reduce_none,
    1322   3, 153, :_reduce_35,
    1323   3, 153, :_reduce_36,
     1389  3, 153, :_reduce_31,
     1390  3, 153, :_reduce_32,
     1391  3, 153, :_reduce_33,
    13241392  1, 154, :_reduce_none,
    1325   3, 154, :_reduce_38,
    1326   3, 154, :_reduce_39,
     1393  3, 154, :_reduce_35,
     1394  3, 154, :_reduce_36,
    13271395  1, 155, :_reduce_none,
    1328   3, 155, :_reduce_41,
    1329   3, 155, :_reduce_42,
    1330   3, 155, :_reduce_43,
    1331   3, 155, :_reduce_44,
     1396  3, 155, :_reduce_38,
     1397  3, 155, :_reduce_39,
    13321398  1, 156, :_reduce_none,
    1333   3, 156, :_reduce_46,
    1334   3, 156, :_reduce_47,
     1399  3, 156, :_reduce_41,
     1400  3, 156, :_reduce_42,
     1401  3, 156, :_reduce_43,
     1402  3, 156, :_reduce_44,
    13351403  1, 157, :_reduce_none,
    1336   3, 157, :_reduce_49,
     1404  3, 157, :_reduce_46,
     1405  3, 157, :_reduce_47,
    13371406  1, 158, :_reduce_none,
    1338   3, 158, :_reduce_51,
     1407  3, 158, :_reduce_49,
    13391408  1, 159, :_reduce_none,
    1340   3, 159, :_reduce_53,
     1409  3, 159, :_reduce_51,
    13411410  1, 160, :_reduce_none,
    1342   3, 160, :_reduce_55,
     1411  3, 160, :_reduce_53,
    13431412  1, 161, :_reduce_none,
    1344   3, 161, :_reduce_57,
     1413  3, 161, :_reduce_55,
    13451414  1, 162, :_reduce_none,
    1346   5, 162, :_reduce_59,
    1347   1, 146, :_reduce_60,
    1348   1, 163, :_reduce_61,
    1349   3, 164, :_reduce_62,
    1350   1, 167, :_reduce_none,
    1351   2, 167, :_reduce_64,
    1352   1, 166, :_reduce_65,
    1353   3, 166, :_reduce_66,
    1354   1, 170, :_reduce_none,
    1355   3, 170, :_reduce_68,
    1356   1, 168, :_reduce_69,
    1357   1, 168, :_reduce_70,
    1358   1, 168, :_reduce_71,
     1415  3, 162, :_reduce_57,
     1416  1, 163, :_reduce_none,
     1417  5, 163, :_reduce_59,
     1418  1, 147, :_reduce_60,
     1419  1, 164, :_reduce_61,
     1420  3, 165, :_reduce_62,
    13591421  1, 168, :_reduce_none,
    1360   1, 168, :_reduce_none,
    1361   1, 168, :_reduce_74,
    1362   1, 168, :_reduce_none,
    1363   1, 168, :_reduce_none,
    1364   1, 168, :_reduce_77,
    1365   1, 168, :_reduce_78,
    1366   1, 168, :_reduce_79,
    1367   4, 168, :_reduce_80,
    1368   1, 176, :_reduce_81,
    1369   1, 176, :_reduce_82,
    1370   1, 176, :_reduce_83,
    1371   1, 177, :_reduce_84,
    1372   1, 177, :_reduce_85,
    1373   1, 177, :_reduce_86,
    1374   1, 177, :_reduce_87,
    1375   1, 177, :_reduce_88,
    1376   1, 177, :_reduce_89,
    1377   1, 177, :_reduce_90,
    1378   1, 177, :_reduce_91,
    1379   1, 177, :_reduce_92,
    1380   1, 177, :_reduce_93,
    1381   1, 177, :_reduce_94,
    1382   1, 177, :_reduce_95,
    1383   1, 177, :_reduce_96,
    1384   1, 177, :_reduce_97,
    1385   1, 178, :_reduce_98,
    1386   1, 178, :_reduce_99,
    1387   2, 175, :_reduce_100,
    1388   1, 175, :_reduce_none,
    1389   0, 181, :_reduce_102,
    1390   6, 173, :_reduce_103,
    1391   0, 182, :_reduce_104,
    1392   5, 173, :_reduce_105,
    1393   2, 173, :_reduce_106,
    1394   1, 180, :_reduce_none,
    1395   2, 180, :_reduce_none,
    1396   1, 179, :_reduce_109,
    1397   3, 183, :_reduce_110,
    1398   6, 183, :_reduce_111,
    1399   1, 186, :_reduce_112,
    1400   3, 186, :_reduce_113,
    1401   1, 188, :_reduce_114,
    1402   4, 188, :_reduce_115,
    1403   4, 188, :_reduce_116,
    1404   4, 188, :_reduce_117,
    1405   1, 165, :_reduce_none,
    1406   2, 165, :_reduce_119,
    1407   1, 184, :_reduce_120,
    1408   3, 184, :_reduce_121,
    1409   1, 189, :_reduce_none,
    1410   4, 174, :_reduce_none,
    1411   5, 174, :_reduce_none,
    1412   2, 174, :_reduce_none,
    1413   1, 190, :_reduce_126,
    1414   1, 190, :_reduce_127,
    1415   1, 190, :_reduce_128,
    1416   1, 190, :_reduce_129,
    1417   1, 190, :_reduce_130,
    1418   1, 190, :_reduce_131,
    1419   1, 191, :_reduce_none,
    1420   3, 191, :_reduce_none,
     1422  2, 168, :_reduce_64,
     1423  1, 167, :_reduce_65,
     1424  3, 167, :_reduce_66,
     1425  1, 171, :_reduce_none,
     1426  3, 171, :_reduce_68,
     1427  1, 169, :_reduce_69,
     1428  1, 169, :_reduce_70,
     1429  1, 169, :_reduce_71,
     1430  1, 169, :_reduce_none,
     1431  1, 169, :_reduce_none,
     1432  1, 169, :_reduce_74,
     1433  1, 169, :_reduce_none,
     1434  1, 169, :_reduce_none,
     1435  1, 169, :_reduce_77,
     1436  1, 169, :_reduce_78,
     1437  1, 169, :_reduce_79,
     1438  4, 169, :_reduce_80,
     1439  1, 177, :_reduce_81,
     1440  1, 177, :_reduce_82,
     1441  1, 177, :_reduce_83,
     1442  1, 178, :_reduce_84,
     1443  1, 178, :_reduce_85,
     1444  1, 178, :_reduce_86,
     1445  1, 178, :_reduce_87,
     1446  1, 178, :_reduce_88,
     1447  1, 178, :_reduce_89,
     1448  1, 178, :_reduce_90,
     1449  1, 178, :_reduce_91,
     1450  1, 178, :_reduce_92,
     1451  1, 178, :_reduce_93,
     1452  1, 178, :_reduce_94,
     1453  1, 178, :_reduce_95,
     1454  1, 178, :_reduce_96,
     1455  1, 178, :_reduce_97,
     1456  1, 179, :_reduce_98,
     1457  1, 179, :_reduce_99,
     1458  2, 176, :_reduce_100,
     1459  1, 176, :_reduce_none,
     1460  0, 182, :_reduce_102,
     1461  6, 174, :_reduce_103,
     1462  0, 183, :_reduce_104,
     1463  5, 174, :_reduce_105,
     1464  2, 174, :_reduce_106,
     1465  1, 181, :_reduce_none,
     1466  2, 181, :_reduce_none,
     1467  1, 180, :_reduce_109,
     1468  3, 184, :_reduce_110,
     1469  6, 184, :_reduce_111,
     1470  1, 187, :_reduce_112,
     1471  3, 187, :_reduce_113,
     1472  1, 189, :_reduce_114,
     1473  4, 189, :_reduce_115,
     1474  4, 189, :_reduce_116,
     1475  4, 189, :_reduce_117,
     1476  1, 166, :_reduce_none,
     1477  2, 166, :_reduce_119,
     1478  1, 185, :_reduce_120,
     1479  3, 185, :_reduce_121,
     1480  1, 190, :_reduce_none,
     1481  4, 175, :_reduce_none,
     1482  5, 175, :_reduce_none,
     1483  2, 175, :_reduce_none,
     1484  1, 191, :_reduce_126,
     1485  1, 191, :_reduce_127,
     1486  1, 191, :_reduce_128,
     1487  1, 191, :_reduce_129,
     1488  1, 191, :_reduce_130,
     1489  1, 191, :_reduce_131,
    14211490  1, 192, :_reduce_none,
    14221491  3, 192, :_reduce_none,
    1423   1, 169, :_reduce_136,
    1424   1, 169, :_reduce_137,
    1425   2, 171, :_reduce_138,
    1426   1, 171, :_reduce_none,
    1427   1, 194, :_reduce_140,
    1428   3, 194, :_reduce_141,
    1429   4, 194, :_reduce_142,
    1430   3, 194, :_reduce_143,
    1431   4, 194, :_reduce_144,
    1432   3, 194, :_reduce_145,
    1433   1, 193, :_reduce_146,
    1434   2, 193, :_reduce_147,
    1435   2, 193, :_reduce_148,
    1436   3, 193, :_reduce_149,
    1437   1, 195, :_reduce_none,
    1438   3, 195, :_reduce_none,
    1439   1, 196, :_reduce_152,
    1440   3, 196, :_reduce_153,
    1441   3, 197, :_reduce_154,
    1442   2, 197, :_reduce_155,
    1443   1, 197, :_reduce_156,
    1444   2, 197, :_reduce_157,
    1445   3, 198, :_reduce_158,
    1446   1, 199, :_reduce_159,
    1447   3, 199, :_reduce_160,
    1448   1, 200, :_reduce_161,
    1449   1, 200, :_reduce_162,
    1450   1, 200, :_reduce_163,
    1451   4, 200, :_reduce_164,
    1452   4, 200, :_reduce_165,
    1453   1, 200, :_reduce_166,
    1454   4, 200, :_reduce_167,
    1455   4, 200, :_reduce_168,
    1456   6, 200, :_reduce_169,
    1457   4, 200, :_reduce_170,
    1458   1, 200, :_reduce_171,
    1459   1, 151, :_reduce_none,
    1460   2, 151, :_reduce_173,
    1461   1, 201, :_reduce_none,
    1462   1, 201, :_reduce_none,
    1463   2, 201, :_reduce_none,
    1464   3, 202, :_reduce_177,
    1465   2, 202, :_reduce_178,
    1466   3, 202, :_reduce_179,
    1467   3, 202, :_reduce_180,
    1468   4, 202, :_reduce_181,
    1469   2, 202, :_reduce_182,
    1470   3, 202, :_reduce_none,
    1471   3, 202, :_reduce_184,
    1472   4, 202, :_reduce_185,
    1473   1, 172, :_reduce_186,
    1474   3, 172, :_reduce_187,
    1475   4, 172, :_reduce_188,
    1476   4, 172, :_reduce_189,
    1477   1, 203, :_reduce_190,
    1478   3, 203, :_reduce_191,
    1479   2, 142, :_reduce_none,
    1480   2, 142, :_reduce_none,
    1481   0, 142, :_reduce_none,
    1482   1, 204, :_reduce_none,
    1483   4, 204, :_reduce_196,
    1484   1, 206, :_reduce_none,
    1485   1, 206, :_reduce_none,
    1486   1, 206, :_reduce_none,
    1487   1, 206, :_reduce_none,
    1488   1, 206, :_reduce_none,
    1489   1, 206, :_reduce_none,
    1490   1, 206, :_reduce_none,
    1491   2, 206, :_reduce_none,
    1492   2, 206, :_reduce_none,
    1493   1, 206, :_reduce_none,
    1494   1, 206, :_reduce_none,
    1495   1, 206, :_reduce_none,
    1496   1, 206, :_reduce_none,
    1497   1, 206, :_reduce_none,
    1498   1, 207, :_reduce_211,
    1499   3, 207, :_reduce_212,
    1500   4, 219, :_reduce_213,
    1501   1, 219, :_reduce_214,
    1502   4, 219, :_reduce_215,
    1503   1, 219, :_reduce_216,
    1504   4, 219, :_reduce_217,
    1505   1, 219, :_reduce_218,
    1506   4, 219, :_reduce_219,
    1507   1, 219, :_reduce_220,
    1508   1, 219, :_reduce_221,
    1509   1, 219, :_reduce_222,
    1510   6, 219, :_reduce_223,
    1511   1, 220, :_reduce_224,
    1512   3, 220, :_reduce_225,
    1513   7, 224, :_reduce_226,
    1514   10, 224, :_reduce_227,
    1515   1, 221, :_reduce_228,
    1516   3, 221, :_reduce_229,
    1517   5, 225, :_reduce_230,
    1518   7, 225, :_reduce_231,
    1519   1, 227, :_reduce_232,
    1520   3, 227, :_reduce_233,
    1521   1, 209, :_reduce_234,
    1522   5, 217, :_reduce_235,
    1523   7, 217, :_reduce_236,
    1524   5, 216, :_reduce_237,
    1525   5, 216, :_reduce_238,
    1526   9, 218, :_reduce_239,
    1527   4, 208, :_reduce_240,
    1528   7, 208, :_reduce_241,
    1529   1, 229, :_reduce_none,
    1530   4, 229, :_reduce_none,
    1531   1, 228, :_reduce_244,
    1532   3, 228, :_reduce_245,
    1533   6, 210, :_reduce_246,
    1534   1, 230, :_reduce_247,
     1492  1, 193, :_reduce_none,
     1493  3, 193, :_reduce_none,
     1494  1, 170, :_reduce_136,
     1495  1, 170, :_reduce_137,
     1496  2, 172, :_reduce_138,
     1497  1, 172, :_reduce_none,
     1498  1, 195, :_reduce_140,
     1499  3, 195, :_reduce_141,
     1500  4, 195, :_reduce_142,
     1501  3, 195, :_reduce_143,
     1502  4, 195, :_reduce_144,
     1503  3, 195, :_reduce_145,
     1504  1, 194, :_reduce_146,
     1505  2, 194, :_reduce_147,
     1506  2, 194, :_reduce_148,
     1507  3, 194, :_reduce_149,
     1508  1, 196, :_reduce_none,
     1509  3, 196, :_reduce_none,
     1510  1, 197, :_reduce_152,
     1511  3, 197, :_reduce_153,
     1512  3, 198, :_reduce_154,
     1513  2, 198, :_reduce_155,
     1514  1, 198, :_reduce_156,
     1515  2, 198, :_reduce_157,
     1516  3, 199, :_reduce_158,
     1517  1, 200, :_reduce_159,
     1518  3, 200, :_reduce_160,
     1519  1, 201, :_reduce_161,
     1520  1, 201, :_reduce_162,
     1521  1, 201, :_reduce_163,
     1522  4, 201, :_reduce_164,
     1523  4, 201, :_reduce_165,
     1524  1, 201, :_reduce_166,
     1525  4, 201, :_reduce_167,
     1526  4, 201, :_reduce_168,
     1527  6, 201, :_reduce_169,
     1528  4, 201, :_reduce_170,
     1529  1, 201, :_reduce_171,
     1530  1, 152, :_reduce_none,
     1531  2, 152, :_reduce_173,
     1532  1, 202, :_reduce_none,
     1533  1, 202, :_reduce_none,
     1534  2, 202, :_reduce_none,
     1535  3, 203, :_reduce_177,
     1536  2, 203, :_reduce_178,
     1537  3, 203, :_reduce_179,
     1538  3, 203, :_reduce_180,
     1539  4, 203, :_reduce_181,
     1540  2, 203, :_reduce_182,
     1541  3, 203, :_reduce_none,
     1542  3, 203, :_reduce_184,
     1543  4, 203, :_reduce_185,
     1544  1, 173, :_reduce_186,
     1545  3, 173, :_reduce_187,
     1546  4, 173, :_reduce_188,
     1547  4, 173, :_reduce_189,
     1548  1, 204, :_reduce_190,
     1549  3, 204, :_reduce_191,
     1550  2, 143, :_reduce_none,
     1551  2, 143, :_reduce_none,
     1552  2, 143, :_reduce_none,
     1553  0, 143, :_reduce_none,
     1554  1, 205, :_reduce_none,
     1555  4, 205, :_reduce_197,
     1556  1, 208, :_reduce_none,
     1557  1, 208, :_reduce_none,
     1558  1, 208, :_reduce_none,
     1559  1, 208, :_reduce_none,
     1560  1, 208, :_reduce_none,
     1561  1, 208, :_reduce_none,
     1562  1, 208, :_reduce_none,
     1563  2, 208, :_reduce_none,
     1564  2, 208, :_reduce_none,
     1565  1, 208, :_reduce_none,
     1566  1, 208, :_reduce_none,
     1567  1, 208, :_reduce_none,
     1568  1, 208, :_reduce_none,
     1569  1, 208, :_reduce_none,
     1570  1, 209, :_reduce_212,
     1571  3, 209, :_reduce_213,
     1572  4, 221, :_reduce_214,
     1573  1, 221, :_reduce_215,
     1574  4, 221, :_reduce_216,
     1575  1, 221, :_reduce_217,
     1576  4, 221, :_reduce_218,
     1577  1, 221, :_reduce_219,
     1578  4, 221, :_reduce_220,
     1579  1, 221, :_reduce_221,
     1580  1, 221, :_reduce_222,
     1581  1, 221, :_reduce_223,
     1582  6, 221, :_reduce_224,
     1583  1, 222, :_reduce_225,
     1584  3, 222, :_reduce_226,
     1585  7, 226, :_reduce_227,
     1586  10, 226, :_reduce_228,
     1587  1, 223, :_reduce_229,
     1588  3, 223, :_reduce_230,
     1589  5, 227, :_reduce_231,
     1590  7, 227, :_reduce_232,
     1591  1, 229, :_reduce_233,
     1592  3, 229, :_reduce_234,
     1593  1, 211, :_reduce_235,
     1594  5, 219, :_reduce_236,
     1595  7, 219, :_reduce_237,
     1596  5, 218, :_reduce_238,
     1597  5, 218, :_reduce_239,
     1598  9, 220, :_reduce_240,
     1599  4, 210, :_reduce_241,
     1600  7, 210, :_reduce_242,
    15351601  1, 231, :_reduce_none,
    1536   2, 231, :_reduce_none,
    1537   1, 144, :_reduce_250,
    1538   2, 144, :_reduce_251,
    1539   3, 144, :_reduce_252,
    1540   6, 211, :_reduce_253,
    1541   1, 232, :_reduce_254,
    1542   0, 233, :_reduce_255,
    1543   2, 233, :_reduce_256,
    1544   3, 234, :_reduce_257,
    1545   6, 234, :_reduce_258,
    1546   6, 212, :_reduce_259,
    1547   1, 235, :_reduce_260,
    1548   1, 236, :_reduce_none,
    1549   2, 236, :_reduce_none,
    1550   1, 237, :_reduce_263,
    1551   4, 237, :_reduce_264,
     1602  4, 231, :_reduce_none,
     1603  1, 230, :_reduce_245,
     1604  3, 230, :_reduce_246,
     1605  6, 212, :_reduce_247,
     1606  1, 232, :_reduce_248,
     1607  1, 233, :_reduce_none,
     1608  2, 233, :_reduce_none,
     1609  1, 145, :_reduce_251,
     1610  2, 145, :_reduce_252,
     1611  3, 145, :_reduce_253,
     1612  6, 213, :_reduce_254,
     1613  1, 234, :_reduce_255,
     1614  0, 235, :_reduce_256,
     1615  2, 235, :_reduce_257,
     1616  3, 236, :_reduce_258,
     1617  6, 236, :_reduce_259,
     1618  6, 214, :_reduce_260,
     1619  1, 237, :_reduce_261,
    15521620  1, 238, :_reduce_none,
    1553   1, 238, :_reduce_none,
    1554   1, 238, :_reduce_none,
    1555   1, 238, :_reduce_none,
    1556   1, 238, :_reduce_none,
    1557   1, 239, :_reduce_270,
    1558   3, 239, :_reduce_271,
    1559   1, 245, :_reduce_272,
    1560   4, 245, :_reduce_273,
    1561   1, 245, :_reduce_274,
    1562   1, 245, :_reduce_275,
    1563   1, 245, :_reduce_276,
    1564   1, 245, :_reduce_277,
    1565   1, 246, :_reduce_278,
    1566   1, 246, :_reduce_279,
    1567   3, 246, :_reduce_280,
    1568   3, 246, :_reduce_281,
    1569   5, 247, :_reduce_282,
    1570   5, 247, :_reduce_283,
    1571   4, 240, :_reduce_284,
    1572   6, 240, :_reduce_285,
    1573   7, 240, :_reduce_286,
    1574   8, 240, :_reduce_287,
    1575   1, 248, :_reduce_288,
    1576   1, 248, :_reduce_289,
    1577   1, 249, :_reduce_290,
    1578   1, 226, :_reduce_none,
    1579   1, 250, :_reduce_none,
    1580   5, 241, :_reduce_293,
    1581   1, 251, :_reduce_294,
    1582   2, 251, :_reduce_295,
    1583   1, 252, :_reduce_296,
    1584   4, 252, :_reduce_297,
    1585   1, 253, :_reduce_298,
    1586   4, 253, :_reduce_299,
    1587   5, 253, :_reduce_300,
    1588   3, 254, :_reduce_301,
    1589   1, 254, :_reduce_302,
    1590   1, 255, :_reduce_none,
    1591   5, 242, :_reduce_304,
    1592   1, 256, :_reduce_305,
    1593   2, 256, :_reduce_306,
    1594   1, 257, :_reduce_307,
    1595   4, 257, :_reduce_308,
    1596   4, 258, :_reduce_309,
    1597   5, 243, :_reduce_310,
    1598   7, 243, :_reduce_311,
    1599   5, 244, :_reduce_none,
    1600   1, 259, :_reduce_313,
    1601   1, 259, :_reduce_314,
    1602   0, 260, :_reduce_none,
    1603   2, 260, :_reduce_none,
    1604   7, 261, :_reduce_317,
    1605   9, 261, :_reduce_318,
    1606   1, 262, :_reduce_none,
    1607   1, 263, :_reduce_320,
    1608   3, 263, :_reduce_321,
    1609   1, 263, :_reduce_322,
    1610   3, 263, :_reduce_323,
    1611   0, 267, :_reduce_324,
    1612   8, 213, :_reduce_325,
    1613   4, 213, :_reduce_326,
    1614   1, 264, :_reduce_327,
    1615   1, 265, :_reduce_328,
    1616   0, 266, :_reduce_none,
    1617   2, 266, :_reduce_none,
    1618   2, 266, :_reduce_none,
    1619   4, 268, :_reduce_332,
    1620   1, 268, :_reduce_333,
    1621   3, 270, :_reduce_334,
    1622   1, 270, :_reduce_335,
    1623   6, 272, :_reduce_336,
    1624   1, 222, :_reduce_337,
    1625   1, 223, :_reduce_none,
    1626   6, 271, :_reduce_339,
    1627   7, 271, :_reduce_340,
    1628   4, 271, :_reduce_341,
    1629   6, 271, :_reduce_342,
    1630   1, 273, :_reduce_none,
    1631   6, 269, :_reduce_344,
    1632   9, 269, :_reduce_345,
    1633   9, 269, :_reduce_346,
    1634   12, 269, :_reduce_347,
    1635   1, 274, :_reduce_none,
    1636   6, 214, :_reduce_349,
    1637   1, 275, :_reduce_350,
     1621  2, 238, :_reduce_none,
     1622  1, 239, :_reduce_264,
     1623  4, 239, :_reduce_265,
     1624  1, 240, :_reduce_none,
     1625  1, 240, :_reduce_none,
     1626  1, 240, :_reduce_none,
     1627  1, 240, :_reduce_none,
     1628  1, 240, :_reduce_none,
     1629  1, 241, :_reduce_271,
     1630  3, 241, :_reduce_272,
     1631  1, 247, :_reduce_273,
     1632  4, 247, :_reduce_274,
     1633  1, 247, :_reduce_275,
     1634  1, 247, :_reduce_276,
     1635  1, 247, :_reduce_277,
     1636  1, 247, :_reduce_278,
     1637  1, 248, :_reduce_279,
     1638  1, 248, :_reduce_280,
     1639  3, 248, :_reduce_281,
     1640  3, 248, :_reduce_282,
     1641  5, 249, :_reduce_283,
     1642  5, 249, :_reduce_284,
     1643  4, 242, :_reduce_285,
     1644  6, 242, :_reduce_286,
     1645  7, 242, :_reduce_287,
     1646  8, 242, :_reduce_288,
     1647  1, 250, :_reduce_289,
     1648  1, 250, :_reduce_290,
     1649  1, 251, :_reduce_291,
     1650  1, 228, :_reduce_none,
     1651  1, 252, :_reduce_none,
     1652  5, 243, :_reduce_294,
     1653  1, 253, :_reduce_295,
     1654  2, 253, :_reduce_296,
     1655  1, 254, :_reduce_297,
     1656  4, 254, :_reduce_298,
     1657  1, 255, :_reduce_299,
     1658  4, 255, :_reduce_300,
     1659  5, 255, :_reduce_301,
     1660  3, 256, :_reduce_302,
     1661  1, 256, :_reduce_303,
     1662  1, 257, :_reduce_none,
     1663  5, 244, :_reduce_305,
     1664  1, 258, :_reduce_306,
     1665  2, 258, :_reduce_307,
     1666  1, 259, :_reduce_308,
     1667  4, 259, :_reduce_309,
     1668  4, 260, :_reduce_310,
     1669  5, 245, :_reduce_311,
     1670  7, 245, :_reduce_312,
     1671  5, 246, :_reduce_none,
     1672  1, 261, :_reduce_314,
     1673  1, 261, :_reduce_315,
     1674  0, 262, :_reduce_none,
     1675  2, 262, :_reduce_none,
     1676  7, 263, :_reduce_318,
     1677  9, 263, :_reduce_319,
     1678  1, 264, :_reduce_none,
     1679  1, 265, :_reduce_321,
     1680  3, 265, :_reduce_322,
     1681  1, 265, :_reduce_323,
     1682  3, 265, :_reduce_324,
     1683  0, 269, :_reduce_325,
     1684  8, 215, :_reduce_326,
     1685  4, 215, :_reduce_327,
     1686  1, 266, :_reduce_328,
     1687  1, 267, :_reduce_329,
     1688  0, 268, :_reduce_none,
     1689  2, 268, :_reduce_none,
     1690  2, 268, :_reduce_none,
     1691  4, 270, :_reduce_333,
     1692  1, 270, :_reduce_334,
     1693  3, 272, :_reduce_335,
     1694  1, 272, :_reduce_336,
     1695  6, 274, :_reduce_337,
     1696  1, 224, :_reduce_338,
     1697  1, 225, :_reduce_none,
     1698  6, 273, :_reduce_340,
     1699  7, 273, :_reduce_341,
     1700  4, 273, :_reduce_342,
     1701  6, 273, :_reduce_343,
     1702  1, 275, :_reduce_none,
     1703  6, 271, :_reduce_345,
     1704  9, 271, :_reduce_346,
     1705  9, 271, :_reduce_347,
     1706  12, 271, :_reduce_348,
    16381707  1, 276, :_reduce_none,
    1639   2, 276, :_reduce_none,
    1640   1, 277, :_reduce_353,
    1641   4, 277, :_reduce_354,
     1708  6, 216, :_reduce_350,
     1709  1, 277, :_reduce_351,
    16421710  1, 278, :_reduce_none,
    1643   1, 278, :_reduce_none,
    1644   1, 278, :_reduce_none,
    1645   1, 278, :_reduce_none,
    1646   1, 279, :_reduce_359,
    1647   4, 284, :_reduce_360,
    1648   1, 284, :_reduce_361,
    1649   1, 284, :_reduce_362,
    1650   1, 284, :_reduce_363,
    1651   1, 284, :_reduce_364,
    1652   1, 280, :_reduce_365,
    1653   5, 281, :_reduce_366,
    1654   1, 285, :_reduce_367,
    1655   2, 285, :_reduce_368,
    1656   0, 289, :_reduce_369,
    1657   8, 282, :_reduce_370,
    1658   4, 282, :_reduce_371,
    1659   1, 286, :_reduce_372,
    1660   1, 287, :_reduce_373,
    1661   0, 288, :_reduce_none,
    1662   2, 288, :_reduce_none,
    1663   2, 288, :_reduce_none,
    1664   6, 290, :_reduce_377,
    1665   4, 290, :_reduce_378,
    1666   6, 283, :_reduce_379,
    1667   8, 283, :_reduce_380,
    1668   1, 292, :_reduce_none,
     1711  2, 278, :_reduce_none,
     1712  1, 279, :_reduce_354,
     1713  4, 279, :_reduce_355,
     1714  1, 280, :_reduce_none,
     1715  1, 280, :_reduce_none,
     1716  1, 280, :_reduce_none,
     1717  1, 280, :_reduce_none,
     1718  1, 281, :_reduce_360,
     1719  3, 281, :_reduce_361,
     1720  4, 286, :_reduce_362,
     1721  1, 286, :_reduce_363,
     1722  1, 286, :_reduce_364,
     1723  1, 286, :_reduce_365,
     1724  1, 286, :_reduce_366,
     1725  1, 282, :_reduce_367,
     1726  5, 283, :_reduce_368,
     1727  1, 287, :_reduce_369,
     1728  2, 287, :_reduce_370,
     1729  0, 291, :_reduce_371,
     1730  8, 284, :_reduce_372,
     1731  4, 284, :_reduce_373,
     1732  1, 288, :_reduce_374,
     1733  1, 289, :_reduce_375,
     1734  0, 290, :_reduce_none,
     1735  2, 290, :_reduce_none,
     1736  2, 290, :_reduce_none,
     1737  2, 290, :_reduce_none,
     1738  6, 292, :_reduce_380,
     1739  4, 292, :_reduce_381,
     1740  6, 285, :_reduce_382,
     1741  8, 285, :_reduce_383,
     1742  1, 294, :_reduce_none,
     1743  1, 295, :_reduce_none,
    16691744  1, 293, :_reduce_none,
    1670   1, 291, :_reduce_none,
    1671   9, 215, :_reduce_384,
    1672   6, 215, :_reduce_385,
    1673   1, 294, :_reduce_none,
    1674   3, 294, :_reduce_none,
    1675   6, 297, :_reduce_388,
    1676   3, 297, :_reduce_389,
    1677   6, 297, :_reduce_390,
    1678   3, 297, :_reduce_391,
    1679   8, 297, :_reduce_392,
    1680   4, 297, :_reduce_393,
    1681   1, 297, :_reduce_394,
    1682   1, 297, :_reduce_395,
    1683   6, 297, :_reduce_396,
    1684   4, 297, :_reduce_397,
    1685   1, 295, :_reduce_398,
    1686   0, 296, :_reduce_none,
    1687   2, 296, :_reduce_none,
    1688   2, 296, :_reduce_none,
    1689   1, 299, :_reduce_none,
    1690   4, 299, :_reduce_403,
    1691   1, 298, :_reduce_404,
    1692   1, 185, :_reduce_405,
    1693   1, 187, :_reduce_406,
    1694   4, 205, :_reduce_none,
    1695   2, 300, :_reduce_none,
    1696   2, 300, :_reduce_none,
    1697   0, 300, :_reduce_none,
    1698   14, 301, :_reduce_411,
    1699   2, 303, :_reduce_412,
    1700   0, 303, :_reduce_413,
    1701   6, 304, :_reduce_414,
    1702   13, 302, :_reduce_415,
    1703   5, 305, :_reduce_416,
    1704   0, 305, :_reduce_417 ]
    1705 
    1706 racc_reduce_n = 418
    1707 
    1708 racc_shift_n = 870
     1745  9, 217, :_reduce_387,
     1746  6, 217, :_reduce_388,
     1747  1, 296, :_reduce_none,
     1748  3, 296, :_reduce_none,
     1749  6, 299, :_reduce_391,
     1750  3, 299, :_reduce_392,
     1751  6, 299, :_reduce_393,
     1752  3, 299, :_reduce_394,
     1753  8, 299, :_reduce_395,
     1754  4, 299, :_reduce_396,
     1755  1, 299, :_reduce_397,
     1756  1, 299, :_reduce_398,
     1757  6, 299, :_reduce_399,
     1758  4, 299, :_reduce_400,
     1759  1, 297, :_reduce_401,
     1760  0, 298, :_reduce_none,
     1761  2, 298, :_reduce_none,
     1762  2, 298, :_reduce_none,
     1763  1, 301, :_reduce_none,
     1764  4, 301, :_reduce_406,
     1765  1, 300, :_reduce_407,
     1766  1, 186, :_reduce_408,
     1767  1, 188, :_reduce_409,
     1768  4, 206, :_reduce_none,
     1769  2, 302, :_reduce_none,
     1770  2, 302, :_reduce_none,
     1771  0, 302, :_reduce_none,
     1772  14, 303, :_reduce_414,
     1773  2, 305, :_reduce_415,
     1774  0, 305, :_reduce_416,
     1775  6, 306, :_reduce_417,
     1776  13, 304, :_reduce_418,
     1777  5, 307, :_reduce_419,
     1778  0, 307, :_reduce_420,
     1779  5, 207, :_reduce_421,
     1780  3, 309, :_reduce_422,
     1781  3, 310, :_reduce_423,
     1782  5, 310, :_reduce_424,
     1783  1, 311, :_reduce_none,
     1784  1, 311, :_reduce_none,
     1785  1, 311, :_reduce_none,
     1786  1, 311, :_reduce_none,
     1787  1, 311, :_reduce_429,
     1788  1, 311, :_reduce_430,
     1789  3, 313, :_reduce_431,
     1790  2, 313, :_reduce_432,
     1791  1, 314, :_reduce_433,
     1792  3, 314, :_reduce_434,
     1793  1, 308, :_reduce_435,
     1794  1, 312, :_reduce_436,
     1795  1, 312, :_reduce_437,
     1796  2, 312, :_reduce_438,
     1797  2, 312, :_reduce_439,
     1798  2, 312, :_reduce_440,
     1799  2, 312, :_reduce_441 ]
     1800
     1801racc_reduce_n = 442
     1802
     1803racc_shift_n = 911
    17091804
    17101805racc_token_table = {
     
    18481943  :__LOCATION_INFORMATION__ => 137,
    18491944  :__CELL__ => 138,
    1850   :__JOIN__ => 139 }
    1851 
    1852 racc_nt_base = 140
     1945  :__JOIN__ => 139,
     1946  :TOOL_INFO => 140 }
     1947
     1948racc_nt_base = 141
    18531949
    18541950racc_use_result_var = true
     
    20112107  "__CELL__",
    20122108  "__JOIN__",
     2109  "TOOL_INFO",
    20132110  "$start",
    20142111  "all",
     
    20772174  "specified_statement",
    20782175  "location_information",
     2176  "tool_info",
    20792177  "statement",
    20802178  "statement_specifier_list",
     
    20892187  "import",
    20902188  "import_C",
    2091   "signature_plugin",
     2189  "generate_statement",
    20922190  "statement_specifier",
    20932191  "alloc_list",
     
    21762274  "port_location_list",
    21772275  "port_location",
    2178   "bar_list" ]
     2276  "bar_list",
     2277  "JSON_string",
     2278  "JSON_object",
     2279  "JSON_property_list",
     2280  "JSON_value",
     2281  "JSON_number",
     2282  "JSON_array",
     2283  "JSON_array_list" ]
    21792284
    21802285Racc_debug_parser = false
     
    28382943module_eval(<<'.,.,', 'bnf.y.rb', 379)
    28392944  def _reduce_104(val, _values, result)
    2840                         result = StructType.new()
     2945                        # tag が無い場合、内部名を与える
     2946                        result = StructType.new( :"TAG__#{@@no_struct_tag_num}__" )
     2947                        @@no_struct_tag_num += 1
    28412948                        StructType.set_define( true )
    28422949               
     
    28452952.,.,
    28462953
    2847 module_eval(<<'.,.,', 'bnf.y.rb', 384)
     2954module_eval(<<'.,.,', 'bnf.y.rb', 386)
    28482955  def _reduce_105(val, _values, result)
    28492956                        StructType.end_of_parse
     
    28542961.,.,
    28552962
    2856 module_eval(<<'.,.,', 'bnf.y.rb', 389)
     2963module_eval(<<'.,.,', 'bnf.y.rb', 391)
    28572964  def _reduce_106(val, _values, result)
    28582965                        StructType.set_define( false )
     
    28682975# reduce 108 omitted
    28692976
    2870 module_eval(<<'.,.,', 'bnf.y.rb', 400)
     2977module_eval(<<'.,.,', 'bnf.y.rb', 402)
    28712978  def _reduce_109(val, _values, result)
    28722979     result = StructType.new( val[0].val )
     
    28752982.,.,
    28762983
    2877 module_eval(<<'.,.,', 'bnf.y.rb', 406)
     2984module_eval(<<'.,.,', 'bnf.y.rb', 408)
    28782985  def _reduce_110(val, _values, result)
    28792986                        val[1].each { |i|       # i: Decl
     
    28892996.,.,
    28902997
    2891 module_eval(<<'.,.,', 'bnf.y.rb', 416)
     2998module_eval(<<'.,.,', 'bnf.y.rb', 418)
    28922999  def _reduce_111(val, _values, result)
    28933000                        val[4].each { |i|       # i: Decl
     
    29043011.,.,
    29053012
    2906 module_eval(<<'.,.,', 'bnf.y.rb', 427)
     3013module_eval(<<'.,.,', 'bnf.y.rb', 429)
    29073014  def _reduce_112(val, _values, result)
    29083015     result = [ val[0] ]
     
    29113018.,.,
    29123019
    2913 module_eval(<<'.,.,', 'bnf.y.rb', 428)
     3020module_eval(<<'.,.,', 'bnf.y.rb', 430)
    29143021  def _reduce_113(val, _values, result)
    29153022     result <<  val[2]
     
    29183025.,.,
    29193026
    2920 module_eval(<<'.,.,', 'bnf.y.rb', 431)
     3027module_eval(<<'.,.,', 'bnf.y.rb', 433)
    29213028  def _reduce_114(val, _values, result)
    29223029     result = [:STRING,-1]
     
    29253032.,.,
    29263033
    2927 module_eval(<<'.,.,', 'bnf.y.rb', 432)
     3034module_eval(<<'.,.,', 'bnf.y.rb', 434)
    29283035  def _reduce_115(val, _values, result)
    29293036     result = [:STRING,val[2]]
     
    29323039.,.,
    29333040
    2934 module_eval(<<'.,.,', 'bnf.y.rb', 433)
     3041module_eval(<<'.,.,', 'bnf.y.rb', 435)
    29353042  def _reduce_116(val, _values, result)
    29363043     result = [:SIZE_IS,val[2]]
     
    29393046.,.,
    29403047
    2941 module_eval(<<'.,.,', 'bnf.y.rb', 434)
     3048module_eval(<<'.,.,', 'bnf.y.rb', 436)
    29423049  def _reduce_117(val, _values, result)
    29433050     result = [:COUNT_IS,val[2]]
     
    29483055# reduce 118 omitted
    29493056
    2950 module_eval(<<'.,.,', 'bnf.y.rb', 445)
     3057module_eval(<<'.,.,', 'bnf.y.rb', 447)
    29513058  def _reduce_119(val, _values, result)
    29523059                        val[1].set_qualifier( val[0] )
     
    29573064.,.,
    29583065
    2959 module_eval(<<'.,.,', 'bnf.y.rb', 454)
     3066module_eval(<<'.,.,', 'bnf.y.rb', 456)
    29603067  def _reduce_120(val, _values, result)
    29613068     result = [ val[0] ]
     
    29643071.,.,
    29653072
    2966 module_eval(<<'.,.,', 'bnf.y.rb', 456)
     3073module_eval(<<'.,.,', 'bnf.y.rb', 458)
    29673074  def _reduce_121(val, _values, result)
    29683075     result << val[2]
     
    29793086# reduce 125 omitted
    29803087
    2981 module_eval(<<'.,.,', 'bnf.y.rb', 469)
     3088module_eval(<<'.,.,', 'bnf.y.rb', 471)
    29823089  def _reduce_126(val, _values, result)
    29833090     result = EnumType.new( -1 )
     
    29863093.,.,
    29873094
    2988 module_eval(<<'.,.,', 'bnf.y.rb', 470)
     3095module_eval(<<'.,.,', 'bnf.y.rb', 472)
    29893096  def _reduce_127(val, _values, result)
    29903097     result = EnumType.new( 8 )
     
    29933100.,.,
    29943101
    2995 module_eval(<<'.,.,', 'bnf.y.rb', 471)
     3102module_eval(<<'.,.,', 'bnf.y.rb', 473)
    29963103  def _reduce_128(val, _values, result)
    29973104     result = EnumType.new( 16 )
     
    30003107.,.,
    30013108
    3002 module_eval(<<'.,.,', 'bnf.y.rb', 472)
     3109module_eval(<<'.,.,', 'bnf.y.rb', 474)
    30033110  def _reduce_129(val, _values, result)
    30043111     result = EnumType.new( 32 )
     
    30073114.,.,
    30083115
    3009 module_eval(<<'.,.,', 'bnf.y.rb', 473)
     3116module_eval(<<'.,.,', 'bnf.y.rb', 475)
    30103117  def _reduce_130(val, _values, result)
    30113118     result = EnumType.new( 64 )
     
    30143121.,.,
    30153122
    3016 module_eval(<<'.,.,', 'bnf.y.rb', 474)
     3123module_eval(<<'.,.,', 'bnf.y.rb', 476)
    30173124  def _reduce_131(val, _values, result)
    30183125     result = EnumType.new( 128 )
     
    30293136# reduce 135 omitted
    30303137
    3031 module_eval(<<'.,.,', 'bnf.y.rb', 485)
     3138module_eval(<<'.,.,', 'bnf.y.rb', 487)
    30323139  def _reduce_136(val, _values, result)
    30333140     result = :CONST
     
    30363143.,.,
    30373144
    3038 module_eval(<<'.,.,', 'bnf.y.rb', 486)
     3145module_eval(<<'.,.,', 'bnf.y.rb', 488)
    30393146  def _reduce_137(val, _values, result)
    30403147     result = :VOLATILE
     
    30433150.,.,
    30443151
    3045 module_eval(<<'.,.,', 'bnf.y.rb', 491)
     3152module_eval(<<'.,.,', 'bnf.y.rb', 493)
    30463153  def _reduce_138(val, _values, result)
    30473154                        val[1].set_type( val[0] )
     
    30543161# reduce 139 omitted
    30553162
    3056 module_eval(<<'.,.,', 'bnf.y.rb', 498)
     3163module_eval(<<'.,.,', 'bnf.y.rb', 500)
    30573164  def _reduce_140(val, _values, result)
    30583165     result = Decl.new( val[0].val )
     
    30613168.,.,
    30623169
    3063 module_eval(<<'.,.,', 'bnf.y.rb', 500)
     3170module_eval(<<'.,.,', 'bnf.y.rb', 502)
    30643171  def _reduce_141(val, _values, result)
    30653172     result = val[1]
     
    30683175.,.,
    30693176
    3070 module_eval(<<'.,.,', 'bnf.y.rb', 503)
     3177module_eval(<<'.,.,', 'bnf.y.rb', 505)
    30713178  def _reduce_142(val, _values, result)
    30723179                        val[0].set_type( ArrayType.new( val[2] ) )
     
    30773184.,.,
    30783185
    3079 module_eval(<<'.,.,', 'bnf.y.rb', 508)
     3186module_eval(<<'.,.,', 'bnf.y.rb', 510)
    30803187  def _reduce_143(val, _values, result)
    30813188                        val[0].set_type( ArrayType.new )
     
    30863193.,.,
    30873194
    3088 module_eval(<<'.,.,', 'bnf.y.rb', 513)
     3195module_eval(<<'.,.,', 'bnf.y.rb', 515)
    30893196  def _reduce_144(val, _values, result)
    30903197                        val[0].set_type( FuncType.new( val[2] ) )
     
    30953202.,.,
    30963203
    3097 module_eval(<<'.,.,', 'bnf.y.rb', 519)
     3204module_eval(<<'.,.,', 'bnf.y.rb', 521)
    30983205  def _reduce_145(val, _values, result)
    30993206                        Generator.warning( "W5010 need 'void' for no parameter"  )
     
    31053212.,.,
    31063213
    3107 module_eval(<<'.,.,', 'bnf.y.rb', 526)
     3214module_eval(<<'.,.,', 'bnf.y.rb', 528)
    31083215  def _reduce_146(val, _values, result)
    31093216     result = PtrType.new
     
    31123219.,.,
    31133220
    3114 module_eval(<<'.,.,', 'bnf.y.rb', 529)
     3221module_eval(<<'.,.,', 'bnf.y.rb', 531)
    31153222  def _reduce_147(val, _values, result)
    31163223                        result = PtrType.new
     
    31213228.,.,
    31223229
    3123 module_eval(<<'.,.,', 'bnf.y.rb', 534)
     3230module_eval(<<'.,.,', 'bnf.y.rb', 536)
    31243231  def _reduce_148(val, _values, result)
    31253232                        val[1].set_type(PtrType.new)
     
    31303237.,.,
    31313238
    3132 module_eval(<<'.,.,', 'bnf.y.rb', 539)
     3239module_eval(<<'.,.,', 'bnf.y.rb', 541)
    31333240  def _reduce_149(val, _values, result)
    31343241                        ptrtype = PtrType.new
     
    31453252# reduce 151 omitted
    31463253
    3147 module_eval(<<'.,.,', 'bnf.y.rb', 553)
     3254module_eval(<<'.,.,', 'bnf.y.rb', 555)
    31483255  def _reduce_152(val, _values, result)
    31493256     result = ParamList.new( val[0] )
     
    31523259.,.,
    31533260
    3154 module_eval(<<'.,.,', 'bnf.y.rb', 556)
     3261module_eval(<<'.,.,', 'bnf.y.rb', 558)
    31553262  def _reduce_153(val, _values, result)
    31563263                        val[0].add_param( val[2] )
     
    31613268.,.,
    31623269
    3163 module_eval(<<'.,.,', 'bnf.y.rb', 566)
     3270module_eval(<<'.,.,', 'bnf.y.rb', 568)
    31643271  def _reduce_154(val, _values, result)
    31653272                        val[2].set_kind( :PARAMETER )
     
    31723279.,.,
    31733280
    3174 module_eval(<<'.,.,', 'bnf.y.rb', 575)
     3281module_eval(<<'.,.,', 'bnf.y.rb', 577)
    31753282  def _reduce_155(val, _values, result)
    31763283                        Generator.error( "G1001 need specifier for \'$1\'" , val[1].get_name )
     
    31813288.,.,
    31823289
    3183 module_eval(<<'.,.,', 'bnf.y.rb', 580)
     3290module_eval(<<'.,.,', 'bnf.y.rb', 582)
    31843291  def _reduce_156(val, _values, result)
    31853292                        unless val[0].instance_of?( VoidType ) then
     
    31923299.,.,
    31933300
    3194 module_eval(<<'.,.,', 'bnf.y.rb', 588)
     3301module_eval(<<'.,.,', 'bnf.y.rb', 590)
    31953302  def _reduce_157(val, _values, result)
    31963303                        unless val[1].instance_of?( VoidType ) then
     
    32033310.,.,
    32043311
    3205 module_eval(<<'.,.,', 'bnf.y.rb', 595)
     3312module_eval(<<'.,.,', 'bnf.y.rb', 597)
    32063313  def _reduce_158(val, _values, result)
    32073314     result = val[1]
     
    32103317.,.,
    32113318
    3212 module_eval(<<'.,.,', 'bnf.y.rb', 599)
     3319module_eval(<<'.,.,', 'bnf.y.rb', 601)
    32133320  def _reduce_159(val, _values, result)
    32143321     result = val[0]
     
    32173324.,.,
    32183325
    3219 module_eval(<<'.,.,', 'bnf.y.rb', 601)
     3326module_eval(<<'.,.,', 'bnf.y.rb', 603)
    32203327  def _reduce_160(val, _values, result)
    32213328     result = result + val[2]
     
    32243331.,.,
    32253332
    3226 module_eval(<<'.,.,', 'bnf.y.rb', 604)
     3333module_eval(<<'.,.,', 'bnf.y.rb', 606)
    32273334  def _reduce_161(val, _values, result)
    32283335     result = [ [:IN]  ]
     
    32313338.,.,
    32323339
    3233 module_eval(<<'.,.,', 'bnf.y.rb', 605)
     3340module_eval(<<'.,.,', 'bnf.y.rb', 607)
    32343341  def _reduce_162(val, _values, result)
    32353342     result = [ [:OUT] ]
     
    32383345.,.,
    32393346
    3240 module_eval(<<'.,.,', 'bnf.y.rb', 606)
     3347module_eval(<<'.,.,', 'bnf.y.rb', 608)
    32413348  def _reduce_163(val, _values, result)
    32423349     result = [ [:INOUT] ]
     
    32453352.,.,
    32463353
    3247 module_eval(<<'.,.,', 'bnf.y.rb', 607)
     3354module_eval(<<'.,.,', 'bnf.y.rb', 609)
    32483355  def _reduce_164(val, _values, result)
    32493356     result = [ [:SEND,   val[2]] ]
     
    32523359.,.,
    32533360
    3254 module_eval(<<'.,.,', 'bnf.y.rb', 608)
     3361module_eval(<<'.,.,', 'bnf.y.rb', 610)
    32553362  def _reduce_165(val, _values, result)
    32563363     result = [ [:RECEIVE,val[2]] ]
     
    32593366.,.,
    32603367
    3261 module_eval(<<'.,.,', 'bnf.y.rb', 609)
     3368module_eval(<<'.,.,', 'bnf.y.rb', 611)
    32623369  def _reduce_166(val, _values, result)
    32633370     result = [ [:STRING,nil] ]
     
    32663373.,.,
    32673374
    3268 module_eval(<<'.,.,', 'bnf.y.rb', 610)
     3375module_eval(<<'.,.,', 'bnf.y.rb', 612)
    32693376  def _reduce_167(val, _values, result)
    32703377     result = [ [:STRING,  val[2]] ]
     
    32733380.,.,
    32743381
    3275 module_eval(<<'.,.,', 'bnf.y.rb', 611)
     3382module_eval(<<'.,.,', 'bnf.y.rb', 613)
    32763383  def _reduce_168(val, _values, result)
    32773384     result = [ [:SIZE_IS, val[2]] ]
     
    32803387.,.,
    32813388
    3282 module_eval(<<'.,.,', 'bnf.y.rb', 614)
     3389module_eval(<<'.,.,', 'bnf.y.rb', 616)
    32833390  def _reduce_169(val, _values, result)
    32843391                        result = [ [:SIZE_IS,val[2]], [:MAX_IS, val[4]] ]
     
    32883395.,.,
    32893396
    3290 module_eval(<<'.,.,', 'bnf.y.rb', 616)
     3397module_eval(<<'.,.,', 'bnf.y.rb', 618)
    32913398  def _reduce_170(val, _values, result)
    32923399     result = [ [:COUNT_IS,val[2]] ]
     
    32953402.,.,
    32963403
    3297 module_eval(<<'.,.,', 'bnf.y.rb', 617)
     3404module_eval(<<'.,.,', 'bnf.y.rb', 619)
    32983405  def _reduce_171(val, _values, result)
    32993406     result = [ [:NULLABLE] ]
     
    33043411# reduce 172 omitted
    33053412
    3306 module_eval(<<'.,.,', 'bnf.y.rb', 623)
     3413module_eval(<<'.,.,', 'bnf.y.rb', 625)
    33073414  def _reduce_173(val, _values, result)
    33083415                        if val[1] then
     
    33243431# reduce 176 omitted
    33253432
    3326 module_eval(<<'.,.,', 'bnf.y.rb', 640)
     3433module_eval(<<'.,.,', 'bnf.y.rb', 642)
    33273434  def _reduce_177(val, _values, result)
    33283435     result = val[1]
     
    33313438.,.,
    33323439
    3333 module_eval(<<'.,.,', 'bnf.y.rb', 643)
     3440module_eval(<<'.,.,', 'bnf.y.rb', 645)
    33343441  def _reduce_178(val, _values, result)
    33353442                        Generator.error( "G1004 impossible array type"  )
     
    33403447.,.,
    33413448
    3342 module_eval(<<'.,.,', 'bnf.y.rb', 648)
     3449module_eval(<<'.,.,', 'bnf.y.rb', 650)
    33433450  def _reduce_179(val, _values, result)
    33443451                        Generator.error( "G1005 impossible array type"  )
     
    33493456.,.,
    33503457
    3351 module_eval(<<'.,.,', 'bnf.y.rb', 653)
     3458module_eval(<<'.,.,', 'bnf.y.rb', 655)
    33523459  def _reduce_180(val, _values, result)
    33533460                        Generator.error( "G1006 impossible array type"  )
     
    33583465.,.,
    33593466
    3360 module_eval(<<'.,.,', 'bnf.y.rb', 658)
     3467module_eval(<<'.,.,', 'bnf.y.rb', 660)
    33613468  def _reduce_181(val, _values, result)
    33623469                        Generator.error( "G1007 impossible array type"  )
     
    33673474.,.,
    33683475
    3369 module_eval(<<'.,.,', 'bnf.y.rb', 663)
     3476module_eval(<<'.,.,', 'bnf.y.rb', 665)
    33703477  def _reduce_182(val, _values, result)
    33713478                        Generator.error( "G1008 impossible function type"  )
     
    33783485# reduce 183 omitted
    33793486
    3380 module_eval(<<'.,.,', 'bnf.y.rb', 669)
     3487module_eval(<<'.,.,', 'bnf.y.rb', 671)
    33813488  def _reduce_184(val, _values, result)
    33823489                        Generator.warning( "W5011 need 'void' for no parameter"  )
     
    33883495.,.,
    33893496
    3390 module_eval(<<'.,.,', 'bnf.y.rb', 675)
     3497module_eval(<<'.,.,', 'bnf.y.rb', 677)
    33913498  def _reduce_185(val, _values, result)
    33923499                        val[0].set_type( FuncType.new( val[2] ) )
     
    33973504.,.,
    33983505
    3399 module_eval(<<'.,.,', 'bnf.y.rb', 682)
     3506module_eval(<<'.,.,', 'bnf.y.rb', 684)
    34003507  def _reduce_186(val, _values, result)
    34013508     result = val[0]
     
    34043511.,.,
    34053512
    3406 module_eval(<<'.,.,', 'bnf.y.rb', 684)
     3513module_eval(<<'.,.,', 'bnf.y.rb', 686)
    34073514  def _reduce_187(val, _values, result)
    34083515     result = val[1]
     
    34113518.,.,
    34123519
    3413 module_eval(<<'.,.,', 'bnf.y.rb', 686)
     3520module_eval(<<'.,.,', 'bnf.y.rb', 688)
    34143521  def _reduce_188(val, _values, result)
    34153522     result = val[1]
     
    34183525.,.,
    34193526
    3420 module_eval(<<'.,.,', 'bnf.y.rb', 689)
     3527module_eval(<<'.,.,', 'bnf.y.rb', 691)
    34213528  def _reduce_189(val, _values, result)
    34223529     result = C_EXP.new( val[2] )
     
    34253532.,.,
    34263533
    3427 module_eval(<<'.,.,', 'bnf.y.rb', 694)
     3534module_eval(<<'.,.,', 'bnf.y.rb', 696)
    34283535  def _reduce_190(val, _values, result)
    34293536                        result = [ val[0] ]
     
    34333540.,.,
    34343541
    3435 module_eval(<<'.,.,', 'bnf.y.rb', 698)
     3542module_eval(<<'.,.,', 'bnf.y.rb', 700)
    34363543  def _reduce_191(val, _values, result)
    34373544                        val[0] << val[2]
     
    34503557# reduce 195 omitted
    34513558
    3452 module_eval(<<'.,.,', 'bnf.y.rb', 716)
    3453   def _reduce_196(val, _values, result)
     3559# reduce 196 omitted
     3560
     3561module_eval(<<'.,.,', 'bnf.y.rb', 719)
     3562  def _reduce_197(val, _values, result)
    34543563                        obj = val[3]
    34553564                        if obj.kind_of?( Cell ) || obj.kind_of?( Signature ) || obj.kind_of?( Celltype ) || obj.kind_of?( CompositeCelltype )then
     
    34643573.,.,
    34653574
    3466 # reduce 197 omitted
    3467 
    34683575# reduce 198 omitted
    34693576
     
    34923599# reduce 210 omitted
    34933600
    3494 module_eval(<<'.,.,', 'bnf.y.rb', 745)
    3495   def _reduce_211(val, _values, result)
     3601# reduce 211 omitted
     3602
     3603module_eval(<<'.,.,', 'bnf.y.rb', 748)
     3604  def _reduce_212(val, _values, result)
    34963605     Generator.add_statement_specifier val[0]   
    34973606    result
     
    34993608.,.,
    35003609
    3501 module_eval(<<'.,.,', 'bnf.y.rb', 747)
    3502   def _reduce_212(val, _values, result)
     3610module_eval(<<'.,.,', 'bnf.y.rb', 750)
     3611  def _reduce_213(val, _values, result)
    35033612     Generator.add_statement_specifier val[2]
    35043613    result
     
    35063615.,.,
    35073616
    3508 module_eval(<<'.,.,', 'bnf.y.rb', 751)
    3509   def _reduce_213(val, _values, result)
     3617module_eval(<<'.,.,', 'bnf.y.rb', 754)
     3618  def _reduce_214(val, _values, result)
    35103619     result = [ :ALLOCATOR, val[2] ]
    35113620    result
     
    35133622.,.,
    35143623
    3515 module_eval(<<'.,.,', 'bnf.y.rb', 753)
    3516   def _reduce_214(val, _values, result)
     3624module_eval(<<'.,.,', 'bnf.y.rb', 756)
     3625  def _reduce_215(val, _values, result)
    35173626     result = [ :CALLBACK ]
    35183627    result
     
    35203629.,.,
    35213630
    3522 module_eval(<<'.,.,', 'bnf.y.rb', 755)
    3523   def _reduce_215(val, _values, result)
     3631module_eval(<<'.,.,', 'bnf.y.rb', 758)
     3632  def _reduce_216(val, _values, result)
    35243633     result = [ :CONTEXT, val[2].val ]
    35253634    result
     
    35273636.,.,
    35283637
    3529 module_eval(<<'.,.,', 'bnf.y.rb', 757)
    3530   def _reduce_216(val, _values, result)
     3638module_eval(<<'.,.,', 'bnf.y.rb', 760)
     3639  def _reduce_217(val, _values, result)
    35313640     result = [ :DEVIATE ]
    35323641    result
     
    35343643.,.,
    35353644
    3536 module_eval(<<'.,.,', 'bnf.y.rb', 759)
    3537   def _reduce_217(val, _values, result)
     3645module_eval(<<'.,.,', 'bnf.y.rb', 762)
     3646  def _reduce_218(val, _values, result)
    35383647     result = [ :ID, val[2] ]
    35393648    result
     
    35413650.,.,
    35423651
    3543 module_eval(<<'.,.,', 'bnf.y.rb', 761)
    3544   def _reduce_218(val, _values, result)
     3652module_eval(<<'.,.,', 'bnf.y.rb', 764)
     3653  def _reduce_219(val, _values, result)
    35453654     result = [ :PROTOTYPE ]
    35463655    result
     
    35483657.,.,
    35493658
    3550 module_eval(<<'.,.,', 'bnf.y.rb', 763)
    3551   def _reduce_219(val, _values, result)
     3659module_eval(<<'.,.,', 'bnf.y.rb', 766)
     3660  def _reduce_220(val, _values, result)
    35523661     result = [ :RESTRICT, val[2] ]
    35533662    result
     
    35553664.,.,
    35563665
    3557 module_eval(<<'.,.,', 'bnf.y.rb', 764)
    3558   def _reduce_220(val, _values, result)
     3666module_eval(<<'.,.,', 'bnf.y.rb', 767)
     3667  def _reduce_221(val, _values, result)
    35593668     result = [:SINGLETON]
    35603669    result
     
    35623671.,.,
    35633672
    3564 module_eval(<<'.,.,', 'bnf.y.rb', 765)
    3565   def _reduce_221(val, _values, result)
     3673module_eval(<<'.,.,', 'bnf.y.rb', 768)
     3674  def _reduce_222(val, _values, result)
    35663675     result = [:IDX_IS_ID]
    35673676    result
     
    35693678.,.,
    35703679
    3571 module_eval(<<'.,.,', 'bnf.y.rb', 766)
    3572   def _reduce_222(val, _values, result)
     3680module_eval(<<'.,.,', 'bnf.y.rb', 769)
     3681  def _reduce_223(val, _values, result)
    35733682     result = [:ACTIVE]
    3574     result
    3575   end
    3576 .,.,
    3577 
    3578 module_eval(<<'.,.,', 'bnf.y.rb', 768)
    3579   def _reduce_223(val, _values, result)
    3580      result = [:GENERATE, val[2].val, val[4].val]
    35813683    result
    35823684  end
     
    35853687module_eval(<<'.,.,', 'bnf.y.rb', 771)
    35863688  def _reduce_224(val, _values, result)
     3689     result = [:GENERATE, val[2].val, val[4].val]
     3690    result
     3691  end
     3692.,.,
     3693
     3694module_eval(<<'.,.,', 'bnf.y.rb', 774)
     3695  def _reduce_225(val, _values, result)
    35873696     result = [ val[0] ]
    35883697    result
     
    35903699.,.,
    35913700
    3592 module_eval(<<'.,.,', 'bnf.y.rb', 772)
    3593   def _reduce_225(val, _values, result)
     3701module_eval(<<'.,.,', 'bnf.y.rb', 775)
     3702  def _reduce_226(val, _values, result)
    35943703     result << val[2]
    35953704    result
     
    35973706.,.,
    35983707
    3599 module_eval(<<'.,.,', 'bnf.y.rb', 776)
    3600   def _reduce_226(val, _values, result)
     3708module_eval(<<'.,.,', 'bnf.y.rb', 779)
     3709  def _reduce_227(val, _values, result)
    36013710      result = [ :NORMAL_ALLOC, val[0], nil, val[2], val[4], val[6] ]
    36023711    result
     
    36043713.,.,
    36053714
    3606 module_eval(<<'.,.,', 'bnf.y.rb', 778)
    3607   def _reduce_227(val, _values, result)
     3715module_eval(<<'.,.,', 'bnf.y.rb', 781)
     3716  def _reduce_228(val, _values, result)
    36083717      result = [ :NORMAL_ALLOC, val[0], val[2], val[5], val[7], val[9] ]
    36093718    result
     
    36113720.,.,
    36123721
    3613 module_eval(<<'.,.,', 'bnf.y.rb', 787)
    3614   def _reduce_228(val, _values, result)
     3722module_eval(<<'.,.,', 'bnf.y.rb', 790)
     3723  def _reduce_229(val, _values, result)
    36153724        result = [val[0]]               
    36163725    result
     
    36183727.,.,
    36193728
    3620 module_eval(<<'.,.,', 'bnf.y.rb', 789)
    3621   def _reduce_229(val, _values, result)
     3729module_eval(<<'.,.,', 'bnf.y.rb', 792)
     3730  def _reduce_230(val, _values, result)
    36223731        result << val[2]               
    36233732    result
     
    36253734.,.,
    36263735
    3627 module_eval(<<'.,.,', 'bnf.y.rb', 793)
    3628   def _reduce_230(val, _values, result)
     3736module_eval(<<'.,.,', 'bnf.y.rb', 796)
     3737  def _reduce_231(val, _values, result)
    36293738        result = [ val[0].val, nil, val[3] ]           
    36303739    result
     
    36323741.,.,
    36333742
    3634 module_eval(<<'.,.,', 'bnf.y.rb', 795)
    3635   def _reduce_231(val, _values, result)
     3743module_eval(<<'.,.,', 'bnf.y.rb', 798)
     3744  def _reduce_232(val, _values, result)
    36363745        result = [ val[0].val, val[2].val, val[5] ]             
    36373746    result
     
    36393748.,.,
    36403749
    3641 module_eval(<<'.,.,', 'bnf.y.rb', 799)
    3642   def _reduce_232(val, _values, result)
    3643         result = [val[0].val]           
    3644     result
    3645   end
    3646 .,.,
    3647 
    3648 module_eval(<<'.,.,', 'bnf.y.rb', 801)
     3750module_eval(<<'.,.,', 'bnf.y.rb', 802)
    36493751  def _reduce_233(val, _values, result)
    3650         result << val[2].val           
    3651     result
    3652   end
    3653 .,.,
    3654 
    3655 module_eval(<<'.,.,', 'bnf.y.rb', 806)
     3752        result = [val[0]]               
     3753    result
     3754  end
     3755.,.,
     3756
     3757module_eval(<<'.,.,', 'bnf.y.rb', 804)
    36563758  def _reduce_234(val, _values, result)
     3759        result << val[2]               
     3760    result
     3761  end
     3762.,.,
     3763
     3764module_eval(<<'.,.,', 'bnf.y.rb', 809)
     3765  def _reduce_235(val, _values, result)
    36573766                        val[0].each { |decl|
    36583767                                decl.set_kind( :CONSTANT )
     
    36653774.,.,
    36663775
    3667 module_eval(<<'.,.,', 'bnf.y.rb', 816)
    3668   def _reduce_235(val, _values, result)
     3776module_eval(<<'.,.,', 'bnf.y.rb', 819)
     3777  def _reduce_236(val, _values, result)
    36693778                        @@import_C = true
    36703779                        Import_C.new( val[2] )
     
    36753784.,.,
    36763785
    3677 module_eval(<<'.,.,', 'bnf.y.rb', 822)
    3678   def _reduce_236(val, _values, result)
     3786module_eval(<<'.,.,', 'bnf.y.rb', 825)
     3787  def _reduce_237(val, _values, result)
    36793788                        @@import_C = true
    36803789                        Import_C.new( val[2], val[4] )
     
    36853794.,.,
    36863795
    3687 module_eval(<<'.,.,', 'bnf.y.rb', 829)
    3688   def _reduce_237(val, _values, result)
     3796module_eval(<<'.,.,', 'bnf.y.rb', 832)
     3797  def _reduce_238(val, _values, result)
    36893798     Import.new( val[2] )
    36903799    result
     
    36923801.,.,
    36933802
    3694 module_eval(<<'.,.,', 'bnf.y.rb', 831)
    3695   def _reduce_238(val, _values, result)
     3803module_eval(<<'.,.,', 'bnf.y.rb', 834)
     3804  def _reduce_239(val, _values, result)
    36963805     Import.new( val[2], true )
    36973806    result
     
    36993808.,.,
    37003809
    3701 module_eval(<<'.,.,', 'bnf.y.rb', 836)
    3702   def _reduce_239(val, _values, result)
     3810module_eval(<<'.,.,', 'bnf.y.rb', 839)
     3811  def _reduce_240(val, _values, result)
    37033812     Generate.new( val[2].val, val[4], val[6] )
    37043813    result
     
    37063815.,.,
    37073816
    3708 module_eval(<<'.,.,', 'bnf.y.rb', 841)
    3709   def _reduce_240(val, _values, result)
     3817module_eval(<<'.,.,', 'bnf.y.rb', 844)
     3818  def _reduce_241(val, _values, result)
    37103819                        val[2].each{ |i|       # i:Decl
    37113820                                i.set_kind( :TYPEDEF )
     
    37203829.,.,
    37213830
    3722 module_eval(<<'.,.,', 'bnf.y.rb', 851)
    3723   def _reduce_241(val, _values, result)
     3831module_eval(<<'.,.,', 'bnf.y.rb', 854)
     3832  def _reduce_242(val, _values, result)
    37243833                        val[5].each{ |i|       # i:Decl
    37253834                                i.set_kind( :TYPEDEF )
     
    37343843.,.,
    37353844
    3736 # reduce 242 omitted
    3737 
    37383845# reduce 243 omitted
    37393846
    3740 module_eval(<<'.,.,', 'bnf.y.rb', 868)
    3741   def _reduce_244(val, _values, result)
     3847# reduce 244 omitted
     3848
     3849module_eval(<<'.,.,', 'bnf.y.rb', 871)
     3850  def _reduce_245(val, _values, result)
    37423851     result = [ val[0] ]
    37433852    result
     
    37453854.,.,
    37463855
    3747 module_eval(<<'.,.,', 'bnf.y.rb', 870)
    3748   def _reduce_245(val, _values, result)
     3856module_eval(<<'.,.,', 'bnf.y.rb', 873)
     3857  def _reduce_246(val, _values, result)
    37493858     result << val[2]
    37503859    result
     
    37523861.,.,
    37533862
    3754 module_eval(<<'.,.,', 'bnf.y.rb', 874)
    3755   def _reduce_246(val, _values, result)
     3863module_eval(<<'.,.,', 'bnf.y.rb', 877)
     3864  def _reduce_247(val, _values, result)
    37563865    val[1].end_of_parse
    37573866    result
     
    37593868.,.,
    37603869
    3761 module_eval(<<'.,.,', 'bnf.y.rb', 878)
    3762   def _reduce_247(val, _values, result)
     3870module_eval(<<'.,.,', 'bnf.y.rb', 881)
     3871  def _reduce_248(val, _values, result)
    37633872    result = Namespace.new(val[0].val)
    37643873    result
     
    37663875.,.,
    37673876
    3768 # reduce 248 omitted
    3769 
    37703877# reduce 249 omitted
    37713878
    3772 module_eval(<<'.,.,', 'bnf.y.rb', 886)
    3773   def _reduce_250(val, _values, result)
     3879# reduce 250 omitted
     3880
     3881module_eval(<<'.,.,', 'bnf.y.rb', 889)
     3882  def _reduce_251(val, _values, result)
    37743883     result = NamespacePath.new( val[0].val, false )
    37753884    result
     
    37773886.,.,
    37783887
    3779 module_eval(<<'.,.,', 'bnf.y.rb', 887)
    3780   def _reduce_251(val, _values, result)
     3888module_eval(<<'.,.,', 'bnf.y.rb', 890)
     3889  def _reduce_252(val, _values, result)
    37813890     result = NamespacePath.new( val[1].val, true )
    37823891    result
     
    37843893.,.,
    37853894
    3786 module_eval(<<'.,.,', 'bnf.y.rb', 889)
    3787   def _reduce_252(val, _values, result)
     3895module_eval(<<'.,.,', 'bnf.y.rb', 892)
     3896  def _reduce_253(val, _values, result)
    37883897     result = val[0].append!( val[2].val )
    37893898    result
     
    37913900.,.,
    37923901
    3793 module_eval(<<'.,.,', 'bnf.y.rb', 894)
    3794   def _reduce_253(val, _values, result)
     3902module_eval(<<'.,.,', 'bnf.y.rb', 897)
     3903  def _reduce_254(val, _values, result)
    37953904     result = val[1].end_of_parse( val[3] )
    37963905    result
     
    37983907.,.,
    37993908
    3800 module_eval(<<'.,.,', 'bnf.y.rb', 898)
    3801   def _reduce_254(val, _values, result)
     3909module_eval(<<'.,.,', 'bnf.y.rb', 901)
     3910  def _reduce_255(val, _values, result)
    38023911    result = Signature.new( val[0].val )
    38033912    result
     
    38053914.,.,
    38063915
    3807 module_eval(<<'.,.,', 'bnf.y.rb', 904)
    3808   def _reduce_255(val, _values, result)
     3916module_eval(<<'.,.,', 'bnf.y.rb', 907)
     3917  def _reduce_256(val, _values, result)
    38093918     result = NamedList.new( nil, "function" )
    38103919    result
     
    38123921.,.,
    38133922
    3814 module_eval(<<'.,.,', 'bnf.y.rb', 906)
    3815   def _reduce_256(val, _values, result)
     3923module_eval(<<'.,.,', 'bnf.y.rb', 909)
     3924  def _reduce_257(val, _values, result)
    38163925     result = val[0].add_item( val[1] )
    38173926    result
     
    38193928.,.,
    38203929
    3821 module_eval(<<'.,.,', 'bnf.y.rb', 911)
    3822   def _reduce_257(val, _values, result)
     3930module_eval(<<'.,.,', 'bnf.y.rb', 914)
     3931  def _reduce_258(val, _values, result)
    38233932                        # val[1]: Decl
    38243933                        if val[1].is_function? then
     
    38363945.,.,
    38373946
    3838 module_eval(<<'.,.,', 'bnf.y.rb', 924)
    3839   def _reduce_258(val, _values, result)
     3947module_eval(<<'.,.,', 'bnf.y.rb', 927)
     3948  def _reduce_259(val, _values, result)
    38403949                        if val[4].is_function? then
    38413950                                result = FuncHead.new( val[4], val[3], true )
     
    38493958.,.,
    38503959
    3851 module_eval(<<'.,.,', 'bnf.y.rb', 937)
    3852   def _reduce_259(val, _values, result)
     3960module_eval(<<'.,.,', 'bnf.y.rb', 940)
     3961  def _reduce_260(val, _values, result)
    38533962                        val[1].end_of_parse
    38543963                        result = val[1]
     
    38583967.,.,
    38593968
    3860 module_eval(<<'.,.,', 'bnf.y.rb', 943)
    3861   def _reduce_260(val, _values, result)
     3969module_eval(<<'.,.,', 'bnf.y.rb', 946)
     3970  def _reduce_261(val, _values, result)
    38623971     result = Celltype.new(val[0].val)
    38633972    result
     
    38653974.,.,
    38663975
    3867 # reduce 261 omitted
    3868 
    38693976# reduce 262 omitted
    38703977
    3871 module_eval(<<'.,.,', 'bnf.y.rb', 952)
    3872   def _reduce_263(val, _values, result)
     3978# reduce 263 omitted
     3979
     3980module_eval(<<'.,.,', 'bnf.y.rb', 955)
     3981  def _reduce_264(val, _values, result)
    38733982                        if val[0].kind_of? Port then
    38743983                                Celltype.new_port( val[0] )
     
    38793988.,.,
    38803989
    3881 module_eval(<<'.,.,', 'bnf.y.rb', 958)
    3882   def _reduce_264(val, _values, result)
     3990module_eval(<<'.,.,', 'bnf.y.rb', 961)
     3991  def _reduce_265(val, _values, result)
    38833992                        if val[3].kind_of? Port then
    38843993                                val[3].set_specifier val[1]  # 設定順序あり
     
    38934002.,.,
    38944003
    3895 # reduce 265 omitted
    3896 
    38974004# reduce 266 omitted
    38984005
     
    39034010# reduce 269 omitted
    39044011
    3905 module_eval(<<'.,.,', 'bnf.y.rb', 977)
    3906   def _reduce_270(val, _values, result)
     4012# reduce 270 omitted
     4013
     4014module_eval(<<'.,.,', 'bnf.y.rb', 980)
     4015  def _reduce_271(val, _values, result)
    39074016     result = [ val[0] ]
    3908     result
    3909   end
    3910 .,.,
    3911 
    3912 module_eval(<<'.,.,', 'bnf.y.rb', 979)
    3913   def _reduce_271(val, _values, result)
    3914      result << val[2]
    39154017    result
    39164018  end
     
    39194021module_eval(<<'.,.,', 'bnf.y.rb', 982)
    39204022  def _reduce_272(val, _values, result)
     4023     result << val[2]
     4024    result
     4025  end
     4026.,.,
     4027
     4028module_eval(<<'.,.,', 'bnf.y.rb', 985)
     4029  def _reduce_273(val, _values, result)
    39214030     result = [ :INLINE ]
    39224031    result
     
    39244033.,.,
    39254034
    3926 module_eval(<<'.,.,', 'bnf.y.rb', 983)
    3927   def _reduce_273(val, _values, result)
     4035module_eval(<<'.,.,', 'bnf.y.rb', 986)
     4036  def _reduce_274(val, _values, result)
    39284037     result = [ :ALLOCATOR, val[2] ]
    39294038    result
     
    39314040.,.,
    39324041
    3933 module_eval(<<'.,.,', 'bnf.y.rb', 984)
    3934   def _reduce_274(val, _values, result)
     4042module_eval(<<'.,.,', 'bnf.y.rb', 987)
     4043  def _reduce_275(val, _values, result)
    39354044     result = [ :OPTIONAL ]
    39364045    result
     
    39384047.,.,
    39394048
    3940 module_eval(<<'.,.,', 'bnf.y.rb', 985)
    3941   def _reduce_275(val, _values, result)
     4049module_eval(<<'.,.,', 'bnf.y.rb', 988)
     4050  def _reduce_276(val, _values, result)
    39424051     result = [ :REF_DESC ]
    39434052    result
     
    39454054.,.,
    39464055
    3947 module_eval(<<'.,.,', 'bnf.y.rb', 986)
    3948   def _reduce_276(val, _values, result)
     4056module_eval(<<'.,.,', 'bnf.y.rb', 989)
     4057  def _reduce_277(val, _values, result)
    39494058     result = [ :DYNAMIC ]
    3950     result
    3951   end
    3952 .,.,
    3953 
    3954 module_eval(<<'.,.,', 'bnf.y.rb', 987)
    3955   def _reduce_277(val, _values, result)
    3956      result = [ :OMIT ]
    39574059    result
    39584060  end
     
    39614063module_eval(<<'.,.,', 'bnf.y.rb', 990)
    39624064  def _reduce_278(val, _values, result)
    3963      result = [ val[0] ]
    3964     result
    3965   end
    3966 .,.,
    3967 
    3968 module_eval(<<'.,.,', 'bnf.y.rb', 991)
     4065     result = [ :OMIT ]
     4066    result
     4067  end
     4068.,.,
     4069
     4070module_eval(<<'.,.,', 'bnf.y.rb', 993)
    39694071  def _reduce_279(val, _values, result)
    39704072     result = [ val[0] ]
     
    39734075.,.,
    39744076
    3975 module_eval(<<'.,.,', 'bnf.y.rb', 992)
     4077module_eval(<<'.,.,', 'bnf.y.rb', 994)
    39764078  def _reduce_280(val, _values, result)
    3977      result << val[2]
    3978     result
    3979   end
    3980 .,.,
    3981 
    3982 module_eval(<<'.,.,', 'bnf.y.rb', 993)
     4079     result = [ val[0] ]
     4080    result
     4081  end
     4082.,.,
     4083
     4084module_eval(<<'.,.,', 'bnf.y.rb', 995)
    39834085  def _reduce_281(val, _values, result)
    39844086     result << val[2]
     
    39874089.,.,
    39884090
    3989 module_eval(<<'.,.,', 'bnf.y.rb', 997)
     4091module_eval(<<'.,.,', 'bnf.y.rb', 996)
    39904092  def _reduce_282(val, _values, result)
     4093     result << val[2]
     4094    result
     4095  end
     4096.,.,
     4097
     4098module_eval(<<'.,.,', 'bnf.y.rb', 1000)
     4099  def _reduce_283(val, _values, result)
    39914100      result = [ :INTERNAL_ALLOC, val[0].val, val[2].val, val[4] ]
    39924101    result
     
    39944103.,.,
    39954104
    3996 module_eval(<<'.,.,', 'bnf.y.rb', 999)
    3997   def _reduce_283(val, _values, result)
     4105module_eval(<<'.,.,', 'bnf.y.rb', 1002)
     4106  def _reduce_284(val, _values, result)
    39984107      result = [ :RELAY_ALLOC, val[0].val, val[2].val, val[4] ]
    39994108    result
     
    40014110.,.,
    40024111
    4003 module_eval(<<'.,.,', 'bnf.y.rb', 1005)
    4004   def _reduce_284(val, _values, result)
     4112module_eval(<<'.,.,', 'bnf.y.rb', 1008)
     4113  def _reduce_285(val, _values, result)
    40054114     result = Port.new( val[2].val, val[1], val[0] )
    40064115    result
     
    40084117.,.,
    40094118
    4010 module_eval(<<'.,.,', 'bnf.y.rb', 1007)
    4011   def _reduce_285(val, _values, result)
     4119module_eval(<<'.,.,', 'bnf.y.rb', 1010)
     4120  def _reduce_286(val, _values, result)
    40124121     result = Port.new( val[2].val, val[1], val[0], "[]" )
    40134122    result
     
    40154124.,.,
    40164125
    4017 module_eval(<<'.,.,', 'bnf.y.rb', 1009)
    4018   def _reduce_286(val, _values, result)
     4126module_eval(<<'.,.,', 'bnf.y.rb', 1012)
     4127  def _reduce_287(val, _values, result)
    40194128     result = Port.new(val[2].val, val[1], val[0], val[4])
    4020     result
    4021   end
    4022 .,.,
    4023 
    4024 module_eval(<<'.,.,', 'bnf.y.rb', 1011)
    4025   def _reduce_287(val, _values, result)
    4026      result = Port.new( val[2].val, val[1], val[0], nil, val[4], val[ 6 ].val )
    40274129    result
    40284130  end
     
    40314133module_eval(<<'.,.,', 'bnf.y.rb', 1014)
    40324134  def _reduce_288(val, _values, result)
     4135     result = Port.new( val[2].val, val[1], val[0], nil, val[4], val[ 6 ].val )
     4136    result
     4137  end
     4138.,.,
     4139
     4140module_eval(<<'.,.,', 'bnf.y.rb', 1017)
     4141  def _reduce_289(val, _values, result)
    40334142     result = :CALL
    40344143    result
     
    40364145.,.,
    40374146
    4038 module_eval(<<'.,.,', 'bnf.y.rb', 1015)
    4039   def _reduce_289(val, _values, result)
     4147module_eval(<<'.,.,', 'bnf.y.rb', 1018)
     4148  def _reduce_290(val, _values, result)
    40404149     result = :ENTRY
    40414150    result
     
    40434152.,.,
    40444153
    4045 module_eval(<<'.,.,', 'bnf.y.rb', 1019)
    4046   def _reduce_290(val, _values, result)
     4154module_eval(<<'.,.,', 'bnf.y.rb', 1022)
     4155  def _reduce_291(val, _values, result)
    40474156     result = val[0]
    40484157    result
     
    40504159.,.,
    40514160
    4052 # reduce 291 omitted
    4053 
    40544161# reduce 292 omitted
    40554162
    4056 module_eval(<<'.,.,', 'bnf.y.rb', 1031)
    4057   def _reduce_293(val, _values, result)
     4163# reduce 293 omitted
     4164
     4165module_eval(<<'.,.,', 'bnf.y.rb', 1034)
     4166  def _reduce_294(val, _values, result)
    40584167     result = nil
    40594168    result
     
    40614170.,.,
    40624171
    4063 module_eval(<<'.,.,', 'bnf.y.rb', 1035)
    4064   def _reduce_294(val, _values, result)
     4172module_eval(<<'.,.,', 'bnf.y.rb', 1038)
     4173  def _reduce_295(val, _values, result)
    40654174     Celltype.new_attribute( val[0] )
    40664175    result
     
    40684177.,.,
    40694178
    4070 module_eval(<<'.,.,', 'bnf.y.rb', 1037)
    4071   def _reduce_295(val, _values, result)
     4179module_eval(<<'.,.,', 'bnf.y.rb', 1040)
     4180  def _reduce_296(val, _values, result)
    40724181     Celltype.new_attribute( val[1] )
    40734182    result
     
    40754184.,.,
    40764185
    4077 module_eval(<<'.,.,', 'bnf.y.rb', 1043)
    4078   def _reduce_296(val, _values, result)
     4186module_eval(<<'.,.,', 'bnf.y.rb', 1046)
     4187  def _reduce_297(val, _values, result)
    40794188                        val[0].each{ |i|       # i:Decl
    40804189                                i.set_kind( :ATTRIBUTE )
     
    40874196.,.,
    40884197
    4089 module_eval(<<'.,.,', 'bnf.y.rb', 1051)
    4090   def _reduce_297(val, _values, result)
     4198module_eval(<<'.,.,', 'bnf.y.rb', 1054)
     4199  def _reduce_298(val, _values, result)
    40914200                        val[3].each{ |i|       # i:Decl
    40924201                                i.set_kind( :ATTRIBUTE )   # 設定順序あり
     
    41004209.,.,
    41014210
    4102 module_eval(<<'.,.,', 'bnf.y.rb', 1060)
    4103   def _reduce_298(val, _values, result)
     4211module_eval(<<'.,.,', 'bnf.y.rb', 1063)
     4212  def _reduce_299(val, _values, result)
    41044213     result = [:OMIT]
    41054214    result
     
    41074216.,.,
    41084217
    4109 module_eval(<<'.,.,', 'bnf.y.rb', 1061)
    4110   def _reduce_299(val, _values, result)
     4218module_eval(<<'.,.,', 'bnf.y.rb', 1064)
     4219  def _reduce_300(val, _values, result)
    41114220     result = [:SIZE_IS,val[2]]
    4112     result
    4113   end
    4114 .,.,
    4115 
    4116 module_eval(<<'.,.,', 'bnf.y.rb', 1062)
    4117   def _reduce_300(val, _values, result)
    4118       result = [:CHOICE,val[3]]
    41194221    result
    41204222  end
     
    41234225module_eval(<<'.,.,', 'bnf.y.rb', 1065)
    41244226  def _reduce_301(val, _values, result)
     4227      result = [:CHOICE,val[3]]
     4228    result
     4229  end
     4230.,.,
     4231
     4232module_eval(<<'.,.,', 'bnf.y.rb', 1068)
     4233  def _reduce_302(val, _values, result)
    41254234      result << val[2]
    41264235    result
     
    41284237.,.,
    41294238
    4130 module_eval(<<'.,.,', 'bnf.y.rb', 1066)
    4131   def _reduce_302(val, _values, result)
     4239module_eval(<<'.,.,', 'bnf.y.rb', 1069)
     4240  def _reduce_303(val, _values, result)
    41324241      result = [ val[0] ]
    41334242    result
     
    41354244.,.,
    41364245
    4137 # reduce 303 omitted
    4138 
    4139 module_eval(<<'.,.,', 'bnf.y.rb', 1074)
    4140   def _reduce_304(val, _values, result)
     4246# reduce 304 omitted
     4247
     4248module_eval(<<'.,.,', 'bnf.y.rb', 1077)
     4249  def _reduce_305(val, _values, result)
    41414250     result = nil
    41424251    result
     
    41444253.,.,
    41454254
    4146 module_eval(<<'.,.,', 'bnf.y.rb', 1078)
    4147   def _reduce_305(val, _values, result)
     4255module_eval(<<'.,.,', 'bnf.y.rb', 1081)
     4256  def _reduce_306(val, _values, result)
    41484257     Celltype.new_var( val[0] )
    41494258    result
     
    41514260.,.,
    41524261
    4153 module_eval(<<'.,.,', 'bnf.y.rb', 1080)
    4154   def _reduce_306(val, _values, result)
     4262module_eval(<<'.,.,', 'bnf.y.rb', 1083)
     4263  def _reduce_307(val, _values, result)
    41554264     Celltype.new_var( val[1] )
    41564265    result
     
    41584267.,.,
    41594268
    4160 module_eval(<<'.,.,', 'bnf.y.rb', 1085)
    4161   def _reduce_307(val, _values, result)
     4269module_eval(<<'.,.,', 'bnf.y.rb', 1088)
     4270  def _reduce_308(val, _values, result)
    41624271                        val[0].each{ |i|       # i:Decl
    41634272                                i.set_kind( :VAR )
     
    41694278.,.,
    41704279
    4171 module_eval(<<'.,.,', 'bnf.y.rb', 1092)
    4172   def _reduce_308(val, _values, result)
     4280module_eval(<<'.,.,', 'bnf.y.rb', 1095)
     4281  def _reduce_309(val, _values, result)
    41734282                        val[3].each{ |i|       # i:Decl
    41744283                                i.set_kind( :VAR )   # 設定順序あり
     
    41824291.,.,
    41834292
    4184 module_eval(<<'.,.,', 'bnf.y.rb', 1101)
    4185   def _reduce_309(val, _values, result)
     4293module_eval(<<'.,.,', 'bnf.y.rb', 1104)
     4294  def _reduce_310(val, _values, result)
    41864295     result = [:SIZE_IS,val[2]]
    41874296    result
     
    41894298.,.,
    41904299
    4191 module_eval(<<'.,.,', 'bnf.y.rb', 1107)
    4192   def _reduce_310(val, _values, result)
     4300module_eval(<<'.,.,', 'bnf.y.rb', 1110)
     4301  def _reduce_311(val, _values, result)
    41934302                        Celltype.new_require( val[1], val[3] )
    41944303               
     
    41974306.,.,
    41984307
    4199 module_eval(<<'.,.,', 'bnf.y.rb', 1111)
    4200   def _reduce_311(val, _values, result)
     4308module_eval(<<'.,.,', 'bnf.y.rb', 1114)
     4309  def _reduce_312(val, _values, result)
    42014310                        Celltype.new_require( val[3], val[5], val[1].val )
    42024311               
     
    42054314.,.,
    42064315
    4207 # reduce 312 omitted
    4208 
    4209 module_eval(<<'.,.,', 'bnf.y.rb', 1119)
    4210   def _reduce_313(val, _values, result)
     4316# reduce 313 omitted
     4317
     4318module_eval(<<'.,.,', 'bnf.y.rb', 1122)
     4319  def _reduce_314(val, _values, result)
    42114320     Factory.set_f_celltype( false )
    42124321    result
     
    42144323.,.,
    42154324
    4216 module_eval(<<'.,.,', 'bnf.y.rb', 1120)
    4217   def _reduce_314(val, _values, result)
     4325module_eval(<<'.,.,', 'bnf.y.rb', 1123)
     4326  def _reduce_315(val, _values, result)
    42184327     Factory.set_f_celltype( true )
    42194328    result
     
    42214330.,.,
    42224331
    4223 # reduce 315 omitted
    4224 
    42254332# reduce 316 omitted
    42264333
    4227 module_eval(<<'.,.,', 'bnf.y.rb', 1128)
    4228   def _reduce_317(val, _values, result)
     4334# reduce 317 omitted
     4335
     4336module_eval(<<'.,.,', 'bnf.y.rb', 1131)
     4337  def _reduce_318(val, _values, result)
    42294338     Factory.new( val[0].val, val[2], val[4], nil    )
    42304339    result
     
    42324341.,.,
    42334342
    4234 module_eval(<<'.,.,', 'bnf.y.rb', 1130)
    4235   def _reduce_318(val, _values, result)
     4343module_eval(<<'.,.,', 'bnf.y.rb', 1133)
     4344  def _reduce_319(val, _values, result)
    42364345     Factory.new( val[0].val, val[2], val[4], val[6] )
    42374346    result
     
    42394348.,.,
    42404349
    4241 # reduce 319 omitted
    4242 
    4243 module_eval(<<'.,.,', 'bnf.y.rb', 1137)
    4244   def _reduce_320(val, _values, result)
     4350# reduce 320 omitted
     4351
     4352module_eval(<<'.,.,', 'bnf.y.rb', 1140)
     4353  def _reduce_321(val, _values, result)
    42454354     result = [ [ :IDENTIFIER, val[0].val ] ]
    42464355    result
     
    42484357.,.,
    42494358
    4250 module_eval(<<'.,.,', 'bnf.y.rb', 1139)
    4251   def _reduce_321(val, _values, result)
     4359module_eval(<<'.,.,', 'bnf.y.rb', 1142)
     4360  def _reduce_322(val, _values, result)
    42524361     result << [ :IDENTIFIER, val[2].val ]
    42534362    result
     
    42554364.,.,
    42564365
    4257 module_eval(<<'.,.,', 'bnf.y.rb', 1141)
    4258   def _reduce_322(val, _values, result)
     4366module_eval(<<'.,.,', 'bnf.y.rb', 1144)
     4367  def _reduce_323(val, _values, result)
    42594368     result = [ [ :STRING_LITERAL, val[0].val ] ]
    42604369    result
     
    42624371.,.,
    42634372
    4264 module_eval(<<'.,.,', 'bnf.y.rb', 1143)
    4265   def _reduce_323(val, _values, result)
     4373module_eval(<<'.,.,', 'bnf.y.rb', 1146)
     4374  def _reduce_324(val, _values, result)
    42664375     result << [ :STRING_LITERAL, val[2].val ]
    42674376    result
     
    42694378.,.,
    42704379
    4271 module_eval(<<'.,.,', 'bnf.y.rb', 1148)
    4272   def _reduce_324(val, _values, result)
     4380module_eval(<<'.,.,', 'bnf.y.rb', 1151)
     4381  def _reduce_325(val, _values, result)
    42734382     Cell.new_def
    42744383    result
     
    42764385.,.,
    42774386
    4278 module_eval(<<'.,.,', 'bnf.y.rb', 1150)
    4279   def _reduce_325(val, _values, result)
     4387module_eval(<<'.,.,', 'bnf.y.rb', 1153)
     4388  def _reduce_326(val, _values, result)
    42804389     result = Cell.end_of_parse true
    42814390    result
     
    42834392.,.,
    42844393
    4285 module_eval(<<'.,.,', 'bnf.y.rb', 1152)
    4286   def _reduce_326(val, _values, result)
     4394module_eval(<<'.,.,', 'bnf.y.rb', 1155)
     4395  def _reduce_327(val, _values, result)
    42874396     result = Cell.end_of_parse false
    42884397    result
     
    42904399.,.,
    42914400
    4292 module_eval(<<'.,.,', 'bnf.y.rb', 1156)
    4293   def _reduce_327(val, _values, result)
     4401module_eval(<<'.,.,', 'bnf.y.rb', 1159)
     4402  def _reduce_328(val, _values, result)
    42944403     result = Cell.new(val[0])
    42954404    result
     
    42974406.,.,
    42984407
    4299 module_eval(<<'.,.,', 'bnf.y.rb', 1160)
    4300   def _reduce_328(val, _values, result)
     4408module_eval(<<'.,.,', 'bnf.y.rb', 1163)
     4409  def _reduce_329(val, _values, result)
    43014410     result = Cell.set_name(val[0].val)
    43024411    result
     
    43044413.,.,
    43054414
    4306 # reduce 329 omitted
    4307 
    43084415# reduce 330 omitted
    43094416
    43104417# reduce 331 omitted
    43114418
    4312 module_eval(<<'.,.,', 'bnf.y.rb', 1169)
    4313   def _reduce_332(val, _values, result)
     4419# reduce 332 omitted
     4420
     4421module_eval(<<'.,.,', 'bnf.y.rb', 1172)
     4422  def _reduce_333(val, _values, result)
    43144423     val[3].set_specifier_list( val[1] ) 
    43154424    result
     
    43174426.,.,
    43184427
    4319 module_eval(<<'.,.,', 'bnf.y.rb', 1171)
    4320   def _reduce_333(val, _values, result)
     4428module_eval(<<'.,.,', 'bnf.y.rb', 1174)
     4429  def _reduce_334(val, _values, result)
    43214430     val[0].set_specifier_list( [] )
    43224431    result
     
    43244433.,.,
    43254434
    4326 module_eval(<<'.,.,', 'bnf.y.rb', 1175)
    4327   def _reduce_334(val, _values, result)
     4435module_eval(<<'.,.,', 'bnf.y.rb', 1178)
     4436  def _reduce_335(val, _values, result)
    43284437     result << val[2]
    43294438    result
     
    43314440.,.,
    43324441
    4333 module_eval(<<'.,.,', 'bnf.y.rb', 1177)
    4334   def _reduce_335(val, _values, result)
     4442module_eval(<<'.,.,', 'bnf.y.rb', 1180)
     4443  def _reduce_336(val, _values, result)
    43354444     result = [val[0]]
    4336     result
    4337   end
    4338 .,.,
    4339 
    4340 module_eval(<<'.,.,', 'bnf.y.rb', 1181)
    4341   def _reduce_336(val, _values, result)
    4342      result = [ :THROUGH, val[2], val[4] ]
    43434445    result
    43444446  end
     
    43474449module_eval(<<'.,.,', 'bnf.y.rb', 1184)
    43484450  def _reduce_337(val, _values, result)
     4451     result = [ :THROUGH, val[2], val[4] ]
     4452    result
     4453  end
     4454.,.,
     4455
     4456module_eval(<<'.,.,', 'bnf.y.rb', 1187)
     4457  def _reduce_338(val, _values, result)
    43494458     result = val[0]
    43504459    result
     
    43524461.,.,
    43534462
    4354 # reduce 338 omitted
    4355 
    4356 module_eval(<<'.,.,', 'bnf.y.rb', 1198)
    4357   def _reduce_339(val, _values, result)
     4463# reduce 339 omitted
     4464
     4465module_eval(<<'.,.,', 'bnf.y.rb', 1201)
     4466  def _reduce_340(val, _values, result)
    43584467                        result = Join.new( val[0].val,  -1, val[4] )
    43594468                        Cell.new_join( result, true )
     
    43634472.,.,
    43644473
    4365 module_eval(<<'.,.,', 'bnf.y.rb', 1203)
    4366   def _reduce_340(val, _values, result)
     4474module_eval(<<'.,.,', 'bnf.y.rb', 1206)
     4475  def _reduce_341(val, _values, result)
    43674476                        result = Join.new( val[0].val, val[2], val[5] )
    43684477                        Cell.new_join( result, true )
     
    43724481.,.,
    43734482
    4374 module_eval(<<'.,.,', 'bnf.y.rb', 1208)
    4375   def _reduce_341(val, _values, result)
     4483module_eval(<<'.,.,', 'bnf.y.rb', 1211)
     4484  def _reduce_342(val, _values, result)
    43764485                        result = Join.new( val[0].val, nil, val[2] )
    43774486                        Cell.new_join( result, true )
     
    43814490.,.,
    43824491
    4383 module_eval(<<'.,.,', 'bnf.y.rb', 1213)
    4384   def _reduce_342(val, _values, result)
     4492module_eval(<<'.,.,', 'bnf.y.rb', 1216)
     4493  def _reduce_343(val, _values, result)
    43854494                        result = Join.new( val[0].val, nil, [ :COMPOSITE, val[4] ] )
    43864495                        Cell.new_join( result, true )
     
    43904499.,.,
    43914500
    4392 # reduce 343 omitted
    4393 
    4394 module_eval(<<'.,.,', 'bnf.y.rb', 1224)
    4395   def _reduce_344(val, _values, result)
     4501# reduce 344 omitted
     4502
     4503module_eval(<<'.,.,', 'bnf.y.rb', 1227)
     4504  def _reduce_345(val, _values, result)
    43964505                        rj = ReverseJoin.new( val[0].val, nil, val[2], val[4].val )
    43974506                        Cell.new_reverse_join( rj )
     
    44014510.,.,
    44024511
    4403 module_eval(<<'.,.,', 'bnf.y.rb', 1230)
    4404   def _reduce_345(val, _values, result)
     4512module_eval(<<'.,.,', 'bnf.y.rb', 1233)
     4513  def _reduce_346(val, _values, result)
    44054514                        rj = ReverseJoin.new( val[0].val, nil, val[2], val[4].val, val[6] )
    44064515                        Cell.new_reverse_join( rj )
     
    44104519.,.,
    44114520
    4412 module_eval(<<'.,.,', 'bnf.y.rb', 1236)
    4413   def _reduce_346(val, _values, result)
     4521module_eval(<<'.,.,', 'bnf.y.rb', 1239)
     4522  def _reduce_347(val, _values, result)
    44144523                        rj = ReverseJoin.new( val[0].val, val[2], val[5], val[7].val )
    44154524                        Cell.new_reverse_join( rj )
     
    44194528.,.,
    44204529
    4421 module_eval(<<'.,.,', 'bnf.y.rb', 1242)
    4422   def _reduce_347(val, _values, result)
     4530module_eval(<<'.,.,', 'bnf.y.rb', 1245)
     4531  def _reduce_348(val, _values, result)
    44234532                        rj = ReverseJoin.new( val[0].val, val[2], val[5], val[7].val, val[9] )
    44244533                        Cell.new_reverse_join( rj )
     
    44284537.,.,
    44294538
    4430 # reduce 348 omitted
    4431 
    4432 module_eval(<<'.,.,', 'bnf.y.rb', 1254)
    4433   def _reduce_349(val, _values, result)
     4539# reduce 349 omitted
     4540
     4541module_eval(<<'.,.,', 'bnf.y.rb', 1257)
     4542  def _reduce_350(val, _values, result)
    44344543                        CompositeCelltype.end_of_parse
    44354544                        result = val[1]
     
    44394548.,.,
    44404549
    4441 module_eval(<<'.,.,', 'bnf.y.rb', 1260)
    4442   def _reduce_350(val, _values, result)
     4550module_eval(<<'.,.,', 'bnf.y.rb', 1263)
     4551  def _reduce_351(val, _values, result)
    44434552     result = CompositeCelltype.new(val[0].val)
    44444553    result
     
    44464555.,.,
    44474556
    4448 # reduce 351 omitted
    4449 
    44504557# reduce 352 omitted
    44514558
    4452 module_eval(<<'.,.,', 'bnf.y.rb', 1269)
    4453   def _reduce_353(val, _values, result)
     4559# reduce 353 omitted
     4560
     4561module_eval(<<'.,.,', 'bnf.y.rb', 1272)
     4562  def _reduce_354(val, _values, result)
    44544563                        if val[0].kind_of?( Port ) then
    44554564                                CompositeCelltype.new_port( val[0] )   # 遅延して登録
     
    44604569.,.,
    44614570
    4462 module_eval(<<'.,.,', 'bnf.y.rb', 1275)
    4463   def _reduce_354(val, _values, result)
     4571module_eval(<<'.,.,', 'bnf.y.rb', 1278)
     4572  def _reduce_355(val, _values, result)
    44644573                        if val[3].kind_of?( Port ) then
    44654574                                # port 以外 val[3] に有効な値が入っていないので、以下のメソッドを適用できない
     
    44794588.,.,
    44804589
    4481 # reduce 355 omitted
    4482 
    44834590# reduce 356 omitted
    44844591
     
    44874594# reduce 358 omitted
    44884595
    4489 module_eval(<<'.,.,', 'bnf.y.rb', 1299)
    4490   def _reduce_359(val, _values, result)
     4596# reduce 359 omitted
     4597
     4598module_eval(<<'.,.,', 'bnf.y.rb', 1302)
     4599  def _reduce_360(val, _values, result)
    44914600                        Generator.add_statement_specifier val[0]
    44924601                        result = [ val[0] ]
     
    44964605.,.,
    44974606
    4498 module_eval(<<'.,.,', 'bnf.y.rb', 1304)
    4499   def _reduce_360(val, _values, result)
     4607module_eval(<<'.,.,', 'bnf.y.rb', 1307)
     4608  def _reduce_361(val, _values, result)
     4609                        Generator.add_statement_specifier val[2]
     4610                        result = val[0] << val[2]
     4611               
     4612    result
     4613  end
     4614.,.,
     4615
     4616module_eval(<<'.,.,', 'bnf.y.rb', 1312)
     4617  def _reduce_362(val, _values, result)
    45004618     result = [ :ALLOCATOR, val[2] ]
    45014619    result
     
    45034621.,.,
    45044622
    4505 module_eval(<<'.,.,', 'bnf.y.rb', 1305)
    4506   def _reduce_361(val, _values, result)
     4623module_eval(<<'.,.,', 'bnf.y.rb', 1313)
     4624  def _reduce_363(val, _values, result)
    45074625     result = [ :OMIT ]
    45084626    result
     
    45104628.,.,
    45114629
    4512 module_eval(<<'.,.,', 'bnf.y.rb', 1306)
    4513   def _reduce_362(val, _values, result)
     4630module_eval(<<'.,.,', 'bnf.y.rb', 1314)
     4631  def _reduce_364(val, _values, result)
    45144632     result = [ :OPTIONAL ]
    45154633    result
     
    45174635.,.,
    45184636
    4519 module_eval(<<'.,.,', 'bnf.y.rb', 1307)
    4520   def _reduce_363(val, _values, result)
     4637module_eval(<<'.,.,', 'bnf.y.rb', 1315)
     4638  def _reduce_365(val, _values, result)
    45214639     result = [ :REF_DESC ]
    45224640    result
     
    45244642.,.,
    45254643
    4526 module_eval(<<'.,.,', 'bnf.y.rb', 1308)
    4527   def _reduce_364(val, _values, result)
     4644module_eval(<<'.,.,', 'bnf.y.rb', 1316)
     4645  def _reduce_366(val, _values, result)
    45284646     result = [ :DYNAMIC ]
    45294647    result
     
    45314649.,.,
    45324650
    4533 module_eval(<<'.,.,', 'bnf.y.rb', 1313)
    4534   def _reduce_365(val, _values, result)
     4651module_eval(<<'.,.,', 'bnf.y.rb', 1321)
     4652  def _reduce_367(val, _values, result)
    45354653                        # CompositeCelltype.new_port( val[0] )
    45364654                        result = val[0]
     
    45404658.,.,
    45414659
    4542 module_eval(<<'.,.,', 'bnf.y.rb', 1320)
    4543   def _reduce_366(val, _values, result)
     4660module_eval(<<'.,.,', 'bnf.y.rb', 1328)
     4661  def _reduce_368(val, _values, result)
    45444662     result = nil
    45454663    result
     
    45474665.,.,
    45484666
    4549 module_eval(<<'.,.,', 'bnf.y.rb', 1324)
    4550   def _reduce_367(val, _values, result)
     4667module_eval(<<'.,.,', 'bnf.y.rb', 1332)
     4668  def _reduce_369(val, _values, result)
    45514669     CompositeCelltype.new_attribute( val[0] )
    45524670    result
     
    45544672.,.,
    45554673
    4556 module_eval(<<'.,.,', 'bnf.y.rb', 1326)
    4557   def _reduce_368(val, _values, result)
     4674module_eval(<<'.,.,', 'bnf.y.rb', 1334)
     4675  def _reduce_370(val, _values, result)
    45584676     CompositeCelltype.new_attribute( val[1] )
    45594677    result
     
    45614679.,.,
    45624680
    4563 module_eval(<<'.,.,', 'bnf.y.rb', 1331)
    4564   def _reduce_369(val, _values, result)
     4681module_eval(<<'.,.,', 'bnf.y.rb', 1339)
     4682  def _reduce_371(val, _values, result)
    45654683     Cell.new_def
    45664684    result
     
    45684686.,.,
    45694687
    4570 module_eval(<<'.,.,', 'bnf.y.rb', 1333)
    4571   def _reduce_370(val, _values, result)
     4688module_eval(<<'.,.,', 'bnf.y.rb', 1341)
     4689  def _reduce_372(val, _values, result)
    45724690     result = Cell.end_of_parse true
    45734691    result
     
    45754693.,.,
    45764694
    4577 module_eval(<<'.,.,', 'bnf.y.rb', 1335)
    4578   def _reduce_371(val, _values, result)
     4695module_eval(<<'.,.,', 'bnf.y.rb', 1343)
     4696  def _reduce_373(val, _values, result)
    45794697     result = Cell.end_of_parse false
    45804698    result
     
    45824700.,.,
    45834701
    4584 module_eval(<<'.,.,', 'bnf.y.rb', 1340)
    4585   def _reduce_372(val, _values, result)
     4702module_eval(<<'.,.,', 'bnf.y.rb', 1348)
     4703  def _reduce_374(val, _values, result)
    45864704     Cell.new(val[0],true)
    45874705    result
     
    45894707.,.,
    45904708
    4591 module_eval(<<'.,.,', 'bnf.y.rb', 1344)
    4592   def _reduce_373(val, _values, result)
     4709module_eval(<<'.,.,', 'bnf.y.rb', 1352)
     4710  def _reduce_375(val, _values, result)
    45934711     Cell.set_name(val[0].val)
    45944712    result
     
    45964714.,.,
    45974715
    4598 # reduce 374 omitted
    4599 
    4600 # reduce 375 omitted
    4601 
    46024716# reduce 376 omitted
    46034717
    4604 module_eval(<<'.,.,', 'bnf.y.rb', 1354)
    4605   def _reduce_377(val, _values, result)
     4718# reduce 377 omitted
     4719
     4720# reduce 378 omitted
     4721
     4722# reduce 379 omitted
     4723
     4724module_eval(<<'.,.,', 'bnf.y.rb', 1363)
     4725  def _reduce_380(val, _values, result)
    46064726        Cell.external_join( val[0].val, val[4].val, true )     
    46074727    result
     
    46094729.,.,
    46104730
    4611 module_eval(<<'.,.,', 'bnf.y.rb', 1356)
    4612   def _reduce_378(val, _values, result)
     4731module_eval(<<'.,.,', 'bnf.y.rb', 1365)
     4732  def _reduce_381(val, _values, result)
    46134733        Cell.external_join( val[0].val, val[2].val, false )     
    46144734    result
     
    46164736.,.,
    46174737
    4618 module_eval(<<'.,.,', 'bnf.y.rb', 1363)
    4619   def _reduce_379(val, _values, result)
     4738module_eval(<<'.,.,', 'bnf.y.rb', 1372)
     4739  def _reduce_382(val, _values, result)
    46204740                        CompositeCelltype.new_join( val[0].val,
    46214741                                                val[2].val, val[4].val, :ENTRY )
     
    46254745.,.,
    46264746
    4627 module_eval(<<'.,.,', 'bnf.y.rb', 1368)
    4628   def _reduce_380(val, _values, result)
     4747module_eval(<<'.,.,', 'bnf.y.rb', 1377)
     4748  def _reduce_383(val, _values, result)
    46294749                        CompositeCelltype.new_join( val[2].val,
    46304750                                                val[4].val, val[6].val, :ENTRY )
     
    46344754.,.,
    46354755
    4636 # reduce 381 omitted
    4637 
    4638 # reduce 382 omitted
    4639 
    4640 # reduce 383 omitted
    4641 
    4642 module_eval(<<'.,.,', 'bnf.y.rb', 1384)
    4643   def _reduce_384(val, _values, result)
     4756# reduce 384 omitted
     4757
     4758# reduce 385 omitted
     4759
     4760# reduce 386 omitted
     4761
     4762module_eval(<<'.,.,', 'bnf.y.rb', 1393)
     4763  def _reduce_387(val, _values, result)
    46444764     Region.end_of_parse
    46454765    result
    46464766  end
    46474767.,.,
    4648 
    4649 module_eval(<<'.,.,', 'bnf.y.rb', 1386)
    4650   def _reduce_385(val, _values, result)
    4651      Region.end_of_parse
    4652     result
    4653   end
    4654 .,.,
    4655 
    4656 # reduce 386 omitted
    4657 
    4658 # reduce 387 omitted
    46594768
    46604769module_eval(<<'.,.,', 'bnf.y.rb', 1395)
    46614770  def _reduce_388(val, _values, result)
     4771     Region.end_of_parse
     4772    result
     4773  end
     4774.,.,
     4775
     4776# reduce 389 omitted
     4777
     4778# reduce 390 omitted
     4779
     4780module_eval(<<'.,.,', 'bnf.y.rb', 1404)
     4781  def _reduce_391(val, _values, result)
    46624782     Region.new_in_through( val[2].val, val[4].val )
    46634783    result
     
    46654785.,.,
    46664786
    4667 module_eval(<<'.,.,', 'bnf.y.rb', 1397)
    4668   def _reduce_389(val, _values, result)
     4787module_eval(<<'.,.,', 'bnf.y.rb', 1406)
     4788  def _reduce_392(val, _values, result)
    46694789     Region.new_in_through
    46704790    result
     
    46724792.,.,
    46734793
    4674 module_eval(<<'.,.,', 'bnf.y.rb', 1399)
    4675   def _reduce_390(val, _values, result)
     4794module_eval(<<'.,.,', 'bnf.y.rb', 1408)
     4795  def _reduce_393(val, _values, result)
    46764796     Region.new_out_through( val[2].val, val[4].val )
    46774797    result
     
    46794799.,.,
    46804800
    4681 module_eval(<<'.,.,', 'bnf.y.rb', 1401)
    4682   def _reduce_391(val, _values, result)
     4801module_eval(<<'.,.,', 'bnf.y.rb', 1410)
     4802  def _reduce_394(val, _values, result)
    46834803     Region.new_out_through()
    46844804    result
     
    46864806.,.,
    46874807
    4688 module_eval(<<'.,.,', 'bnf.y.rb', 1403)
    4689   def _reduce_392(val, _values, result)
     4808module_eval(<<'.,.,', 'bnf.y.rb', 1412)
     4809  def _reduce_395(val, _values, result)
    46904810     Region.new_to_through( val[2], val[4].val, val[6].val )
    46914811    result
     
    46934813.,.,
    46944814
    4695 module_eval(<<'.,.,', 'bnf.y.rb', 1405)
    4696   def _reduce_393(val, _values, result)
     4815module_eval(<<'.,.,', 'bnf.y.rb', 1414)
     4816  def _reduce_396(val, _values, result)
    46974817     Region.new_to_through( val[2], nil, nil )
    46984818    result
     
    47004820.,.,
    47014821
    4702 module_eval(<<'.,.,', 'bnf.y.rb', 1407)
    4703   def _reduce_394(val, _values, result)
     4822module_eval(<<'.,.,', 'bnf.y.rb', 1416)
     4823  def _reduce_397(val, _values, result)
    47044824     Region.set_type( :NODE )
    47054825    result
     
    47074827.,.,
    47084828
    4709 module_eval(<<'.,.,', 'bnf.y.rb', 1409)
    4710   def _reduce_395(val, _values, result)
     4829module_eval(<<'.,.,', 'bnf.y.rb', 1418)
     4830  def _reduce_398(val, _values, result)
    47114831     Region.set_type( :LINKUNIT )
    47124832    result
     
    47144834.,.,
    47154835
    4716 module_eval(<<'.,.,', 'bnf.y.rb', 1411)
    4717   def _reduce_396(val, _values, result)
     4836module_eval(<<'.,.,', 'bnf.y.rb', 1420)
     4837  def _reduce_399(val, _values, result)
    47184838     Region.set_domain( val[2].val, val[4] )
    47194839    result
     
    47214841.,.,
    47224842
    4723 module_eval(<<'.,.,', 'bnf.y.rb', 1413)
    4724   def _reduce_397(val, _values, result)
     4843module_eval(<<'.,.,', 'bnf.y.rb', 1422)
     4844  def _reduce_400(val, _values, result)
    47254845     Region.set_type( :CLASS, val[2].val )
    47264846    result
     
    47284848.,.,
    47294849
    4730 module_eval(<<'.,.,', 'bnf.y.rb', 1417)
    4731   def _reduce_398(val, _values, result)
     4850module_eval(<<'.,.,', 'bnf.y.rb', 1426)
     4851  def _reduce_401(val, _values, result)
    47324852     result = Region.new( val[0].val )
    47334853    result
     
    47354855.,.,
    47364856
    4737 # reduce 399 omitted
    4738 
    4739 # reduce 400 omitted
    4740 
    4741 # reduce 401 omitted
    4742 
    47434857# reduce 402 omitted
    47444858
    4745 module_eval(<<'.,.,', 'bnf.y.rb', 1428)
    4746   def _reduce_403(val, _values, result)
     4859# reduce 403 omitted
     4860
     4861# reduce 404 omitted
     4862
     4863# reduce 405 omitted
     4864
     4865module_eval(<<'.,.,', 'bnf.y.rb', 1437)
     4866  def _reduce_406(val, _values, result)
    47474867                        obj = val[3]
    47484868                        if obj.kind_of?( Cell ) then
     
    47564876.,.,
    47574877
    4758 module_eval(<<'.,.,', 'bnf.y.rb', 1450)
    4759   def _reduce_404(val, _values, result)
     4878module_eval(<<'.,.,', 'bnf.y.rb', 1459)
     4879  def _reduce_407(val, _values, result)
    47604880     result = [ val[0].val ]
    47614881    result
     
    47634883.,.,
    47644884
    4765 module_eval(<<'.,.,', 'bnf.y.rb', 1455)
    4766   def _reduce_405(val, _values, result)
     4885module_eval(<<'.,.,', 'bnf.y.rb', 1464)
     4886  def _reduce_408(val, _values, result)
    47674887     set_in_specifier
    47684888    result
     
    47704890.,.,
    47714891
    4772 module_eval(<<'.,.,', 'bnf.y.rb', 1457)
    4773   def _reduce_406(val, _values, result)
     4892module_eval(<<'.,.,', 'bnf.y.rb', 1466)
     4893  def _reduce_409(val, _values, result)
    47744894     unset_in_specifier
    47754895    result
     
    47774897.,.,
    47784898
    4779 # reduce 407 omitted
    4780 
    4781 # reduce 408 omitted
    4782 
    4783 # reduce 409 omitted
    4784 
    47854899# reduce 410 omitted
    47864900
    4787 module_eval(<<'.,.,', 'bnf.y.rb', 1471)
    4788   def _reduce_411(val, _values, result)
     4901# reduce 411 omitted
     4902
     4903# reduce 412 omitted
     4904
     4905# reduce 413 omitted
     4906
     4907module_eval(<<'.,.,', 'bnf.y.rb', 1480)
     4908  def _reduce_414(val, _values, result)
    47894909                        TECSGEN::Cell_location.new( val[1], val[3], val[5], val[7], val[9], val[12] )
    47904910               
     
    47934913.,.,
    47944914
    4795 module_eval(<<'.,.,', 'bnf.y.rb', 1477)
    4796   def _reduce_412(val, _values, result)
     4915module_eval(<<'.,.,', 'bnf.y.rb', 1486)
     4916  def _reduce_415(val, _values, result)
    47974917                        result = val[0] << val[1]
    47984918               
     
    48014921.,.,
    48024922
    4803 module_eval(<<'.,.,', 'bnf.y.rb', 1480)
    4804   def _reduce_413(val, _values, result)
     4923module_eval(<<'.,.,', 'bnf.y.rb', 1489)
     4924  def _reduce_416(val, _values, result)
    48054925     result = []
    48064926    result
     
    48084928.,.,
    48094929
    4810 module_eval(<<'.,.,', 'bnf.y.rb', 1484)
    4811   def _reduce_414(val, _values, result)
     4930module_eval(<<'.,.,', 'bnf.y.rb', 1493)
     4931  def _reduce_417(val, _values, result)
    48124932     result = [ val[0], val[2], val[3] ]
    48134933    result
     
    48154935.,.,
    48164936
    4817 module_eval(<<'.,.,', 'bnf.y.rb', 1489)
    4818   def _reduce_415(val, _values, result)
     4937module_eval(<<'.,.,', 'bnf.y.rb', 1498)
     4938  def _reduce_418(val, _values, result)
    48194939                TECSGEN::Join_location.new( val[2], val[4], val[6], val[8], val[11] )
    48204940               
     
    48234943.,.,
    48244944
    4825 module_eval(<<'.,.,', 'bnf.y.rb', 1495)
    4826   def _reduce_416(val, _values, result)
     4945module_eval(<<'.,.,', 'bnf.y.rb', 1504)
     4946  def _reduce_419(val, _values, result)
    48274947                result = val[0] << [ val[1], val[3] ]
    48284948         
     
    48314951.,.,
    48324952
    4833 module_eval(<<'.,.,', 'bnf.y.rb', 1497)
    4834   def _reduce_417(val, _values, result)
     4953module_eval(<<'.,.,', 'bnf.y.rb', 1506)
     4954  def _reduce_420(val, _values, result)
    48354955     result = []
     4956    result
     4957  end
     4958.,.,
     4959
     4960module_eval(<<'.,.,', 'bnf.y.rb', 1510)
     4961  def _reduce_421(val, _values, result)
     4962     TOOL_INFO.new( val[2].to_sym, val[4] )
     4963    result
     4964  end
     4965.,.,
     4966
     4967module_eval(<<'.,.,', 'bnf.y.rb', 1511)
     4968  def _reduce_422(val, _values, result)
     4969      result = val[1]
     4970    result
     4971  end
     4972.,.,
     4973
     4974module_eval(<<'.,.,', 'bnf.y.rb', 1512)
     4975  def _reduce_423(val, _values, result)
     4976     result = { val[0].to_sym => val[2] }
     4977    result
     4978  end
     4979.,.,
     4980
     4981module_eval(<<'.,.,', 'bnf.y.rb', 1514)
     4982  def _reduce_424(val, _values, result)
     4983     val[0][ val[2].to_sym ] = val[4]
     4984    result
     4985  end
     4986.,.,
     4987
     4988# reduce 425 omitted
     4989
     4990# reduce 426 omitted
     4991
     4992# reduce 427 omitted
     4993
     4994# reduce 428 omitted
     4995
     4996module_eval(<<'.,.,', 'bnf.y.rb', 1516)
     4997  def _reduce_429(val, _values, result)
     4998     result=val[0].val
     4999    result
     5000  end
     5001.,.,
     5002
     5003module_eval(<<'.,.,', 'bnf.y.rb', 1516)
     5004  def _reduce_430(val, _values, result)
     5005     result=val[0].val
     5006    result
     5007  end
     5008.,.,
     5009
     5010module_eval(<<'.,.,', 'bnf.y.rb', 1517)
     5011  def _reduce_431(val, _values, result)
     5012     result = val[1] 
     5013    result
     5014  end
     5015.,.,
     5016
     5017module_eval(<<'.,.,', 'bnf.y.rb', 1518)
     5018  def _reduce_432(val, _values, result)
     5019     result = [] 
     5020    result
     5021  end
     5022.,.,
     5023
     5024module_eval(<<'.,.,', 'bnf.y.rb', 1519)
     5025  def _reduce_433(val, _values, result)
     5026     result = [ val[0] ]
     5027    result
     5028  end
     5029.,.,
     5030
     5031module_eval(<<'.,.,', 'bnf.y.rb', 1520)
     5032  def _reduce_434(val, _values, result)
     5033     val[0] << val[2]
     5034    result
     5035  end
     5036.,.,
     5037
     5038module_eval(<<'.,.,', 'bnf.y.rb', 1521)
     5039  def _reduce_435(val, _values, result)
     5040     result = val[0].val.gsub!( /\"(.*)\"/, "\\1" )
     5041    result
     5042  end
     5043.,.,
     5044
     5045module_eval(<<'.,.,', 'bnf.y.rb', 1522)
     5046  def _reduce_436(val, _values, result)
     5047     result = val[0].val.to_i
     5048    result
     5049  end
     5050.,.,
     5051
     5052module_eval(<<'.,.,', 'bnf.y.rb', 1523)
     5053  def _reduce_437(val, _values, result)
     5054     result = val[0].val.to_f
     5055    result
     5056  end
     5057.,.,
     5058
     5059module_eval(<<'.,.,', 'bnf.y.rb', 1524)
     5060  def _reduce_438(val, _values, result)
     5061     result = - val[0].val.to_i
     5062    result
     5063  end
     5064.,.,
     5065
     5066module_eval(<<'.,.,', 'bnf.y.rb', 1525)
     5067  def _reduce_439(val, _values, result)
     5068     result = - val[0].val.to_f
     5069    result
     5070  end
     5071.,.,
     5072
     5073module_eval(<<'.,.,', 'bnf.y.rb', 1526)
     5074  def _reduce_440(val, _values, result)
     5075     result = val[0].val.to_i
     5076    result
     5077  end
     5078.,.,
     5079
     5080module_eval(<<'.,.,', 'bnf.y.rb', 1527)
     5081  def _reduce_441(val, _values, result)
     5082     result = val[0].val.to_f
    48365083    result
    48375084  end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/bnf.y.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2016 by TOPPERS Project
     6#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    378378        | STRUCT
    379379                {
    380                         result = StructType.new()
     380                        # tag が無い場合、内部名を与える
     381                        result = StructType.new( :"TAG__#{@@no_struct_tag_num}__" )
     382                        @@no_struct_tag_num += 1
    381383                        StructType.set_define( true )
    382384                }
     
    709711        : component_description specified_statement
    710712        | component_description location_information
     713        | component_description tool_info
    711714        |
    712715
     
    738741        | import
    739742        | import_C
    740         | signature_plugin
     743        | generate_statement
    741744        | error   # エラー回復ポイント
    742745
     
    797800
    798801region_name_list
    799         : IDENTIFIER
    800                 {       result = [val[0].val]           }
    801         | region_name_list ',' IDENTIFIER
    802                 {       result << val[2].val            }
     802        : namespace_identifier
     803                {       result = [val[0]]               }
     804        | region_name_list ',' namespace_identifier
     805                {       result << val[2]                }
    803806
    804807const_statement
     
    832835                { Import.new( val[2], true ) }
    833836
    834 signature_plugin
     837generate_statement
    835838#        : GENERATE '(' plugin_name ',' namespace_identifier ',' STRING_LITERAL ')' ';'  #1ok signature plugin
    836839        : GENERATE '(' plugin_name ',' namespace_identifier ',' plugin_arg ')' ';'  #1ok signature plugin
     
    13011304                        result = [ val[0] ]
    13021305                }
     1306        | composite_celltype_statement_specifier_list ',' composite_celltype_statement_specifier
     1307                {
     1308                        Generator.add_statement_specifier val[2]
     1309                        result = val[0] << val[2]
     1310                }
    13031311
    13041312composite_celltype_statement_specifier
     
    13501358        | internal_join_list specified_join
    13511359        | internal_join_list external_join
     1360        | internal_join_list reverse_join
    13521361
    13531362external_join  # cell 内に記述する呼び口の外部結合
     
    14991508
    15001509
     1510#  JSON object
     1511tool_info        : TOOL_INFO '(' JSON_string ')' JSON_object { TOOL_INFO.new( val[2].to_sym, val[4] ) }
     1512JSON_object      : '{' JSON_property_list   '}'              {  result = val[1] }
     1513JSON_property_list : JSON_string ':' JSON_value              { result = { val[0].to_sym => val[2] } }
     1514                 | JSON_property_list ',' JSON_string ':' JSON_value
     1515                                                             { val[0][ val[2].to_sym ] = val[4] }
     1516JSON_value       : JSON_string | JSON_number | JSON_object | JSON_array
     1517                 | TRUE { result=val[0].val } | FALSE  { result=val[0].val } # JSON_NULL # null not suppoted
     1518JSON_array       : '[' JSON_array_list ']'                   { result = val[1]  }
     1519                 | '['  ']'                                  { result = []  }
     1520JSON_array_list  : JSON_value                                { result = [ val[0] ] }
     1521                 | JSON_array_list ',' JSON_value            { val[0] << val[2] }
     1522JSON_string      : STRING_LITERAL                            { result = val[0].val.gsub!( /\"(.*)\"/, "\\1" ) }
     1523JSON_number      : INTEGER_CONSTANT                          { result = val[0].val.to_i }
     1524                 | FLOATING_CONSTANT                         { result = val[0].val.to_f }
     1525                 | '-' INTEGER_CONSTANT                      { result = - val[0].val.to_i }
     1526                 | '-' FLOATING_CONSTANT                     { result = - val[0].val.to_f }
     1527                 | '+' INTEGER_CONSTANT                      { result = val[0].val.to_i }
     1528                 | '+' FLOATING_CONSTANT                     { result = val[0].val.to_f }
     1529
     1530
    15011531end
    15021532
     
    15231553    'import_C' => :IMPORT_C,
    15241554    'generate' => :GENERATE,
     1555    '__tool_info__' => :TOOL_INFO,
    15251556
    15261557    # types
     
    16581689  # すべての構文解析が完了した
    16591690  @@b_end_all_parse = false
     1691
     1692  # tag なし struct
     1693  @@no_struct_tag_num = 0
    16601694
    16611695  def self.parse( file_name, plugin = nil, b_reuse = false )
     
    17731807                  string += line
    17741808                  # この位置では error メソッドは使えない (token 読出し前)
    1775                   puts "error: #{file} line #{lineno}: string literal has newline without escape"
     1809                  puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape"
    17761810                  @@n_error += 1
    17771811                end
     
    18141848                  b_in_string = true
    18151849                  # この位置では error メソッドは使えない (token 読出し前) # mikan cdl_error ではない
    1816                   puts "error: #{file} line #{lineno}: string literal has newline without escape"
     1850                  puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape"
    18171851                  @@n_error += 1
    18181852                # 山括弧で囲まれた文字列
    1819                 when /\A<[0-9A-Za-z_\. \/]+>/   # AB: angle bracke
     1853                # when /\A<[0-9A-Za-z_\. \/]+>/   # AB: angle bracke
     1854                when /\A<(?:[^>\\]|\\.)*>/   # これはうまく行くようだ
    18201855                  @q << [:AB_STRING_LITERAL, Token.new($&, file, lineno, col)]
    18211856                # 行コメント
     
    19131948  @@n_error = 0
    19141949  @@n_warning = 0
     1950  @@n_info = 0
    19151951
    19161952  # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でエラー発生は不適切)
     
    19461982      end
    19471983      if locale then
    1948         Console.puts "error: #{locale[0]}: line #{locale[1]} #{msg}"
     1984        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: error: #{msg}"
    19491985      else
    19501986        Console.puts "error: #{msg}"
     
    19792015      end
    19802016      if locale then
    1981         Console.puts "warning: #{locale[0]}: line #{locale[1]} #{msg}"
     2017        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: warning: #{msg}"
    19822018      else
    19832019        Console.puts "warning: #{msg}"
     
    19862022  end
    19872023
     2024  # このメソッドは構文解析、意味解析からのみ呼出し可
     2025  def self.info( msg, *arg )
     2026    locale = nil
     2027    self.info2( locale, msg, *arg )
     2028  end
     2029
     2030  def self.info2( locale, msg, *arg )
     2031    @@n_info += 1
     2032
     2033    msg = TECSMsg.get_info_message( msg )
     2034    # $1, $2, ... を arg で置換
     2035    count = 1
     2036    arg.each{ |a|
     2037      str = TECSIO.str_code_convert( msg, a.to_s )
     2038      msg.sub!( /\$#{count}/, str )
     2039      count += 1
     2040    }
     2041
     2042    # import_C の中でのウォーニング?
     2043    if @@import_C then
     2044      C_parser.info( msg )
     2045    else
     2046      if @@b_end_all_parse == false || locale == nil then
     2047        locale = @@current_locale[ @@generator_nest ]
     2048      end
     2049      if locale then
     2050        Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: info: #{msg}"
     2051      else
     2052        Console.puts "info: #{msg}"
     2053      end
     2054    end
     2055  end
     2056
    19882057  def self.get_n_error
    19892058    @@n_error
     
    19942063  end
    19952064
     2065  def self.get_n_info
     2066    @@n_info
     2067  end
     2068
    19962069  def self.get_nest
    19972070    @@generator_nest
     2071  end
     2072
     2073  def self.parsing_C?
     2074    @@import_C
    19982075  end
    19992076
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/componentobj.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2016 by TOPPERS Project
     6#   Copyright (C) 2008-2019 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    7979#  @b_checked_as_allocator_signature:: bool:  アロケータシグニチャとしてチェック済み
    8080#  @b_empty:: Bool: 空(関数が一つもない状態)
     81#  @descriptor_list:: nil | { Signature => ParamDecl }  最後の ParamDecl しか記憶しないことに注意
     82#  @generate:: [ Symbol, String, Plugin ]  = [ PluginName, option, Plugin ] Plugin は生成後に追加される
     83
     84  include PluginModule
    8185
    8286  @@nest_stack_index = -1
     
    123127    @b_empty = false
    124128    @b_checked_as_allocator_signature = false
     129    @descriptor_list = nil
     130    @generate = nil
    125131    @@current_object = self
    126132    set_specifier_list( Generator.get_statement_specifier )
     
    136142    function_head_list.get_items.each{ |f|
    137143      @func_name_to_id[ f.get_name ] = id
     144      f.set_owner self
    138145      id += 1
    139146    }
     
    142149    end
    143150
     151    # set_descriptor_list ##
     152
     153    if @generate then
     154      signature_plugin
     155    end
     156
    144157    @@current_object = nil
     158
    145159    return self
    146160  end
     
    170184      when :DEVIATE
    171185        @b_deviate = true
     186      when :GENERATE
     187        if @generate then
     188          cdl_error( "S9999 generate specifier duplicate"  )
     189        end
     190        @generate = [ s[1], s[2] ] # [ PluginName, "option" ]
    172191      else
    173192        cdl_error( "S1002 \'$1\': unknown specifier for signature" , s[0] )
     
    309328  end
    310329
    311   #== Signature# 引数で参照されている Descriptor 型のリストを作成する
     330  #=== Signature# シグニチャプラグイン (generate 指定子)
     331  def signature_plugin
     332    plugin_name = @generate[0]
     333    option = @generate[1]
     334    apply_plugin( plugin_name, option )
     335  end
     336
     337  #== Signature#apply_plugin
     338  def apply_plugin plugin_name, option
     339    if is_empty? then
     340      cdl_warning( "S9999 $1 is empty. cannot apply signature plugin. ignored" , @name )
     341      return
     342    end
     343
     344    plClass = load_plugin( plugin_name, SignaturePlugin )
     345    return if plClass == nil
     346    if $verbose then
     347      print "new through: plugin_object = #{plClass.class.name}.new( #{@name}, #{option} )\n"
     348    end
     349
     350    begin
     351      plugin_object = plClass.new( self, option )
     352      plugin_object.set_locale @locale
     353    rescue Exception => evar
     354      cdl_error( "S1150 $1: fail to new" , plugin_name )
     355      print_exception( evar )
     356    end
     357    generate_and_parse plugin_object
     358end
     359
     360  #== Signature# 引数で参照されている Descriptor 型のリストを
    312361  #RETURN:: Hash { Signature => ParamDecl }:  複数の ParamDecl から参照されている場合、最後のものしか返さない
    313362  def get_descriptor_list
     363    @descriptor_list
     364  end
     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
     376  #== Signature# 引数で参照されている Descriptor 型のリストを作成する
     377  def set_descriptor_list
    314378    desc_list = { }
    315379    # p "has_desc #{@name}"
    316380    fha = get_function_head_array                       # 呼び口または受け口のシグニチャの関数配列
    317381    if fha == nil then                                  # nil の場合、自己参照によるケースと仮定
     382      @descriptor_list = desc_list
    318383      return desc_list
    319384    end
     
    330395            # p "has_desc #{param.get_name} #{t}"
    331396            if t.kind_of? DescriptorType then
    332               desc_list[t] = param
     397              desc_list[ t.get_signature ] = param
     398              # p self.get_name, t.get_signature.get_name
     399              if t.get_signature == self then
     400               # cdl_error( "S9999 Descriptor argument '$1' is the same signature as this parameter '$2' included", @name, param.get_name )
     401              end
     402              dir = param.get_direction
     403              if dir != :IN && dir != :OUT && dir != :INOUT then
     404                cdl_error( "S9999 Descriptor argument '$1' cannot be specified for $2 parameter", param.get_name, dir.to_s.downcase )
     405              end
    333406            end
    334407          }
     
    336409      end
    337410    }
    338     return desc_list
     411    @descriptor_list = desc_list
    339412  end
    340413
    341414  #=== Signature# 引数に Descriptor があるか?
    342415  def has_descriptor?
    343     # p "has_desc #{@name}"
    344     fha = get_function_head_array                       # 呼び口または受け口のシグニチャの関数配列
    345     if fha == nil then                                  # nil の場合、自己参照によるケースと仮定
     416    if get_descriptor_list == nil then
     417      # end_of_parse が呼び出される前に has_descriptor? が呼び出された
     418      # 呼び出し元は DescriptorType#initialize
     419      # この場合、同じシグニチャ内の引数が Descriptor 型である
    346420      return true
    347     end
    348     fha.each{ |fh|
    349       fd = fh.get_declarator                            # fd: Decl  (関数頭部からDeclarotorを得る)
    350       if fd.is_function? then                           # fd が関数でなければ、すでにエラー
    351         params = fd.get_type.get_paramlist.get_items
    352         if params then
    353           params.each{ |param|
    354             t = param.get_type.get_original_type
    355             while( t.kind_of? PtrType )
    356               t = t.get_referto
    357             end
    358             # p "has_desc #{param.get_name} #{t}"
    359             if t.kind_of? DescriptorType then
    360               return true
    361             end
    362           }
    363         end
    364       end
    365     }
    366     return false
     421    elsif get_descriptor_list.length > 0 then
     422      return true
     423    else
     424      return false
     425    end
    367426  end
    368427
     
    411470
    412471end
     472
     473module CelltypePluginModule
     474  #=== Celltype# セルタイププラグイン (generate 指定子)
     475  def celltype_plugin
     476    plugin_name = @generate[0]
     477    option = @generate[1]
     478    @generate[2] = apply_plugin( plugin_name, option )
     479  end
     480
     481  #=== Celltype# セルタイププラグインをこのセルタイプに適用
     482  def apply_plugin( plugin_name, option )
     483
     484    # plClass = load_plugin( plugin_name, CelltypePlugin )
     485    if kind_of? Celltype then
     486      plugin_class = CelltypePlugin
     487    elsif kind_of? CompositeCelltype then
     488      plugin_class = CompositePlugin
     489    else
     490      raise "unknown class #{self.class.name}"
     491    end
     492   
     493    plClass = load_plugin( plugin_name, plugin_class )
     494    return if plClass == nil
     495    if $verbose then
     496      print "new celltype plugin: plugin_object = #{plClass.class.name}.new( #{@name}, #{option} )\n"
     497    end
     498
     499    begin
     500      plugin_object = plClass.new( self, option )
     501      @generate_list << [ plugin_name, option, plugin_object ]
     502      plugin_object.set_locale @locale
     503      generate_and_parse plugin_object
     504    rescue Exception => evar
     505      cdl_error( "S1023 $1: fail to new" , plugin_name )
     506      print_exception( evar )
     507    end
     508
     509    # 既に存在するセルに new_cell を適用
     510    @cell_list.each{ |cell|
     511      apply_plugin_cell plugin_object, cell
     512    }
     513
     514    return plugin_object
     515  end
     516
     517  def apply_plugin_cell plugin, cell
     518    begin
     519      plugin.new_cell cell
     520    rescue Exception => evar
     521      cdl_error( "S1037 $1: celltype plugin fail to new_cell" , plugin.class.name )
     522      print_exception( evar )
     523    end
     524  end
     525
     526  def celltype_plugin_new_cell cell
     527    @generate_list.each{ |generate|
     528      celltype_plugin = generate[2]
     529      begin
     530        celltype_plugin.new_cell cell
     531      rescue Exception => evar
     532        cdl_error( "S1037 $1: celltype plugin fail to new_cell" , celltype_plugin.class.name )
     533        print_exception( evar )
     534      end
     535    }
     536  end
     537end #CelltypePluginModule
    413538
    414539class Celltype < NSBDNode # < Nestable
     
    423548# @ct_factory_list::    Factory[] :    celltype factory
    424549# @cell_list:: Cell[] : 定義のみ (V1.0.0.2 以降)
     550# @ordered_cell_list:: Cell[] : ID 順に順序付けされたセルリスト、最適化以降有効 (リンク単位ごとに生成されなおす)
    425551# @singleton:: bool
    426552# @idx_is_id:: bool
    427553# @idx_is_id_act:: bool: actual value
     554# @b_need_ptab:: bool: true if having cells in multi-domain
    428555# @active:: bool
    429556# @b_reuse:: bool :  reuse 指定されて import された(template 不要)
    430557# @generate:: [ Symbol, String, Plugin ]  = [ PluginName, option, Plugin ] Plugin は生成後に追加される
     558# @generate_list:: [ [ Symbol, String, Plugin ], ... ]   generate 文で追加された generate
    431559#
    432560# @n_attribute_ro:: int >= 0    none specified
     
    437565# @n_var_omit:: int >= 0        # of [omit] specified vars # mikan var の omit は有?
    438566# @n_var_init:: int >= 0        # of vars with initializer
    439 # @n_call_port:: int >= 0
    440 # @n_call_port_array:: int >= 0
     567# @n_call_port:: int >= 0       # dynamic ports are included
     568# @n_call_port_array:: int >= 0  # dynamic ports are included
    441569# @n_call_port_omitted_in_CB:: int >= 0   最適化で省略される呼び口
     570# @n_call_port_dynamic:: int >= 0  #
     571# @n_call_port_array_dynamic:: int >= 0
     572# @n_call_port_ref_desc:: int >= 0  #
     573# @n_call_port_array_ref_desc:: int >= 0
    442574# @n_entry_port:: int >= 0
    443575# @n_entry_port_array:: int >= 0
     
    455587
    456588  include PluginModule
    457 
     589  include CelltypePluginModule
     590 
    458591  @@nest_stack_index = -1
    459592  @@nest_stack = []
     
    496629    @active = false
    497630    @generate = nil
     631    @generate_list = []
    498632
    499633    @n_attribute_ro = 0
     
    507641    @n_call_port_array = 0
    508642    @n_call_port_omitted_in_CB = 0
     643    @n_call_port_dynamic = 0
     644    @n_call_port_array_dynamic = 0
     645    @n_call_port_ref_desc = 0
     646    @n_call_port_array_ref_desc = 0
    509647    @n_entry_port = 0
    510648    @n_entry_port_array = 0
     
    528666    if $idx_is_id then
    529667      @idx_is_id = true
     668      @idx_is_id_act = true
     669      @b_need_ptab = true
    530670    else
    531671      @idx_is_id = false
    532     end
    533     @idx_is_id_act = @idx_is_id
     672      @idx_is_id_act = false
     673      @b_need_ptab = false
     674    end
    534675
    535676    Namespace.new_celltype( self )
    536677    set_namespace_path # @NamespacePath の設定
    537678    set_specifier_list( Generator.get_statement_specifier )
    538 
    539     if @singleton then
    540       @idx_is_id_act = false
    541     end
    542679
    543680    @included_header = {}
     
    577714      celltype_plugin
    578715    end
     716
     717    # check_dynamic_join ##
    579718
    580719    @@current_object = nil
     
    592731      @n_call_port += 1
    593732      @n_call_port_array += 1 if port.get_array_size != nil
     733      if port.is_dynamic? then
     734        @n_call_port_dynamic += 1
     735        @n_call_port_array_dynamic += 1 if port.get_array_size != nil
     736      end
     737      if port.is_ref_desc? then
     738        @n_call_port_ref_desc += 1
     739        @n_call_port_array_ref_desc += 1 if port.get_array_size != nil
     740      end
    594741    else
    595742      @n_entry_port += 1
     
    753900      when :IDX_IS_ID
    754901        @idx_is_id = true
     902        @idx_is_id_act = true
     903        @b_need_ptab = true
    755904      when :ACTIVE
    756905        @active = true
     
    764913      end
    765914    }
     915    if @singleton then
     916      @idx_is_id_act = false
     917      @b_need_ptab = false
     918    end
    766919  end
    767920
     
    8631016  end
    8641017
    865   #=== Celltype# セルタイププラグイン (generate 指定子)
    866   def celltype_plugin
    867 
    868     load_plugin( @generate[0], CelltypePlugin )
    869 
    870     plugin_name = @generate[0]
    871     option = @generate[1]
    872     plugin_object = nil
    873     eval_str = "plugin_object = #{plugin_name}.new( self, option )"
    874     if $verbose then
    875       print "new celltype : #{eval_str}\n"
    876     end
    877 
    878     begin
    879       eval( eval_str )     # plugin を生成
    880       plugin_object.set_locale @locale
    881       @generate[ 2 ] = plugin_object
    882       generate_and_parse plugin_object
    883     rescue Exception => evar
    884       cdl_error( "S1023 $1: fail to new" , plugin_name )
    885       print "eval( #{eval_str} )\n"
    886 
    887       print_exception( evar )
    888     end
     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
     1028  #=== Celltype#dynamic の適合性チェック
     1029  def check_dynamic_join
     1030    return if ! $verbose
     1031    @port.each{ |port|
     1032      signature = port.get_signature
     1033      next if signature == nil   # すでにエラー
     1034      if port.is_dynamic? then
     1035        dbgPrint( "[DYNAMIC] checking dynamic port: #{@global_name}.#{port.get_name}\n" )
     1036        # print( "[DYNAMIC] checking dynamic port: #{@global_name}.#{port.get_name}\n" )
     1037        next if find_ref_desc_port signature
     1038        next if find_descriptor_param signature, :DYNAMIC
     1039        cdl_warning( 'W9999 $1 cannot get information for dynamic port $2', @name, port.get_name )
     1040      elsif port.is_ref_desc? then
     1041        dbgPrint( "[DYNAMIC] checking ref_desc port: #{@global_name}.#{port.get_name}\n" )
     1042        # print( "[DYNAMIC] checking ref_desc port: #{@global_name}.#{port.get_name}\n" )
     1043        next if find_dynamic_port signature
     1044        next if find_descriptor_param signature, :REF_DESC
     1045        cdl_warning( 'W9999 $1 cannot put information from ref_desc port $2', @name, port.get_name )
     1046      elsif port.get_signature then
     1047        if port.get_signature.has_descriptor? then
     1048          port.get_signature.get_descriptor_list.each{ |signature, param|
     1049            dbgPrint( "[DYNAMIC] checking Descriptor parameter: #{@global_name}.#{port.get_name} ... #{param.get_name}\n" )
     1050            # print( "[DYNAMIC] checking Descriptor parameter: #{@global_name}.#{port.get_name} ... #{param.get_name}\n" )
     1051            if port.get_port_type == :CALL then
     1052              if param.get_direction == :IN
     1053                next if find_ref_desc_port signature
     1054                next if find_descriptor_param signature, :DYNAMIC
     1055              elsif param.get_direction == :OUT
     1056                next if find_dynamic_port signature
     1057                next if find_descriptor_param signature, :REF_DESC
     1058              end
     1059            else  # :ENTRY
     1060              if param.get_direction == :IN
     1061                next if find_dynamic_port signature
     1062                next if find_descriptor_param signature, :REF_DESC
     1063              elsif param.get_direction == :OUT
     1064                next if find_ref_desc_port signature
     1065                next if find_descriptor_param signature, :DYNAMIC
     1066              end
     1067            end
     1068            cdl_warning( 'W9999 "$1" cannot handle Descriptor "$2" information for port "$3"', @name, param.get_name, port.get_name )
     1069          }
     1070        end
     1071      end
     1072    }
     1073  end
     1074
     1075  def find_dynamic_port signature
     1076    dbgPrint "[DYNAMIC] find_dynamic_port signature=#{signature.get_name}"
     1077    @port.each{ |port|
     1078      dbgPrint "[DYNAMIC] port=#{port.get_name} signature=#{port.get_signature.get_name} dynamic=#{port.is_dynamic?}"
     1079      return port if port.is_dynamic? && port.get_signature == signature
     1080    }
     1081    return nil
     1082  end
     1083  def find_ref_desc_port signature
     1084    if signature == nil then  # すでにエラー
     1085      return nil
     1086    end
     1087    dbgPrint "[DYNAMIC] find_ref_desc_port signature=#{signature.get_name}"
     1088    @port.each{ |port|
     1089      dbgPrint "[DYNAMIC] port=#{port.get_name} signature=#{port.get_signature.get_name} ref_desc=#{port.is_ref_desc?}"
     1090      return port if port.is_ref_desc? && port.get_signature == signature
     1091    }
     1092    return nil
     1093  end
     1094  #=== Celltype#ディスクリプタ型でシグニチャが一致し dyn_ref に対応づく引数を探す
     1095  #dyn_ref::Symbol: :DYNAMIC=ディスクリプタを得る手段となる引数を探す.:REF_DESC=渡す手段となる引数を探す
     1096  def find_descriptor_param signature, dyn_ref
     1097    param_list = []
     1098    @port.each{ |port|
     1099      port.each_param{ |port, func, param|
     1100        type = param.get_type
     1101        while type.kind_of? PtrType
     1102          type = type.get_type
     1103        end
     1104        dbgPrint( "[DYNAMIC] dyn_ref=#{dyn_ref} port_type=#{port.get_port_type} dir=#{param.get_direction} paramName=#{param.get_name} paramType=#{type.class}\n" )
     1105        # print( "[DYNAMIC] dyn_ref=#{dyn_ref} port_type=#{port.get_port_type} dir=#{param.get_direction} paramName=#{param.get_name} paramType=#{type.class}\n" )
     1106        if type.kind_of? DescriptorType then
     1107          if type.get_signature == signature then
     1108            dir = param.get_direction
     1109            if dir == :INOUT then
     1110              dbgPrint( "[DYNAMIC] found INOUT Descriptor parameter: #{@global_name}.#{port.get_name} ... #{param.get_name}\n" )
     1111              # print( "[DYNAMIC] found INOUT Descriptor parameter: #{@global_name}.#{port.get_name} ... #{param.get_name}\n" )
     1112              return param
     1113            elsif dyn_ref == :DYNAMIC then
     1114              if dir == :IN && port.get_port_type == :ENTRY ||
     1115                 dir == :OUT && port.get_port_type == :CALL then
     1116                dbgPrint( "[DYNAMIC] found INBOUND Descriptor parameter: #{@global_name}.#{port.get_name} ... #{param.get_name}\n" )
     1117                # print( "[DYNAMIC] found INBOUND Descriptor parameter: #{@global_name}.#{port.get_name} ... #{param.get_name}\n" )
     1118                return param
     1119              end
     1120            elsif dyn_ref == :REF_DESC
     1121              if dir == :IN && port.get_port_type == :CALL ||
     1122                 dir == :OUT && port.get_port_type == :ENTRY then
     1123                dbgPrint( "[DYNAMIC] found OUTBOUND Descriptor parameter: #{@global_name}.#{port.get_name} ... #{param.get_name}\n" )
     1124                # print( "[DYNAMIC] found OUTBOUND Descriptor parameter: #{@global_name}.#{port.get_name} ... #{param.get_name}\n" )
     1125                return param
     1126              end
     1127            else
     1128              raise "unknown ref_desc"
     1129            end
     1130          end
     1131        end
     1132      }
     1133    }
     1134    return nil
    8891135  end
    8901136
     
    8951141  # シングルトンセルが同じ linkunit に複数ないかチェック
    8961142  def new_cell( cell )
     1143    dbgPrint "Celltype#new_cell( #{cell.get_name} )\n"
    8971144    # Celltype では Cell の set_owner しない
    8981145    # シングルトンで、プロトタイプ宣言でない場合、コード生成対象リージョンの場合
     
    9051152    end
    9061153    @cell_list << cell
     1154
     1155    # プラグインにより生成されたセルタイプか ?
    9071156    if @plugin then
    9081157      @plugin.new_cell cell
    9091158    end
     1159
     1160    # セルタイププラグインの適用
     1161    celltype_plugin_new_cell cell
    9101162  end
    9111163
     
    9191171  #     呼び口(ただし、最適化で不要となるものは除く)
    9201172  def has_INIB?
    921 #    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"
    922     return $rom && (@n_attribute_ro > 0 || @n_var_size_is > 0 || ( @n_call_port - @n_call_port_omitted_in_CB ) > 0 || @n_entry_port_array_ns > 0)
    923 #    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
    9241183  end
    9251184
     
    9341193  def has_CB?
    9351194    if $rom then
    936       return @n_attribute_rw > 0 || (@n_var-@n_var_size_is) > 0
     1195      return @n_attribute_rw > 0 || (@n_var-@n_var_size_is) > 0 || (@n_call_port_dynamic - @n_call_port_array_dynamic) > 0
    9371196      # return @n_attribute_rw > 0 || @n_var > 0
    9381197    else
     
    9431202  #=== Celltype# SET_CB_INIB_POINTER, INITIALIZE_CB が必要か
    9441203  def need_CB_initializer?
    945     @n_var_init > 0 || has_CB?
     1204    @n_var_init > 0 || has_CB? || ( @n_call_port_dynamic && $ram_initializer )
    9461205  end
    9471206
     
    9981257  def is_active?
    9991258    @active
     1259  end
     1260
     1261  def idx_is_id_act?
     1262    @idx_is_id_act
     1263  end
     1264
     1265  def multi_domain?
     1266    @b_need_ptab
    10001267  end
    10011268
     
    11201387#                                               逆require ポートに対して複数の結合がないかチェックする
    11211388# @generate:: [ Symbol, String, Plugin ]  = [ PluginName, option, Plugin ] Plugin は生成後に追加される
     1389# @b_post_code_generated:: Bool: true if generated in tmp_plugin_post_code.cdl
    11221390#
    11231391# composite のためインスタンス変数
     
    11421410# @id:: Integer : コード生成直前に設定  (プロトタイプ宣言の場合は -1 のまま放置)
    11431411# @id_specified::Integer : 指定された id
    1144 # @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 が参照れた
    11451415
    11461416=begin
     
    11871457  end
    11881458
    1189 
    1190   # composite で clone されたもの(子孫まで含む)
    1191   # Join.change_rhs_port にて CompoisteCelltype 内の Join の結合先を変更する際に使用
    1192   @@cloned_cell_list = {}
    1193   ### mikan BUG @@cloned_cell_list は composite の階層ごとに記憶していないため、同じ名前が内部に現れると、うまく動作しない
    1194   # change_rhs_port の実装は、こんな回りくどいことをする必要はなかった。右辺に現れるセル名には、composite のセル名を前につなげるだけでよかった
    1195 
    11961459  def initialize( ct_path, in_composite = false )
    11971460    super()
     
    12331496    @referenced_port_list = {}
    12341497    @restrict_list = {}
     1498    @restrict_list2 = {}
     1499    @b_restrict_referenced = false
     1500    @b_post_code_generated = false
    12351501
    12361502    @cell_list = {}
     
    12581524      cell_prev = CompositeCelltype.find( name )
    12591525      if cell_prev == nil then
    1260         CompositeCelltype.new_cell( self )
     1526        CompositeCelltype.new_cell_in_composite( self )
    12611527      end
    12621528    else
     
    14371703
    14381704    else
     1705      dbgPrint "new_join: cell=#{@name} add_item=#{join.get_name}\n"
    14391706      # join
    14401707      @join_list.add_item( join )
     
    15001767
    15011768        # 呼び口側のセルと、そのセルタイプ
    1502         cell = Namespace.find cp_cell_nsp
     1769        if ! @in_composite then
     1770          cell = Namespace.find cp_cell_nsp
     1771        else
     1772          cell = CompositeCelltype.find cp_cell_nsp.to_s.to_sym
     1773        end
     1774
    15031775        if ! cell.instance_of? Cell then
    15041776          cdl_error( "S9999 '$1': not cell for reverse join", cp_cell_nsp.get_path_str )
     
    15101782        end
    15111783
    1512         ep_cell_nsp = get_namespace_path
     1784        if ! @in_composite then
     1785          ep_cell_nsp = get_namespace_path
     1786          ep_cell_nsp_str = ep_cell_nsp.get_path_str
     1787        else
     1788          ep_cell_nsp = NamespacePath.new @name, false
     1789          ep_cell_nsp_str = @name
     1790        end
    15131791        ep_subscript_val = ep_subscript ? ep_subscript.eval_const( nil ) : nil
    15141792        rhs = Expression.create_cell_join_expression( ep_cell_nsp, ep_subscript_val, ep_name, rj.get_locale )
     
    15211799          ss_str = ""
    15221800        end
    1523         dbgPrint "create_reverse_join: #{cell.get_name}.#{cp_name}#{ss_str} => #{ep_cell_nsp.get_path_str}.ep_name\n"
     1801        dbgPrint "create_reverse_join: #{cell.get_name}.#{cp_name}#{ss_str} => #{ep_cell_nsp_str}.#{ep_name}\n"
    15241802      }
    15251803    end
     
    15651843      set_specifier_list( Generator.get_statement_specifier )
    15661844    end
     1845    if TECSGEN.post_coded?
     1846      @b_post_code_generated = true
     1847    end
    15671848    set_f_def f_def
    15681849
     
    15811862
    15821863    if ! @in_composite then
    1583       if @celltype.instance_of? Celltype then
     1864      # if @celltype.instance_of? Celltype then
     1865      if @celltype then  # composite でも呼びだす, エラー時 nil
    15841866        @celltype.new_cell self
    15851867      end
     
    17021984  end
    17031985
    1704   #=== Cell# セルタイププラグイン (generate 指定子)
     1986  #=== Cell# セルプラグイン (generate 指定子)
    17051987  def cell_plugin
    1706 
    1707     load_plugin( @generate[0], CellPlugin )
    1708 
    17091988    plugin_name = @generate[0]
    17101989    option = @generate[1]
    1711     plugin_object = nil
    1712     eval_str = "plugin_object = #{plugin_name}.new( self, option )"
     1990    @generate[2] = apply_plugin plugin_name, option
     1991  end
     1992
     1993  def apply_plugin plugin_name, option
     1994    if ! @b_defined then
     1995      cdl_error( "S9999 plugin cannot apply to prototype cell '$1'", @name )
     1996    end
     1997
     1998    plClass = load_plugin( plugin_name, CellPlugin )
     1999    # return if plClass == nil # 従来と仕様が変わるので、継続する
    17132000    if $verbose then
    1714       print "new cell : #{eval_str}\n"
     2001      print "new cell plugin: plugin_object = #{plClass.class.name}.new( #{@name}, #{option} )\n"
    17152002    end
    17162003
    17172004    begin
    1718       eval( eval_str )     # plugin を生成
     2005      plugin_object = plClass.new( self, option )
    17192006      plugin_object.set_locale @locale
    1720       @generate[ 2 ] = plugin_object
    17212007      generate_and_parse plugin_object
    17222008    rescue Exception => evar
    17232009      cdl_error( "S1166 $1: fail to new", plugin_name )
    1724       print "eval( #{eval_str} )\n"
    1725 
    17262010      print_exception( evar )
    17272011    end
     2012    return  plugin_object
    17282013  end
    17292014
     
    17422027
    17432028    # debug
    1744     dbgPrint "Cell#clone_for_composite : cloning: #{@name} #{global_name}  b_defined=#{@b_defined}\n"
     2029    dbgPrint "  CLONING Cell#clone_for_composite : cloning: #{@name} #{global_name}  b_defined=#{@b_defined} #{self}=>#{@my_clone} \n"
     2030    dbgPrint "              my_name=#{@name} name=#{name} owner class=#{@owner.class.name}\n"
    17452031
    17462032    @my_clone = self.clone
    1747     @@cloned_cell_list[ self ] = @my_clone
    17482033
    17492034    # clone したセルの内部に持つ名前情報を調整する
    1750 
    17512035    @my_clone.set_cloned( name, global_name, namespacePath, join_array, ct_name, region, plugin, locale )
    17522036
     
    17722056    # debug
    17732057    dbgPrint "cell.set_cloned : global_name: #{global_name}  name: #{name}  @name: #{@name}\n"
    1774 
     2058    dbgPrint "set_cloned:  entry_array_max_subscript.len=#{@entry_array_max_subscript.length}\n"
    17752059    @global_name = :"#{global_name}_#{@name}"
    17762060    @name = :"#{name}_#{@name}"
     
    17962080    @alloc_list = []
    17972081    @require_joined_list = {}
    1798     @entry_array_max_subscript = {}
     2082    @entry_array_max_subscript = @entry_array_max_subscript.dup
    17992083    @cell_list = {}
    18002084    @cell_list2 = []
     
    18052089      @join_list.change_item j
    18062090    }
     2091  end
     2092
     2093  #=== clone されたセルが composite の場合、内部セルを展開する
     2094  #self:: clone されたセルでなければならない
     2095  def expand_inner
     2096    if ! @f_cloned then
     2097      raise "expnad_inner: not cloned cell"
     2098    end
    18072099
    18082100    # clone しようとするセルが composit セルタイプ?
     
    18112103      @cell_list, @cell_list2 = @celltype.expand( @name, @global_name, @NamespacePath, @join_list, @region, @plugin, @locale )
    18122104    end
    1813 
    18142105  end
    18152106
    18162107  #=== Cell# clone された cell の join_list の右辺の変更
    18172108  #  呼び口の右辺の cell を他の clone された cell に置換え
    1818   def change_rhs_port
     2109  def change_rhs_port cloned_cell_list
    18192110
    18202111    # debug
    1821     dbgPrint "Cell change_rhs_port: global_name: #{@global_name}\n"
     2112    dbgPrint "=====   Cell#change_rhs_port: name=#{@name}   =====\n"
    18222113
    18232114    @join_list.get_items.each { |j|
    1824       j.change_rhs_port( @@cloned_cell_list, @celltype )
    1825     }
    1826 
    1827     if @celltype.instance_of?( CompositeCelltype ) then
    1828 
    1829       # 入れ子のセルについても変更
    1830       @cell_list.each{ |name,c|
    1831         c.change_rhs_port
    1832       }
    1833     end
     2115      j.change_rhs_port( cloned_cell_list, @celltype )
     2116    }
    18342117  end
    18352118
     
    18912174  def is_in_composite?
    18922175    @in_composite
     2176  end
     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
    18932190  end
    18942191
     
    19802277
    19812278      # セルタイプ内で port_name の CompositeCelltypeJoin を探す(コード生成段階では必ず見つかる)
     2279      # print "get_real_cell: cell=#{@name} port=#{port_name}\n"
     2280      # pp @cell_list
    19822281      cj = @celltype.find_export( port_name )
    19832282
     
    19912290  end
    19922291
     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
    19932301
    19942302  #=== Cell# 受け口のport の参照カウントをアップする
     
    20332341  end
    20342342
     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
     2353  end
     2354
    20352355  def get_celltype
    20362356    @celltype
     
    20752395  #=== Cell# composite の内側セルの受け口配列の添数の最大値を設定
    20762396  def set_entry_inner_port_max_subscript( port, num )
    2077     if @cell_list == nil then   # mikan これって問題ない?
    2078       return    # プロトタイプ宣言しかされていなくて、内側セルが展開されていない
     2397    if @cell_list == nil then
     2398      return    # プロトタイプ宣言しかされていなくて、内側セルが展開されていない or composite 展開前
    20792399    end
    20802400
    20812401    # composite の内側のセルに伝播
    20822402    if @celltype.instance_of? CompositeCelltype then
     2403      dbgPrint "set_entry_inner_port_max_subscript #{@name} #{@port} #{num} cell_list.len=#{@cell_list.length}\n"
     2404      # @cell_list.each{ |c, p| print c, p, '\n' }
     2405
    20832406      cj = @celltype.find_export port.get_name
    20842407      if cj && @cell_list[ cj.get_cell_name.to_s ] then
     
    22782601        else
    22792602          cell = j.get_rhs_cell2
    2280           next if cell == nil     # 右辺が見つからなかった.既にエラー
     2603          next if cell == nil || cell.get_celltype == nil     # 右辺が見つからなかった.既にエラー
    22812604          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
    22822611          dbgPrint( "set_port_reference_count: #{@name}.#{j.get_name} => #{cell.get_name}.#{port.get_name}\n")
    22832612          cell.port_referenced port
     
    26723001          }
    26733002        else
     3003          dbgPrint "set_definition_join: #{@name}.#{join.get_name} celltype=#{@celltype.get_name}\n"
    26743004          join.set_definition( @celltype.find(join.get_name) )
    26753005        end
     
    26873017      expand
    26883018    end
    2689 
    2690     # celltype に generate が指定されされているか
    2691     celltype_plugin = @celltype.get_celltype_plugin
    2692     if celltype_plugin then
    2693       begin
    2694         celltype_plugin.new_cell self
    2695       rescue Exception => evar
    2696         cdl_error( "S1037 $1: celltype plugin fail to new_cell" , celltype_plugin.class.name )
    2697         print_exception( evar )
    2698       end
    2699     end
    27003019  end
    27013020
     
    27053024
    27063025    #debug
    2707     dbgPrint "expanding #{@name} #{@celltype.get_name}\n"
    2708 
    2709     # 展開されたセルのリスト
    2710     @@cloned_cell_list = {}
     3026    dbgPrint "=====    expanding   #{@name}     =====\n"
    27113027
    27123028    # composite celltype の cell を展開
     
    27183034      set_f_ref
    27193035    end
    2720 
    2721     # 呼び口の右辺のセルを clone したものに変更
    2722     self.change_rhs_port
     3036  end
     3037
     3038  #=== Cell#内部セルの受け口添数最大値を設定
     3039  def set_max_entry_port_inner_cell
     3040    if @cell_list == nil then
     3041      return
     3042    end
     3043
     3044    dbgPrint "set_max_entry_port_inner_cell name=#{@name} entry_array_max_subscript.len=#{@entry_array_max_subscript.length}\n"
    27233045
    27243046    # プロトタイプ宣言で設定されていたものを反映する
    27253047    @entry_array_max_subscript.each{ |port,name|
     3048      dbgPrint "set_entry_inner_port_max_subscript( #{port}, #{name} )\n"
    27263049      set_entry_inner_port_max_subscript( port, name )
    27273050    }
     
    27303053  #=== Cell#restrict を追加
    27313054  def add_restrict( entry_name, func_name, region_name_list )
    2732     if @restrict_list[ entry_name ] then
    2733       if @restrict_list[ entry_name ][ func_name ] then
    2734         @restrict_list[ entry_name ][ func_name ].each{ |rn|
    2735           if region_name_list.include? rn then
    2736             # p func_name
    2737             name = func_name ? entry_name : entry_name+"."+func_name
    2738             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
    27393125          end
    27403126        }
    27413127      else
    2742         @restrict_list[ entry_name ][ func_name ] = region_name_list
    2743       end
    2744     else
    2745       func_list = { }
    2746       func_list[ func_name ] = region_name_list
    2747       @restrict_list[ entry_name ] = func_list
    2748     end
    2749     # pp @restrict_list
    2750   end
    2751 
    2752   #=== Cell#check_restrict_list
    2753   def check_restrict_list
    2754     @restrict_list.each{ |entry_name, func_hash|
    2755       func_hash.each{ |func_name, region_list|
    2756         region_list.each{ |rn|
    2757           obj = Namespace.find [ rn ]
    2758           if ( obj.kind_of? Region ) then
    2759             if obj.get_domain_root != @region.get_domain_root then
    2760             else
    2761               cdl_warning( "W9999 $1 in same domain", rn )
    2762             end
    2763           else
    2764             cdl_error( "S9999 $1 not region", region )
    2765           end
    2766         }
    2767       }
    2768     }
    2769   end
    2770 
    2771   #=== Cell#callable?
    2772   def callable?( callee_cell, entry_name, func_name )
    2773     res = callee_cell.callable_from?( entry_name, func_name, self )
    2774     dbgPrint "callable? #{callee_cell.get_namespace_path}.#{entry_name}.#{func_name} from #{@NamespacePath} is #{res}\n"
    2775     return res
    2776   end
    2777 
    2778   #=== Cell#callable_from? (private)
    2779   def callable_from?( entry_name, func_name, caller_cell )
    2780     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
    27813156      return true
    2782     end
    2783 
    2784     if @restrict_list[entry_name] then
    2785       if @restrict_list[entry_name][nil] &&
    2786          @restrict_list[entry_name][nil].include?( caller_cell.get_region.get_domain_root.get_name )then
    2787         return true
    2788       end
    2789       if @restrict_list[entry_name][func_name] &&
    2790          @restrict_list[entry_name][func_name].include?( caller_cell.get_region.get_domain_root.get_name )then
    2791         return true
    2792       else
    2793         return false
    2794       end
    2795     else
    2796       return true
    2797     end
    2798   end
    2799  
     3157    else
     3158      return false
     3159    end
     3160  end
     3161
    28003162  def show_tree( indent )
    28013163    indent.times { print "  " }
     
    28573219# @name:: str
    28583220# @global_name:: str
    2859 # @cell_list:: NamedList   Cell
     3221# @cell_list_in_composite:: NamedList   Cell
     3222# @cell_list::Array :: [ Cell ] : cell of CompositeCelltype's cell
    28603223# @export_name_list:: NamedList : CompositeCelltypeJoin
    28613224# @port_list:: CompositeCelltypeJoin[]
     
    28673230# @name_list:: NamedList item: Decl (attribute), Port エクスポート定義
    28683231# @internal_allocator_list:: [ [cell, internal_cp_name, port_name, func_name, param_name, ext_alloc_ent], ... ]
     3232# @generate:: [ Symbol, String, Plugin ]  = [ PluginName, option, Plugin ] Plugin は生成後に追加される
     3233# @generate_list:: [ [ Symbol, String, Plugin ], ... ]   generate 文で追加された generate
    28693234
    28703235  @@nest_stack_index = -1
    28713236  @@nest_stack = []
    28723237  @@current_object = nil
     3238
     3239  include CelltypePluginModule
     3240  include PluginModule
    28733241
    28743242  def self.push
     
    28893257    super()
    28903258    @name = name
    2891     @cell_list = NamedList.new( nil, "in composite celltype #{name}" )
     3259    @cell_list_in_composite = NamedList.new( nil, "in composite celltype #{name}" )
     3260    @cell_list = []
    28923261    @export_name_list = NamedList.new( nil, "export in composite celltype #{name}" )
    28933262    @name_list = NamedList.new( nil, "in composite celltype #{name}" )
     
    29103279    @attr_list = []
    29113280    @internal_allocator_list = []
     3281    @generate_list = []
    29123282    set_specifier_list( Generator.get_statement_specifier )
    29133283  end
     
    29203290  # CompositeCelltype#end_of_parse
    29213291  def end_of_parse
    2922 
    29233292    # singleton に関するチェック
    29243293    if @b_singleton && @real_singleton == nil then
     
    29603329    # mikan relay が正しく抜けているかチェックされていない
    29613330
     3331    # callback 結合
     3332    @cell_list_in_composite.get_items.each{ |c|
     3333      ct = c.get_celltype
     3334      if ct then
     3335        c.create_reverse_join
     3336      end
     3337    }
     3338
    29623339    # 意味解析
    2963     @cell_list.get_items.each{ |c|
     3340    @cell_list_in_composite.get_items.each{ |c|
    29643341      c.set_definition_join
    29653342    }
    29663343
    29673344    # cell の未結合の呼び口がないかチェック
    2968     @cell_list.get_items.each{ |c|
     3345    @cell_list_in_composite.get_items.each{ |c|
    29693346      c.check_join
    29703347      c.check_reverse_require
     
    30043381      }
    30053382    }
    3006   end
    3007 
    3008  ### cell (CompositeCelltype)
    3009   def self.new_cell( cell )
    3010     @@current_object.new_cell( cell )
    3011 
    3012   end
    3013 
    3014   def new_cell( cell )
     3383
     3384    # composite プラグイン
     3385    if @generate then
     3386      celltype_plugin
     3387    end
     3388  end
     3389
     3390 ### CompositeCelltype#new_cell_in_composite
     3391  def self.new_cell_in_composite( cell )
     3392    @@current_object.new_cell_in_composite( cell )
     3393
     3394  end
     3395
     3396  def new_cell_in_composite( cell )
    30153397    cell.set_owner self  # Cell (in_omposite)
    3016     @cell_list.add_item( cell )
     3398    @cell_list_in_composite.add_item( cell )
    30173399    if cell.get_celltype then    # nil ならば、すでにセルタイプなしエラー
    30183400      if cell.get_celltype.is_singleton? then
     
    30313413                                         internal_cell_elem_name, type )
    30323414   
     3415  end
     3416
     3417 ### CompositeCelltype#new_cell
     3418  def new_cell cell
     3419    @cell_list << cell
     3420
     3421    # セルタイププラグインの適用
     3422    celltype_plugin_new_cell cell
    30333423  end
    30343424
     
    30503440    dbgPrint "new_join: #{export_name} #{internal_cell_name} #{internal_cell_elem_name}\n"
    30513441
    3052     cell = @cell_list.get_item( internal_cell_name )
     3442    cell = @cell_list_in_composite.get_item( internal_cell_name )
    30533443    if cell == nil then
    30543444      cdl_error( "S1057 $1 not found in $2" , internal_cell_name, @name )
     
    31073497        elsif obj.is_omit? != obj2.is_omit? then
    31083498          cdl_error( "S9999 $1 : omit specifier mismatch with previous definition" , export_name )
     3499        elsif obj.is_dynamic? != obj2.is_dynamic? then
     3500          cdl_error( "S9999 $1 : dynamic specifier mismatch with previous definition" , export_name )
     3501        elsif obj.is_ref_desc? != obj2.is_ref_desc? then
     3502          cdl_error( "S9999 $1 : ref_desc specifier mismatch with previous definition" , export_name )
    31093503        end
    31103504      else
     
    32923686  def find name
    32933687    dbgPrint "CompositeCelltype: find in composite: #{name}\n"
    3294     cell = @cell_list.get_item( name )
     3688    cell = @cell_list_in_composite.get_item( name )
    32953689    return cell if cell
    32963690
     
    33333727    clone_cell_list = {}
    33343728    clone_cell_list2 = []
     3729    clone_cell_list3 = {}
    33353730
    33363731    #  composite 内部のすべての cell について
    3337     @cell_list.get_items.each { |c|
     3732    @cell_list_in_composite.get_items.each { |c|
    33383733
    33393734      # debug
     
    33593754          # debug
    33603755          if j then
    3361             dbgPrint "expand : parent cell: #{name} child cell: #{c.get_name}:  parent's export port: #{cj.get_name}  join: #{j.get_name} #{j}\n"
     3756            dbgPrint "  REWRITE_EX parent cell: #{name} child cell: #{c.get_name}:  parent's export port: #{cj.get_name}  join: #{j.get_name}=>#{j.get_rhs.to_s}\n"
    33623757          else
    33633758            dbgPrint "expand : parent cell: #{name} child cell: #{c.get_name}:  parent's export port: #{cj.get_name}  join: nil\n"
     
    33943789      clone_cell_list[ "#{c.get_local_name}" ] = c2
    33953790      clone_cell_list2 << c2
     3791      clone_cell_list3[ c ] = c2
    33963792
    33973793    }
     
    34033799        j.set_cloned( clone_cell_list[ "#{c.get_local_name}" ] )
    34043800      }
     3801      dbgPrint "change_rhs_port: inner cell #{c.get_name}\n"
     3802      c.change_rhs_port clone_cell_list3
     3803    }
     3804    clone_cell_list2.each { |c|
     3805      c.expand_inner
    34053806    }
    34063807    return [ clone_cell_list, clone_cell_list2 ]
     
    34193820      when :ACTIVE
    34203821        @b_active = true
     3822      when :GENERATE
     3823        if @generate then
     3824          cdl_error( "S9999 generate specifier duplicate"  )
     3825        end
     3826        @generate = [ s[1], s[2] ] # [ PluginName, "option" ]
    34213827      else
    34223828        cdl_error( "S1071 $1 cannot be specified for composite" , s[0] )
     
    34293835  end
    34303836
     3837  def get_global_name
     3838    @global_name
     3839  end
     3840
    34313841  def get_port_list
    34323842    @port_list
     
    34433853  def get_internal_allocator_list
    34443854    @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
    34453867  end
    34463868
     
    34653887  def is_inactive?
    34663888    if @b_active == false then
    3467       @cell_list.get_items.each{ |c|
     3889      @cell_list_in_composite.get_items.each{ |c|
    34683890        if c.get_celltype && c.get_celltype.is_inactive? == false then
    34693891          # c.get_celltype == nil の場合はセルタイプ未定義ですでにエラー
     
    34863908    (indent+1).times { print "  " }
    34873909    puts "active: #{@b_active}, singleton: #{@b_singleton}"
    3488     @cell_list.show_tree( indent + 1 )
     3910    @cell_list_in_composite.show_tree( indent + 1 )
    34893911    (indent+1).times { print "  " }
    34903912    puts "name_list"
     
    35323954# @b_omit:: bool : omit 指定子が指定された (call port のみ)
    35333955# @b_optional:: bool : call port のみ
    3534 # @b_ref_des:: bool :  ref_desc キーワードが指定された
     3956# @b_ref_desc:: bool :  ref_desc キーワードが指定された
    35353957# @b_dynamic:: bool :  dynamic キーワードが指定された (呼び口のみ)
    35363958#
     
    36384060    @b_inline = false
    36394061    @b_optional = false
     4062    @b_omit = false
    36404063    @b_ref_desc = false
    36414064    @b_dynamic = false
     
    36554078    else
    36564079      # entry port optimize
    3657       if $unopt then
     4080      if $unopt || $unopt_entry then
    36584081        # 最適化なし
    36594082        @b_VMT_useless = false                     # VMT 不要 (true の時 VMT を介することなく呼出す)
     
    37864209        @b_optional = true
    37874210      when :REF_DESC
     4211        if @port_type == :ENTRY then
     4212          cdl_error( "S9999 ref_desc: cannnot be specified for entry port" )
     4213          next
     4214        end
    37884215        @b_ref_desc = true
    37894216      when :DYNAMIC
     
    38064233      end
    38074234    }
     4235    if ( @b_dynamic || @b_ref_desc ) then
     4236      if @b_dynamic then
     4237        dyn_ref = "dynamic"
     4238      else
     4239        dyn_ref = "ref_desc"
     4240      end
     4241      if @b_omit then     # is_omit? は is_empty? も含んでいるので使えない
     4242        cdl_error( "S9999 omit cannot be specified with $1", dyn_ref  )
     4243      elsif @signature && @signature.is_empty? then
     4244        cdl_error( "S9999 $1 cannot be specified for empty signature", dyn_ref  )
     4245      elsif @signature && @signature.has_descriptor? then
     4246        # cdl_error( "S9999 $1 port '$2' cannot have Descriptor in its signature", dyn_ref, @name )
     4247      end
     4248
     4249    elsif @b_dynamic && @b_ref_desc then
     4250      cdl_error( "S9999 both dynamic & ref_desc cannot be specified simultaneously"  )
     4251    end
    38084252  end
    38094253
     
    39584402
    39594403  def is_VMT_useless?                     # VMT 関数テーブルを使用しない
    3960    @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
    39614411  end
    39624412
    39634413  def is_skelton_useless?                 # スケルトン関数不要   (true の時、受け口関数を呼出す)
    3964     @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
    39654421  end
    39664422
     
    40784534  def is_reverse_required?
    40794535    @reverse_require_cell_path != nil
     4536  end
     4537
     4538  #=== Port# is_dynamic?
     4539  def is_dynamic?
     4540    @b_dynamic
     4541  end
     4542
     4543  #=== Port# is_ref_desc?
     4544  def is_ref_desc?
     4545    @b_ref_desc
    40804546  end
    40814547
     
    44894955      if ! c.get_f_def then   # Namespace の @cell_list にはプロトタイプが含まれるケースあり
    44904956        if c.get_f_ref then
    4491           cdl_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 )
    44924958        elsif $verbose then
    4493           cdl_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 )
    44944960        end
    44954961      else
     
    44984964        # if c.get_f_ref == false && c.is_generate? && ct && ct.is_inactive? then
    44994965        if c.get_f_ref == false && ct && ct.is_inactive? then
    4500           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 )
    45014970        end
    45024971      end
     
    46575126  end
    46585127
     5128  #=== Namespace# set_max_entry_port_inner_cell
     5129  # セルタイプに属するすべてのセルに対して実施
     5130  def set_max_entry_port_inner_cell
     5131    # celltype のコードを生成
     5132    @cell_list.each { |c|
     5133      c.set_max_entry_port_inner_cell
     5134    }
     5135    @namespace_list.each{ |ns|
     5136      ns.set_max_entry_port_inner_cell
     5137    }
     5138  end
     5139
    46595140  #=== Namespace# セルの結合をチェックする
    46605141  def check_join
     
    46815162  end
    46825163
     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 
    46835176  def show_tree( indent )
    46845177    indent.times { print "  " }
     
    49045397
    49055398    if object == nil then                                             # (2)
    4906       cdl_error( "S1109 \'$1\' not found" , @cell_name )
     5399      cdl_error( "S1109 \'$1\' not found" , nsp.to_s )
    49075400    elsif ! object.instance_of?( Cell ) then                          # (3)
    4908       cdl_error( "S1110 \'$1\' not cell" , @cell_name )
     5401      cdl_error( "S1110 \'$1\' not cell" , nsp.to_s )
    49095402    else
    49105403      dbgPrint "set_definition: set_f_ref #{@owner.get_name}.#{@name} => #{object.get_name}\n"
     
    52775770          next_cell_nsp       = @through_generated_list[ i + 1 ].get_cell_namespace_path
    52785771          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
    52795773        rescue Exception => evar
    52805774          cdl_error( "S1124 $1: plugin function failed: \'get_through_entry_port_name\'" , plugin_name )
     
    52955789        next_cell      = @cell
    52965790        next_port_name = @port_name
     5791        next_port_subscript = @rhs_subscript
    52975792
    52985793        if next_cell == nil then
     
    53065801        # region から @cell_name.@port_name への through がないか探す
    53075802        # rp = @through_list[i][3].find_cell_port_through_plugin( @cell_name, @port_name ) #762
    5308         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 )
    53095804           # @through_list[i] と @region_through_list[i-cp_len] は同じ
    53105805        # 共用しないようにするには、見つからなかったことにすればよい
     
    53175812
    53185813      if rp == nil then
    5319         if( load_plugin( plugin_name, ThroughPlugin ) ) then
    5320           gen_through_cell_code_and_parse( plugin_name, i, next_cell, next_port_name )
     5814        plClass = load_plugin( plugin_name, ThroughPlugin )
     5815        if( plClass ) then
     5816          gen_through_cell_code_and_parse( plugin_name, i, next_cell, next_port_name, next_port_subscript, plClass )
    53215817        end
    53225818      else
     
    53315827          # 生成したものを region(@through_list[i][3]) のリストに追加
    53325828          # @through_list[i][3].add_cell_port_through_plugin( @cell_name, @port_name, @through_generated_list[i] ) #762
    5333           @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] )
    53345830        end
    53355831      end
     
    53655861
    53665862  #=== Join# through プラグインを呼び出して CDL 生成させるとともに、import する
    5367   def gen_through_cell_code_and_parse( plugin_name, i, next_cell, next_port_name )
     5863  def gen_through_cell_code_and_parse( plugin_name, i, next_cell, next_port_name, next_port_subscript, plClass )
    53685864
    53695865    through = @through_list[ i ]
     
    53895885    end
    53905886    @@plugin_creating_join = self
    5391 
    53925887    caller_cell = @owner
    53935888
    5394     plugin_object = nil
    5395     eval_str = "plugin_object = #{plugin_name}.new( '#{generating_cell_name}'.to_sym, plugin_arg.to_s, next_cell, '#{next_port_name}'.to_sym, @definition.get_signature, @celltype, caller_cell )"
    5396     if $verbose then
    5397       print "new through: #{eval_str}\n"
    5398     end
    5399 
    54005889    begin
    5401       eval( eval_str )     # plugin を生成
     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 )
    54025893      plugin_object.set_locale @locale
    54035894    rescue Exception => evar
     
    54065897        print "signature: #{@definition.get_signature.get_name} from: #{caller_cell.get_name} to: #{next_cell.get_name} of celltype: #{@celltype.get_name}\n"
    54075898      end
    5408       print "eval( #{eval_str} )\n"
    5409 
    54105899      print_exception( evar )
    54115900      return
     
    55966085  end
    55976086
    5598   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
    55996095    @rhs_subscript
    56006096  end
     
    56066102    # through 指定あり?
    56076103    if @through_list[0] then
    5608       # mikan through で生成したものが root namespace 限定
    56096104      # through で生成されたセルを探す
    5610 #      cell = Namespace.find( [ "::", @through_generated_list[0].get_cell_name.to_sym ] )    #1
    56116105      cell = Namespace.find( @through_generated_list[0].get_cell_namespace_path )    #1
    56126106      # cell のプラグインで生成されたポート名のポートを探す (composite なら内部の繋がるポート)
     
    56156109      # ポートを返す(composite なら内部の繋がるポートを返す)
    56166110      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
    56176123    end
    56186124  end
     
    57186224  # composite cell を展開したセルの結合を clone したセルの名前に変更
    57196225  def change_rhs_port( clone_cell_list, celltype )
     6226    dbgPrint "change_rhs_port: name=#{@name}\n"
    57206227
    57216228    # debug
    57226229    if $debug then
    5723       dbgPrint "change_rhs name: #{@name}  cell_name: #{@cell_name} #{@cell} #{self}\n"
     6230#    if @name == :cCallB then
     6231      # dbgPrint "change_rhs name: #{@name}  cell_name: #{@cell_name} #{@cell} #{self}\n"
     6232      print "============\n"
     6233      print "CHANGE_RHS change_rhs name: #{@owner.get_name}.#{@name}  rhs cell_name: #{@cell_name} #{@cell} #{self}\n"
    57246234
    57256235      clone_cell_list.each{ |cell, ce|
    5726         dbgPrint "change_rhs:  #{cell.get_name}=#{cell} : #{ce.get_name}\n"
     6236        # dbgPrint "=== change_rhs:  #{cell.get_name}=#{cell} : #{ce.get_name}\n"
     6237        print "   CHANGE_RHS  change_rhs:  #{cell.get_name}=#{cell} : #{ce.get_name}\n"
    57276238      }
     6239      print "============\n"
    57286240    end
    57296241
     
    57326244
    57336245    # debug
    5734     dbgPrint "  cell_name:   #{@cell_name} => #{c.get_global_name}, #{c.get_name}\n"
     6246    dbgPrint "  REWRITE cell_name:  #{@owner.get_name}   #{@cell_name} => #{c.get_global_name}, #{c.get_name}\n"
    57356247
    57366248    # @rhs の内容を調整しておく(この内容は、subscript を除いて、後から使われていない)
     
    57566268
    57576269      # debug
    5758       # p "array_member2.len : #{@array_member.length}"
     6270      dbgPrint "array_member2.len : #{@array_member.length}\n"
    57596271
    57606272      i = 0
     
    57646276        # 無駄に設定されているものについては、再帰的に呼び出す必要はない(clone_for_composite では対策している)
    57656277        if @array_member2[i] != self && @array_member[i] != nil then
     6278          dbgPrint "change_rhs array_member #{i}: #{@name}  #{@cell_name}\n"
    57666279          @array_member2[i].change_rhs_port( clone_cell_list, celltype )
    57676280        end
     
    57796292  # @through_list などもコピーされるので、これが呼び出される前に確定する必要がある
    57806293  def clone_for_composite( ct_name, cell_name, locale, b_need_recursive = true )
    5781 
    57826294    # debug
    5783     dbgPrint "join.clone_for_composite : #{@name} #{@cell_name} #{self}\n"
     6295    dbgPrint "=====  clone_for_composite: #{@name} #{@cell_name} #{self}   =====\n"
    57846296    cl = self.clone
    57856297
    57866298    if @array_member2 && b_need_recursive then
    5787       cl.clone_array_member( @array_member, @array_member2, ct_name, cell_name, self, locale )
     6299      cl.clone_array_member( ct_name, cell_name, self, locale )
    57886300    end
    57896301
     
    57966308  end
    57976309
    5798   def clone_array_member( array_member, array_member2, ct_name, cell_name, prev, locale )
     6310  def clone_array_member( ct_name, cell_name, prev, locale )
    57996311    # 配列のコピーを作る
    5800     am  = array_member.clone
    5801     am2 = array_member2.clone
     6312    am  = @array_member.clone
     6313    am2 = @array_member2.clone
    58026314
    58036315    # 配列要素のコピーを作る
    58046316    i = 0
    58056317    while i < am2.length
    5806       if array_member2[i] == prev then
     6318      if @array_member2[i] == prev then
    58076319        # 自分自身である(ので、呼出すと無限再帰呼出しとなる)
    58086320        am2[i] = self
    5809       elsif array_member2[i] then
    5810         am2[i] = array_member2[i].clone_for_composite( ct_name, cell_name, locale, false )
     6321        am[i] = am2[i].get_rhs
     6322      elsif @array_member2[i] then
     6323#        am2[i] = @array_member2[i].clone_for_composite( ct_name, cell_name, locale, false )
     6324        am2[i] = @array_member2[i].clone_for_composite( ct_name, cell_name, locale, true )
     6325        am[i] = am2[i].get_rhs
    58116326      else
    58126327        # 以前のエラーで array_member2[i] は nil になっている
     
    58146329
    58156330      # debug
    5816       dbgPrint "clone_array_member: #{@name} #{am2[i]} #{array_member2[i]}\n"
     6331      dbgPrint "clone_array_member: #{@name} subsript=#{i} #{am2[i]} #{@array_member2[i]}\n"
    58176332
    58186333      i += 1
     
    58406355    dbgPrint "Join#set_cloned: #{@name}  prev owner: #{@owner.get_name} new owner: #{owner.get_name}\n"
    58416356    @owner = owner
     6357    if @array_member2 then
     6358      @array_member2.each{ |join|
     6359        dbgPrint "Joinarray#set_cloned: #{@name}  prev owner: #{join.get_owner.get_name} new owner: #{owner.get_name}\n"
     6360        join.set_owner owner
     6361      }
     6362    end
    58426363  end
    58436364
     
    59056426        if j then
    59066427          (indent+2).times { print "  " }
    5907           puts "[#{i}]: #{j.get_name}  id: #{j}"
     6428          puts "[#{i}]: #{j.get_name}  id: #{j} owner=#{j.get_owner.get_name}"
    59086429          j.get_rhs.show_tree(indent+3)
    5909           (indent+3).times { print "  " }
    5910           puts "cell global name: #{j.get_cell_global_name}"
    5911           (indent+3).times { print "  " }
    5912           puts "port global name: #{j.get_port_global_name}"
     6430#          (indent+3).times { print "  " }
     6431#          puts "cell global name: #{j.get_cell_global_name}"
     6432#          puts "cell global name: #{j.get_rhs_cell.get_global_name}"
     6433#          (indent+3).times { print "  " }
     6434#          puts "port global name: #{j.get_port_global_name}"
     6435#          puts "port global name: #{j.get_rhs_port.get_name}"
    59136436        else
    59146437          (indent+2).times { print "  " }
     
    62356758end
    62366759
    6237 #== Domain
     6760#== DomainType
    62386761#
    62396762# region の domain を記憶するクラス
     
    62566779    @name = name
    62576780    @plugin_name = (name.to_s + "Plugin").to_sym
    6258     load_plugin( @plugin_name, DomainPlugin )
     6781    plClass = load_plugin( @plugin_name, DomainPlugin )
    62596782    @region = region
    62606783    @option = option
     
    62726795    if ! @plugin then
    62736796      pluginClass = Object.const_get @plugin_name
     6797      return if pluginClass == nil
    62746798      @plugin = pluginClass.new( @region, @name, @option )
     6799      @plugin.set_locale @locale
    62756800    end
    62766801  end
     
    62906815  end
    62916816
    6292   #== Domain リージョンの Hash を得る
     6817  #== DomainType リージョンの Hash を得る
    62936818  # @@domain_regions の説明参照
    62946819  def self.get_domain_regions
     
    63026827  def get_option
    63036828    @option
     6829  end
     6830
     6831  #== DomainType#ドメイン種別を得る
     6832  #return::Symbol :kernel, :user, :OutOfDomain
     6833  def get_kind
     6834    @plugin.get_kind
    63046835  end
    63056836
     
    63636894
    63646895    if @@domain_name then
     6896      dbgPrint "Region=#{name} domain_type=#{@@domain_name} option=#{@@domain_option}\n"
    63656897      domain_option = CDLString.remove_dquote @@domain_option.to_s
    63666898      @domain_type = DomainType.new( self, @@domain_name, domain_option )
     
    64016933
    64026934        # 再出現時に specifier が指定されているか?
    6403         if( @in_through_list.length != 0 || @out_through_list.length != 0 || @to_through_list.length != 0 || @region_type != nil )then
     6935        if( @in_through_list.length != 0 || @out_through_list.length != 0 || @to_through_list.length != 0 ||
     6936            @region_type != nil || @domain_type != nil )then
    64046937          cdl_error( "S1140 $1: region specifier must place at first appearence" , name )
    64056938        end
     
    66107143  end
    66117144
     7145  #== Region# ルートリージョン
     7146  # ルートリージョンは、namespace のルートと同じインスタンス
     7147  def selfget_root
     7148    Namespace.get_root
     7149  end
     7150
    66127151  def next_in_through_count
    66137152    @in_through_count += 1
     
    66437182  #=== Region# through プラグインで、この region から cell_name.port_name へのプラグインオブジェクトを登録
    66447183  # mikan namesppace 対応 (cell_name)
    6645   def add_cell_port_through_plugin( cell_name, port_name, through_plugin_object )
    6646     @cell_port_throug_plugin_list[ "#{cell_name}.#{port_name}" ] = through_plugin_object
    6647   end
    6648 
    6649   def find_cell_port_through_plugin( cell_name, port_name )
    6650     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}" ]
    66517196  end
    66527197
     
    67797324end
    67807325
     7326#== Importable class
     7327# this module is included by Import_C and Import
     7328module Importable
     7329#@last_base_dir::String
     7330
     7331  #=== Importable#find_file
     7332  #file::String : file name to find
     7333  #return::String | Nil: path to file or nil if not found
     7334  #find file in
     7335  def find_file file
     7336    $import_path.each{ |path|
     7337      if path == "."
     7338        pt = file
     7339      else
     7340        pt = "#{path}/#{file}"
     7341      end
     7342      if File.exist?( pt )
     7343        if ! $base_dir[ Dir.pwd ]
     7344          $base_dir[ Dir.pwd ] = true
     7345        end
     7346        if $verbose then
     7347          print "#{file} is found in #{path}\n"
     7348        end
     7349        @last_base_dir = nil
     7350        dbgPrint "base_dir=. while searching #{file}\n"
     7351        return pt
     7352      end
     7353    }
     7354
     7355    $base_dir.each_key{ |bd|
     7356      $import_path.each{ |path|
     7357#        if path =~ /\A\// || path =~ /\A[a-zA-Z]:/
     7358          pt = "#{path}/#{file}"
     7359#        else
     7360#          pt = "#{bd}/#{path}/#{file}"
     7361#        end
     7362        begin
     7363          Dir.chdir $run_dir
     7364          Dir.chdir bd
     7365          if File.exist?( pt )
     7366            if $verbose then
     7367              print "#{file} is found in #{bd}/#{path}\n"
     7368            end
     7369            @last_base_dir = bd
     7370            dbgPrint "base_dir=#{bd} while searching #{file}\n"
     7371            $base_dir[ bd ] = true
     7372            return pt
     7373          end
     7374        rescue
     7375        end
     7376      }
     7377    }
     7378    @last_base_dir = nil
     7379    dbgPrint "base_dir=. while searching #{file}\n"
     7380    return nil
     7381  end
     7382
     7383  def get_base_dir
     7384    return @last_base_dir
     7385    $base_dir.each{ |bd, flag|
     7386      if flag == true
     7387        return bd
     7388      end
     7389    }
     7390    return nil
     7391  end
     7392end
     7393
    67817394class Import_C < Node
    67827395
     
    67857398  @@header_list2 = []
    67867399  @@define_list = {}
     7400
     7401  include Importable
    67877402
    67887403  #=== Import_C# import_C の生成(ヘッダファイルを取込む)
     
    68237438    }
    68247439
     7440    header_path = find_file header
     7441
     7442=begin
    68257443    include_opt = ""
    68267444    found = false
     
    68447462
    68457463    if found == false then
     7464=end
     7465    if header_path == nil then
    68467466      cdl_error( "S1142 $1 not found in search path" , header )
    68477467      return
    68487468    end
     7469
     7470    include_opt = ""
     7471    if get_base_dir then
     7472      base = get_base_dir + "/"
     7473    else
     7474      base = ""
     7475    end
     7476    $import_path.each{ |path|
     7477      include_opt = "#{include_opt} -I #{base}#{path}"
     7478    }
    68497479
    68507480    # 読込み済み?
     
    68627492    @@header_list2 << header
    68637493    @@define_list[ header ] = define
     7494
     7495    if $verbose then
     7496      print "import_C header=#{header_path}, define=#{define}\n"
     7497    end
    68647498
    68657499    begin
     
    69407574 * --no-gcc-extension-support for tecsgen.
    69417575 */
     7576#ifdef __GNUC__
     7577
    69427578#ifndef __attribute__
    69437579#define __attribute__(x)
     
    69567592#endif
    69577593
     7594#ifndef restrict
     7595#define restrict
     7596#endif
     7597
     7598#endif /* ifdef __GNUC__ */
    69587599#endif /* TECS_NO_GCC_EXTENSION_SUPPORT */
    69597600EOT
     
    69837624# @cdl_path:: string:   CDL のパス
    69847625# @b_imported:: bool:   import された(コマンドライン指定されていない)
     7626
     7627  include Importable
    69857628
    69867629  # ヘッダの名前文字列のリスト  添字:expand したパス、値:Import
     
    70237666    @b_reuse_real = @b_reuse || Generator.is_reuse?
    70247667
    7025     if Generator.get_plugin then
    7026       # plugin から import されている場合 gen をサーチパスの先頭に加える
    7027       search_path = [ $gen ] + $import_path
    7028     else
    7029       search_path = $import_path
    7030     end
    7031 
    7032     search_path.each{ |path|
    7033       dbgPrint "import: searching #{path}/#{@cdl}"
    7034       begin
    7035         if path == "."
    7036           cdl_path =  @cdl
    7037         else
    7038           cdl_path = "#{path}/#{@cdl}"
    7039         end
    7040 
    7041         # ファイルの stat を取ってみる(なければ例外発生)
    7042         File.stat( cdl_path )
    7043 
    7044         # cdl を見つかったファイルパスに再設定
    7045         @cdl_path = cdl_path
     7668    if( Generator.get_plugin ) &&( File.exist? "#{$gen}/#{@cdl}" ) then
     7669      @cdl_path = "#{$gen}/#{@cdl}"
     7670      found = true
     7671    else
     7672      path = find_file @cdl
     7673      if path then
    70467674        found = true
    7047         dbgPrint ": found\n"
    7048         break
    7049       rescue => evar
    7050         found = false
    7051         dbgPrint ": not found\n"
    7052         # print_exception( evar )
    7053       end
    7054     }
     7675        @cdl_path = path
     7676      end
     7677    end
    70557678
    70567679    if found == false then
     
    71187741end
    71197742
    7120 #== generate: signature プラグインのロードと実行
     7743#== generate: signature, celltype, cell へのプラグインのロードと適用
    71217744class Generate < Node
    71227745#@plugin_name:: Symbol
    7123 #@signature_nsp:: NamespacePath
     7746#@object_nsp:: NamespacePath
    71247747#@option::         String '"', '"' で囲まれている
     7748#@plugin_object:: Plugin
    71257749
    71267750  include PluginModule
    71277751
    7128   def initialize( plugin_name, signature_nsp, option )
     7752  def initialize( plugin_name, object_nsp, option )
    71297753    super()
    71307754    @plugin_name = plugin_name
    7131     @signature_nsp = signature_nsp
     7755    @object_nsp = object_nsp
    71327756    option = option.to_s    # option は Token
    71337757    @option = option
    7134 
    7135     signature = Namespace.find( signature_nsp ) #mikan Namespace   #1
    7136     if ! signature.instance_of? Signature then
    7137       cdl_error( "S1149 $1 not signature" , signature_nsp )
     7758    @plugin_object = nil
     7759
     7760    dbgPrint "generate: #{plugin_name} #{object_nsp.to_s} option=#{option}\n"
     7761
     7762    object = Namespace.find( object_nsp )
     7763    if object.kind_of?( Signature ) ||
     7764       object.kind_of?( Celltype ) ||
     7765       object.kind_of?( CompositeCelltype ) ||
     7766       object.kind_of?( Cell )then
     7767      @plugin_object = object.apply_plugin( @plugin_name, @option )
     7768    elsif object then
     7769      # V1.5.0 以前の仕様では、signature のみ可能だった
     7770#      cdl_error( "S1149 $1 not signature" , signature_nsp )
     7771      cdl_error( "S9999 generate: '$1' neither signature, celltype nor cell", object_nsp )
    71387772      return
    7139     elsif signature.is_empty? then
    7140       cdl_warning( "S9999 $1 is empty. cannot apply signature plugin. ignored" , signature_nsp )
    7141       return
    7142     end
    7143 
    7144     load_plugin( plugin_name, SignaturePlugin )
    7145 
    7146     plugin_object = nil
    7147     eval_str = "plugin_object = #{plugin_name}.new( signature, option )"
    7148     if $verbose then
    7149       print "new through: #{eval_str}\n"
    7150     end
    7151 
    7152     begin
    7153       eval( eval_str )     # plugin を生成
    7154       plugin_object.set_locale @locale
    7155     rescue Exception => evar
    7156       cdl_error( "S1150 $1: fail to new" , plugin_name )
    7157       print "eval( #{eval_str} )\n"
    7158 
    7159       print_exception( evar )
    7160     end
    7161     generate_and_parse plugin_object
     7773    else
     7774      cdl_error( "S9999 generate: '$1' not found", object_nsp )
     7775    end
    71627776  end
    71637777end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/ctypes.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    118118      end
    119119      return self
    120     else
     120    elsif self.instance_of?( CFloatType ) then
    121121      # mikan long double
    122122      #   TECS には long double を表現する手段がない (double80_t を定義すればよいか?)
    123123#      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 )
    125       return self
     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     
     126      return self
     127    else
     128      raise "merge: unknown type"
    126129    end
    127130  end
     
    183186  end
    184187
     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
    185195end
    186196
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/expression.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    151151    when :IDENTIFIER
    152152      nsp = elements[1]
     153      # if nsp.is_name_only? && name_list && name_list.get_item( nsp.get_name ) then
    153154      if nsp.is_name_only? && name_list && name_list.get_item( nsp.get_name ) then
    154155        return "#{pre}#{nsp.get_name}#{post}"
     
    229230  end
    230231
     232  #=== Expression# 逆ポーランド文字列化
     233  #param_list:: ParamlList  関数の引数リスト
     234  def get_rpn( param_list = nil, name_list2 = nil )
     235    return elements_rpn( @elements, param_list, name_list2 )
     236  end
     237
     238  #=== Expression# 逆ポーランド文字列化 (private)
     239  #name_list:: ParamlList  関数の引数リスト
     240  def elements_rpn( elements, name_list = nil, name_list2 = nil )
     241    if elements.instance_of? Token then
     242      print "rpn: #{elements.to_s}\n"
     243      return elements.to_s    # OP_DOT, OP_REF の右辺
     244    end
     245
     246    case elements[0]
     247    when :IDENTIFIER
     248      nsp = elements[1]
     249      #if nsp.is_name_only? && name_list && name_list.find( nsp.get_name ) then
     250      if nsp.is_name_only? then
     251        count = 0
     252        # p "search: #{nsp.get_name}"
     253        name_list.get_items.each{ |nm,val|
     254          # p "    : #{nm.get_name} #{nsp.get_name.class} #{nm.get_name.class}"
     255          if nsp.get_name == nm.get_name then
     256            return " $#{count}"
     257          end
     258          count += 1
     259        }
     260        raise "not found parameter"
     261      else
     262        # return  elements[1].get_global_name
     263        raise "not unexpected parameter"
     264      end
     265    when :INTEGER_CONSTANT, :FLOATING_CONSTANT, :OCTAL_CONSTANT, :HEX_CONSTANT, :CHARACTER_LITERAL, :STRING_LITERAL_LIST, :BOOL_CONSTANT
     266      return elements[1].to_s
     267    when :PARENTHESES
     268      return elements_rpn( elements[1], name_list, name_list2 )
     269    when :OP_SUBSC
     270      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[1], "", name_list, name_list2 ) + " []"
     271    when :OP_DOT
     272      return elements_rpn( elements[1], name_list, name_list2 ) + " ."
     273    when :OP_REF
     274      return elements_rpn( elements[1], name_list, name_list2 ) + " ->"
     275    when :OP_SIZEOF_EXPR
     276      return elements_rpn( elements[1], name_list, name_list2 ) + " #s"
     277    when :OP_SIZEOF_TYPE
     278      return elements_rpn( elements[1], name_list, name_list2 ) + " #S"
     279    when :OP_U_AMP
     280      return elements_rpn( elements[1], name_list, name_list2 ) + " #&"
     281    when :OP_U_ASTER
     282      return elements_rpn( elements[1], name_list, name_list2 ) + " #*"
     283    when :OP_U_PLUS
     284      return elements_rpn( elements[1], name_list, name_list2 ) + " #+"
     285    when :OP_U_MINUS
     286      return elements_rpn( elements[1], name_list, name_list2 ) + " #-"
     287    when :OP_U_TILDE
     288      return elements_rpn( elements[1], name_list, name_list2 ) + " #~"
     289    when :OP_U_EXCLAM
     290      return elements_rpn( elements[1], name_list, name_list2 ) + " #!"
     291    when :CAST
     292      return elements_rpn( elements[1], name_list, name_list2 ) + " #(" + elements_rpn( elements[2], "", name_list, name_list2 ) + ")"
     293    when :OP_MULT
     294      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " *"
     295    when :OP_DIV
     296      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " /"
     297    when :OP_REMAIN
     298      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " %"
     299    when :OP_ADD
     300      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " +"
     301    when :OP_SUB
     302      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " -"
     303    when :OP_LSFT
     304      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " <<"
     305    when :OP_RSFT
     306      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " >>"
     307    when :OP_LT
     308      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " <"
     309    when :OP_GT
     310      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " >"
     311    when :OP_LE
     312      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " <="
     313    when :OP_GE
     314      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " >="
     315    when :OP_EQ
     316      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " =="
     317    when :OP_NE
     318      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " !="
     319    when :OP_AND
     320      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " &"
     321    when :OP_EOR
     322      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " ^"
     323    when :OP_OR
     324      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " |"
     325    when :OP_LAND
     326      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " &&"
     327    when :OP_LOR
     328      return elements_rpn( elements[1], name_list, name_list2 ) + " " + elements_rpn( elements[2], "", name_list, name_list2 ) + " ||"
     329    when :OP_CEX
     330      return elements_rpn( elements[1], name_list, name_list2 ) + " " +
     331             elements_rpn( elements[2], name_list, name_list2 ) + " " +
     332             elements_rpn( elements[3], name_list, name_list2 ) + " ?:"
     333    else
     334      raise "Unknown expression element: #{elemets[0]}. try -t and please report"
     335    end
     336    return ""
     337  end
     338
    231339  # 定数式(elements)を評価する
    232340  #
     
    382490      return nil
    383491    when :OP_SIZEOF_EXPR
    384       cdl_error( "E1007 cannot evaluate \'sizeof\' operator"  )
     492      if Generator.parsing_C? then
     493        cdl_info( "I9999 cannot evaluate \'sizeof\' operator. this might causes later error."  )
     494      else
     495        cdl_error( "E1007 cannot evaluate \'sizeof\' operator"  )
     496      end
    385497      return nil
    386498    when :OP_SIZEOF_TYPE
    387       cdl_error( "E1008 cannot evaluate \'sizeof\' operator"  )
     499      if Generator.parsing_C? then
     500        cdl_info( "I9999 cannot evaluate \'sizeof\' operator. this might causes later error."  )
     501      else
     502        cdl_error( "E1008 cannot evaluate \'sizeof\' operator"  )
     503      end
    388504      return nil
    389505    when :OP_U_AMP
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/generate.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2016 by TOPPERS Project
     6#   Copyright (C) 2008-2019 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    122122
    123123class Namespace
     124  @@domain_gen_factory_list = nil
    124125  def generate
    125126
     
    135136          return
    136137        end
     138        if instance_of? Region then
     139          @@domain_gen_factory_list = {}   # create hash
     140        end
    137141      end
    138142
     
    141145      gen_global_header
    142146
     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     
    143156      # signature のコードを生成
    144157      @signature_list.each { |s|
     
    262275
    263276      f.print( "/* Descriptor for dynamic join */\n" )
    264       f.print( "#define Descriptor( signature_global_name )  DynDesc__ ## signature_global_name\n\n" )
     277      f.print( "#define Descriptor( signature_global_name )  DynDesc__ ## signature_global_name\n" )
     278      f.print( "#define is_descriptor_unjoined( desc )  ((desc).vdes==NULL)\n\n" )
    265279      endif_macro_only f
    266280    end
     
    454468      }
    455469    end
    456         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"
    457471    if $generating_region == @@root_namespace then
    458472      f.print " rm -rf $(GEN_DIR)\n"
     
    464478      f.print "tecs : $(PRE_TECSGEN_TARGET) $(TIMESTAMP) $(POST_TECSGEN_TARGET)\n\n"
    465479      f.print "$(TIMESTAMP) : $(TECS_IMPORTS)\n"
    466       f.print " $(TECSGEN) #{TECSGEN.subst_tecspath( $arguments, true )}\n"
     480      f.print " $(TECSGEN) #{TECSGEN.subst_tecspath( $arguments, true )}\n\n"
    467481      # f.print "       touch $(TIMESTAMP)\n\n"
    468 
    469482    else
    470483      f.print "tecs:\n"
     
    472485    end
    473486
     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
    474527    f.print "# generic target for objs\n"
    475528    f.print "$(_TECS_OBJ_DIR)%.o : %.#{$c_suffix}\n"
     
    491544    ### Makefile.tecsgen の生成
    492545    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
     587EOT
    493588
    494589    f.print( "TECS_IMPORT_CDLS =" )
     
    545640    DomainType.get_domain_regions.each{ |dt, regions|
    546641      # domain_type は一つのノードには、一つしかないので、このループは、必ず一回しか回らない
     642        ###   mikan 複数のノードがあり、異なる domain_type が指定される可能性はある
    547643      domain_regions = regions
    548644      domain_type = dt
     
    587683      f.print( "\n\n" )
    588684
    589       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" )
    590719      f.print( "TECSGEN_COBJS = \\\n" )
    591720      domain_regions.each{ |r|
     
    621750
    622751    ###
    623     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" )
    624753    domain_regions.each{ |r|
    625754      nsp = decideDomainNameProc.call( r )
     
    655784
    656785    f.print( "# PLUGIN_SRCS: sources automatically generated by plugin\n" )
     786    f.print( "PLUGIN_CELLTYPE_SRCS = \\\n" )
    657787    domain_regions.each{ |r|
    658788      nsp = decideDomainNameProc.call( r )
    659       f.print( "PLUGIN#{nsp}_SRCS = \\\n" )
    660       gen_celltype_names_domain( f, "   $(GEN_DIR)/", "_tecsgen.#{$c_suffix} \\\n", domain_type, r, true )
    661       gen_celltype_names_domain2( f, "  $(GEN_DIR)/", ".#{$c_suffix} \\\n", domain_type, r, true, false )
    662       f.print( "# PLUGIN#{nsp}_SRCS terminator\n\n" )
    663     }
    664 
     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" )
    665814    f.close
    666815
     
    762911  end
    763912
     913  #=== Namespace#すべてのシグニチャをたどる
     914  def travers_all_signature # ブロック引数 { |signature|  }
     915    proc = Proc.new    # このメソッドのブロック引数
     916    @signature_list.each{ |sig|
     917      proc.call sig
     918    }
     919    @namespace_list.each{ |ns|
     920      ns.travers_all_signature_proc proc
     921    }
     922  end
     923  def travers_all_signature_proc proc
     924    @signature_list.each{ |sig|
     925      proc.call sig
     926    }
     927    @namespace_list.each{ |ns|
     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
     948    }
     949  end
    764950end
    765951
     
    8541040      f.printf TECSMsg.get(:SDI_comment), "#_SDI_#"
    8551041      dl.each{ |dt,param|
    856         f.print "#include \"#{dt.get_signature.get_global_name}_tecsgen.#{$h_suffix}\"\n"
     1042        f.print <<EOT
     1043/* pre-typedef incomplete-type to avoid error in case of mutual or cyclic reference */
     1044#ifndef Descriptor_of_#{dt.get_global_name}_Defined
     1045#define  Descriptor_of_#{dt.get_global_name}_Defined
     1046typedef struct { struct tag_#{dt.get_global_name}_VDES *vdes; } Descriptor( #{dt.get_global_name} );
     1047#endif
     1048EOT
     1049#        f.print "#include \"#{dt.get_global_name}_tecsgen.#{$h_suffix}\"\n"
    8571050      }
    8581051      f.print "\n"
     
    9041097    end
    9051098
    906     f.print "};\n"
    907     f.printf "\n"
     1099    f.print "};\n\n"
    9081100    f.printf TECSMsg.get(:SDES_comment), "#_SDES_#"
    909     f.print( "typedef struct { struct tag_#{@global_name}_VDES *vdes; } Descriptor( #{@global_name} );\n" )
     1101    f.print <<EOT
     1102#ifndef Descriptor_of_#{@global_name}_Defined
     1103#define  Descriptor_of_#{@global_name}_Defined
     1104typedef struct { struct tag_#{@global_name}_VDES *vdes; } Descriptor( #{@global_name} );
     1105#endif
     1106EOT
    9101107  end
    9111108
     
    9931190    gen_ph_get_cellcb f
    9941191    gen_ph_attr_access f          if @n_attribute_rw > 0 || @n_attribute_ro > 0 || @n_var > 0
    995     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"
    9961197#    gen_ph_abstract_ep_des_type f
    9971198
     
    10081209#    gen_ph_ep_fun_prototype f
    10091210    gen_ph_ep_skel_prototype f
     1211
     1212    #--- CB_TYPE_ONLY の場合、ref_desc, set_desc 関数は含めない (マクロ参照するため)
     1213    if @n_entry_port_inline == 0 then
     1214      ifndef_cb_type_only f
     1215    end
     1216    gen_ph_ref_desc_func f
     1217    gen_ph_set_desc_func f
     1218    if @n_entry_port_inline == 0 then
     1219      endif_cb_type_only f
     1220    end
    10101221    end_extern_C f
    10111222    endif_macro_only f
     
    10191230    gen_ph_attr_access_abbrev f   if @n_attribute_rw > 0 || @n_attribute_ro > 0 || @n_var > 0
    10201231    gen_ph_cp_fun_macro_abbrev f  if @n_call_port > 0
     1232    gen_ph_ref_desc_macro_abbrev f
     1233    gen_ph_set_desc_macro_abbrev f
    10211234    gen_ph_test_optional_call_port_abbrev f
    10221235    gen_ph_ep_fun_macro f         if @n_entry_port > 0
     
    10841297          end
    10851298        }
     1299        if p.is_dynamic? then
     1300          f.print( "#undef #{p.get_name}_set_descriptor\n" )
     1301          if p.is_optional? then
     1302            f.print( "#undef #{p.get_name}_unjoin\n" )
     1303          end
     1304        elsif p.is_ref_desc? then
     1305          f.print( "#undef #{p.get_name}_refer_to_descriptor\n" )
     1306          f.print( "#undef #{p.get_name}_ref_desc\n" )
     1307        end
    10861308      }
    10871309      @port.each { |p|
     
    11961418  def gen_ph_info f
    11971419
     1420    yn_multi_domain = "no"
     1421    yn_multi_domain = "yes" if multi_domain?
    11981422    yn_idx_is_id = "no"
    11991423    yn_idx_is_id = "yes"  if @idx_is_id
     
    12041428    yn_rom       = "no"
    12051429    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?
    12061434    yn_cb_init   = "no"
    12071435    yn_cb_init   = "yes"  if need_CB_initializer?
     
    12121440 * celltype          :  #{@name}
    12131441 * global name       :  #{@global_name}
     1442 * multi-domain      :  #{yn_multi_domain}
    12141443 * idx_is_id(actual) :  #{yn_idx_is_id}(#{yn_idx_is_id_act})
    12151444 * singleton         :  #{yn_singleton}
    1216  * has_CB            :  #{has_CB?}
    1217  * has_INIB          :  #{has_INIB?}
     1445 * has_CB            :  #{yn_has_CB}
     1446 * has_INIB          :  #{yn_has_INIB}
    12181447 * rom               :  #{yn_rom}
    12191448 * CB initializer    :  #{yn_cb_init}
     
    14381667      end
    14391668
    1440       if p.get_array_size == nil then
    1441         f.print( "#define #{@global_name}_is_#{p.get_name}_joined(p_that) \\\n" )
    1442       else
    1443         f.print( "#define #{@global_name}_is_#{p.get_name}_joined(p_that,subscript) \\\n" )
    1444       end
     1669      if @singleton then
     1670        param = ""
     1671        delim = ""
     1672      else
     1673        param = "p_that"
     1674        delim = ","
     1675      end
     1676      if p.get_array_size != nil then
     1677        param = param + delim + "subscript"
     1678      end
     1679      f.print( "#define #{@global_name}_is_#{p.get_name}_joined(#{param}) \\\n" )
    14451680
    14461681      if p.is_omit? then
     
    14521687      # mikan  全部つながっているかどうかで (1) を判定する
    14531688      if ! p.is_VMT_useless? then
     1689        if p.is_dynamic? then
     1690          if @singleton then
     1691            inib_tmp = "CB"
     1692          else
     1693            inib_tmp = ""
     1694          end
     1695        else
     1696          inib_tmp = inib
     1697        end
     1698
    14541699        # 標準コード
    14551700        if p.get_array_size == nil then
    14561701          if @singleton then
    1457             f.print( "\t  (#{@global_name}_SINGLE_CELL_#{inib}.#{p.get_name}!=0)\n" )
     1702            f.print( "\t  (#{@global_name}_SINGLE_CELL_#{inib_tmp}.#{p.get_name}!=0)\n" )
    14581703          else
    1459             f.print( "\t  ((p_that)#{inib}->#{p.get_name}!=0)\n" )
     1704            f.print( "\t  ((p_that)#{inib_tmp}->#{p.get_name}!=0)\n" )
    14601705          end
    14611706        else
    14621707          # 配列の場合
    14631708          if @singleton then
    1464             f.print( "\t  ((#{@global_name}_SINGLE_CELL_#{inib}.#{p.get_name}!=0) \\\n" )
    1465             f.print( "\t  &&(#{@global_name}_SINGLE_CELL_#{inib}.#{p.get_name}[subscript]!=0))\n" )
     1709            f.print( "\t  ((#{@global_name}_SINGLE_CELL_#{inib_tmp}.#{p.get_name}!=0) \\\n" )
     1710            f.print( "\t  &&(#{@global_name}_SINGLE_CELL_#{inib_tmp}.#{p.get_name}[subscript]!=0))\n" )
    14661711          else
    1467             f.print( "\t  (((p_that)#{inib}->#{p.get_name}!=0)\\\n" )
    1468             f.print( "\t  &&((p_that)#{inib}->#{p.get_name}[subscript]!=0))\n" )
     1712            f.print( "\t  (((p_that)#{inib_tmp}->#{p.get_name}!=0)\\\n" )
     1713            f.print( "\t  &&((p_that)#{inib_tmp}->#{p.get_name}[subscript]!=0))\n" )
    14691714          end
    14701715        end
     
    15031748      end
    15041749
     1750      if @singleton then
     1751        param = ""
     1752        delim = ""
     1753      else
     1754        param = "p_cellcb"
     1755        delim = ","
     1756      end
     1757
    15051758      if p.get_array_size == nil then
    1506         f.print( "#define is_#{p.get_name}_joined()\\\n\t\t#{@global_name}_is_#{p.get_name}_joined(p_cellcb)\n" )
    1507       else
    1508         f.print( "#define is_#{p.get_name}_joined(subscript)\\\n" )
    1509         f.print( "\t\t#{@global_name}_is_#{p.get_name}_joined(p_cellcb,subscript)\n" )
    1510       end
     1759        subscript = ""
     1760      else
     1761        subscript = "subscript"
     1762        param = param + delim + subscript
     1763      end
     1764      f.print( "#define is_#{p.get_name}_joined(#{subscript})\\\n\t\t#{@global_name}_is_#{p.get_name}_joined(#{param})\n" )
    15111765    }
    15121766  end
     
    15191773      f.print( "#define #{@global_name}_GET_CELLCB(idx) ((void *)0)\n" )
    15201774    elsif @idx_is_id_act then   # mikan 単一のセルの場合の最適化, idx_is_id でない場合
    1521       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" )
    15221776    else
    15231777      f.print( "#define #{@global_name}_GET_CELLCB(idx) (idx)\n" )
     
    17231977  end
    17241978
    1725   def gen_ph_cp_fun_macro f
    1726     if @n_call_port >0 then
     1979  def gen_ph_cp_fun_macro f, b_flow
     1980    if @n_call_port >0 && b_flow == false then
    17271981      f.printf( TECSMsg.get( :CPM_comment ) , "#_CPM_#" )
    1728     end
    1729 
    1730     if @singleton then
    1731       if has_INIB? then
    1732         inib = "INIB"
    1733       else
    1734         inib = "CB"
    1735       end
    1736     else
    1737       if has_CB? && has_INIB? then
    1738         inib = "->_inib"
    1739       else
    1740         inib = ""
    1741       end
    17421982    end
    17431983
     
    17471987
    17481988      p.get_signature.get_function_head_array.each{ |fun|
     1989        if @singleton then
     1990          if has_INIB? then
     1991            inib = "INIB"
     1992          else
     1993            inib = "CB"
     1994          end
     1995          if p.is_dynamic? && p.get_array_size == nil then
     1996            # dynamic call port (not array)
     1997            inib = "CB"
     1998          end
     1999        else
     2000          if has_CB? && has_INIB? then
     2001            inib = "->_inib"
     2002          else
     2003            inib = ""
     2004          end
     2005          if p.is_dynamic? && p.get_array_size == nil then
     2006            # dynamic call port (not array)
     2007            inib = ""
     2008          end
     2009        end
     2010
    17492011        f.print( "#define #{@global_name}_#{p.get_name}_#{fun.get_name}(" )
    17502012        ft = fun.get_declarator.get_type
     
    17722034
    17732035        # 関数名の出力(標準:受け口ディスクリプタから VMT の関数名、最適化:受け口関数 or 受け口ディスクリプタ)
    1774         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
    17752039          # 標準コード
    17762040          if @singleton then
     
    18072071
    18082072        # 受け口情報の出力(標準:受け口ディスクリプタ、最適化:IDX など)
    1809         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
    18102075          # 標準コード
    18112076          if @singleton then
     
    18572122  end
    18582123
     2124  #=== ref_desc 指定された呼び口に対するディスクリプタ参照関数の生成
     2125  def gen_ph_ref_desc_func f
     2126    if @n_call_port_ref_desc >0 then
     2127      f.printf( TECSMsg.get( :CRD_comment ), "#_CRD_#" )
     2128    end
     2129
     2130    if has_CB? && has_INIB? then
     2131      inib = "->_inib"
     2132    else
     2133      inib = ""
     2134    end
     2135    @port.each { |p|
     2136      next if p.get_port_type != :CALL
     2137      next if ! p.is_ref_desc?
     2138
     2139      if @singleton then
     2140        p_that = ""
     2141        p_cellcb = ""
     2142        delim = ""
     2143        if has_INIB? then
     2144          cb = "#{@global_name}_SINGLE_CELL_INIB."
     2145        else
     2146          cb = "#{@global_name}_SINGLE_CELL_CB."
     2147        end
     2148      else
     2149        p_that = "#{@global_name}_CB  *p_that"
     2150        p_cellcb = "    #{@global_name}_CB *p_cellcb = p_that;\n"
     2151        delim = ", "
     2152        cb = "p_cellcb#{inib}->"
     2153      end
     2154
     2155      if p.get_array_size
     2156        array = "#{delim}int_t  i "
     2157        array2 = "[ i ]"
     2158        assert = "    assert( 0 <= i && i < NCP_#{p.get_name} );\n"
     2159      else
     2160        array = ""
     2161        array2 = ""
     2162        assert = ""
     2163      end
     2164      f.print <<EOT
     2165/* [ref_desc] #{p.get_name} */
     2166Inline Descriptor( #{p.get_signature.get_global_name} )
     2167#{@global_name}_#{p.get_name}_refer_to_descriptor( #{p_that}#{array} )
     2168{
     2169    Descriptor( #{p.get_signature.get_global_name} )  des;
     2170#{p_cellcb}    /* cast is ncecessary for removing 'const'  */
     2171#{assert}    des.vdes = (struct tag_#{p.get_signature.get_global_name}_VDES *)#{cb}#{p.get_name}#{array2};
     2172    return des;
     2173}
     2174
     2175EOT
     2176    }
     2177  end
     2178
     2179  #=== dynamic 指定された呼び口に対するディスクリプタ設定関数の生成
     2180  def gen_ph_set_desc_func f
     2181    if @n_call_port_dynamic >0 then
     2182      f.printf( TECSMsg.get( :SDF_comment ), "#_SDF_#" )
     2183    end
     2184
     2185    @port.each { |p|
     2186      next if p.get_port_type != :CALL
     2187      next if ! p.is_dynamic?
     2188      if has_CB? && has_INIB? && p.get_array_size then
     2189        inib = "->_inib"
     2190      else
     2191        inib = ""
     2192      end
     2193      if @singleton then
     2194        # p "main== #{@global_name} #{p.get_name} #{p.get_array_size}"
     2195        p_that = ""
     2196        p_that2 = ""
     2197        p_cellcb = ""
     2198        if p.get_array_size && $rom then
     2199          cb = "#{@global_name}_SINGLE_CELL_INIB."
     2200        else
     2201          cb = "#{@global_name}_SINGLE_CELL_CB."
     2202        end
     2203      else
     2204        p_that = "#{@global_name}_CB  *p_that, "
     2205        p_that2 = "#{@global_name}_CB  *p_that "
     2206        p_cellcb = "    #{@global_name}_CB *p_cellcb = p_that;\n"
     2207        cb = "(p_cellcb)->#{inib}"
     2208      end
     2209
     2210      if p.get_array_size then
     2211        array = "int_t  i, "
     2212        array2 = "[ i ]"
     2213        array3 = " int_t  i "
     2214        assert2 = "    assert( 0 <= i && i < NCP_#{p.get_name} );\n"
     2215      else
     2216        array = ""
     2217        array2 = ""
     2218        array3 = ""
     2219        assert2 = ""
     2220      end
     2221      f.print <<EOT
     2222/* [dynamic] #{p.get_name} */
     2223Inline void
     2224#{@global_name}_#{p.get_name}_set_descriptor( #{p_that}#{array}Descriptor( #{p.get_signature.get_global_name} ) des )
     2225{
     2226#{p_cellcb}    assert( des.vdes != NULL );
     2227#{assert2}    #{cb}#{p.get_name}#{array2} = des.vdes;
     2228}
     2229
     2230EOT
     2231
     2232      if p.is_optional? then
     2233        if p_that2 != "" && array3 != "" then
     2234          delim = ", "
     2235        else
     2236          delim = ""
     2237        end
     2238        f.print <<EOT
     2239/* [dynamic,optional] #{p.get_name} */
     2240Inline void
     2241#{@global_name}_#{p.get_name}_unjoin( #{p_that2}#{delim}#{array3} )
     2242{
     2243#{p_cellcb}    #{cb}#{p.get_name}#{array2} = NULL;
     2244}
     2245
     2246EOT
     2247      end
     2248    }
     2249  end
     2250
    18592251  #=== send/receive で受け取ったメモリ領域を dealloc するマクロコード
    18602252  #f:: File
     
    19582350
    19592351        if p.is_omit? then
    1960           f.print( "                      #{dummy_p_cell_access_pre}omitted #{p.get_name}_#{fun.get_name}(" )
    1961         else
    1962           f.print( "                      #{dummy_p_cell_access_pre}#{@global_name}_#{p.get_name}_#{fun.get_name}(" )
     2352          f.print( "          #{dummy_p_cell_access_pre}omitted #{p.get_name}_#{fun.get_name}(" )
     2353        else
     2354          f.print( "          #{dummy_p_cell_access_pre}#{@global_name}_#{p.get_name}_#{fun.get_name}(" )
    19632355        end
    19642356        ft = fun.get_declarator.get_type
     
    19812373        f.print( " )#{dummy_p_cell_access_post}\n" )
    19822374      }
     2375    }
     2376    f.print( "\n" )
     2377  end
     2378
     2379  def gen_ph_ref_desc_macro_abbrev f
     2380    if @n_call_port_ref_desc >0 then
     2381      f.printf( TECSMsg.get( :CRDA_comment ), "#_CRDA_#" )
     2382    end
     2383
     2384    @port.each { |p|
     2385      next if p.get_port_type != :CALL
     2386      next if ! p.is_ref_desc?
     2387
     2388      if @singleton then
     2389        p_cellcb = ""
     2390        delim = ""
     2391      else
     2392        p_cellcb = "p_cellcb"
     2393        delim = ", "
     2394      end
     2395
     2396      if p.get_array_size then
     2397        array = " i "
     2398        array2 = "#{delim}i"
     2399      else
     2400        array = ""
     2401        array2 = ""
     2402      end
     2403
     2404      f.printf( "#define %s_refer_to_descriptor(#{array})\\\n          %s_refer_to_descriptor( #{p_cellcb}#{array2} )\n",
     2405                "#{p.get_name}",
     2406                "#{@global_name}_#{p.get_name}" )
     2407      f.printf( "#define %s_ref_desc(#{array})\\\n          %s_refer_to_descriptor(#{array})\n",   
     2408                "#{p.get_name}",
     2409                "#{p.get_name}" )
     2410    }
     2411    f.print( "\n" )
     2412  end
     2413
     2414  def gen_ph_set_desc_macro_abbrev f
     2415    if @n_call_port_dynamic >0 then
     2416      f.printf( TECSMsg.get( :SDMA_comment ), "#_SDMA_#" )
     2417    end
     2418
     2419    if @singleton then
     2420      p_cellcb = ""
     2421      delim = ""
     2422    else
     2423      p_cellcb = "p_cellcb"
     2424      delim = ", "
     2425    end
     2426    @port.each { |p|
     2427      next if p.get_port_type != :CALL
     2428      next if ! p.is_dynamic?
     2429
     2430      if p.get_array_size then
     2431        subsc = "i, "
     2432        subsc2 = "i"
     2433        subsc3 = delim + subsc2
     2434      else
     2435        subsc = ""
     2436        subsc2 = ""
     2437        subsc3 = ""
     2438      end
     2439      f.printf( "#define %s_set_descriptor( #{subsc}desc )\\\n          %s_set_descriptor( #{p_cellcb}#{delim}#{subsc}desc )\n",
     2440                "#{p.get_name}",
     2441                "#{@global_name}_#{p.get_name}" )
     2442      f.printf( "#define %s_unjoin( #{subsc2} )\\\n          %s_unjoin( #{p_cellcb}#{subsc3} )\n",
     2443                "#{p.get_name}",
     2444                "#{@global_name}_#{p.get_name}" )
    19832445    }
    19842446    f.print( "\n" )
     
    21492611        f.print( "typedef const struct tag_#{@global_name}_INIB {\n" )
    21502612
    2151         gen_cell_cb_type_port f
     2613        gen_cell_cb_type_port( f, :INIB )
    21522614        gen_cell_cb_type_attribute( f, :INIB )
    21532615
     
    21622624          f.print "    #{@global_name}_INIB  *_inib;\n"
    21632625        end
     2626        gen_cell_cb_type_port( f, :CB_DYNAMIC )
    21642627        gen_cell_cb_type_attribute( f, :CB )
    21652628        gen_cell_cb_type_var f
     
    21802643      f.print( "typedef struct tag_#{@global_name}_CB {\n" )
    21812644
    2182       gen_cell_cb_type_port f
     2645      gen_cell_cb_type_port( f, :CB )
    21832646      gen_cell_cb_type_attribute( f, :CB )
    21842647      gen_cell_cb_type_var f
     
    22482711  end
    22492712
    2250   def gen_cell_cb_type_port f
    2251     gen_cell_cb_type_call_port f
    2252     gen_cell_cb_type_entry_port f
    2253   end
    2254 
    2255   def gen_cell_cb_type_call_port f
     2713  def gen_cell_cb_type_port( f, inib_cb )
     2714    gen_cell_cb_type_call_port( f, inib_cb )
     2715    gen_cell_cb_type_entry_port( f, inib_cb )
     2716  end
     2717
     2718  def gen_cell_cb_type_call_port( f, inib_cb )
    22562719    # 呼び口
    22572720    if @n_call_port >0 then
    2258       f.print "    /* call port #_TCP_# */ \n"
     2721      f.print "    /* call port #_TCP_# */\n"
    22592722    end
    22602723
     
    22622725      next if p.get_port_type != :CALL
    22632726      next if p.is_omit?
    2264       ptr = ''
    2265       ptr = '*' if p.get_array_size
     2727      next if inib_cb == :INIB && p.is_dynamic? && p.get_array_size == nil && ! $ram_initializer
     2728      next if inib_cb == :CB_DYNAMIC && ( ! p.is_dynamic? || p.get_array_size != nil )
     2729      # bprint "cb_type #{inib_cb} #{p.get_name} dynamic=#{p.is_dynamic?}\n"
     2730
     2731      ptr = p.get_array_size ? '*' : ''
    22662732
    22672733      if ! p.is_cell_unique? then
     2734        const = p.is_dynamic?  ? '' : 'const'
     2735        if inib_cb == :INIB && p.is_dynamic? && p.get_array_size == nil && $ram_initializer then
     2736          init = '_init_'
     2737          const2 = 'const'
     2738        else
     2739          init = ''
     2740          const2 = 'const'
     2741        end
     2742
    22682743        if ! p.is_skelton_useless? then
    22692744          # 標準形
    2270           f.print( "    struct tag_#{p.get_signature.get_global_name}_VDES #{ptr}const*#{p.get_name;};\n" )
     2745          if inib_cb == :INIB && p.is_dynamic? && p.get_array_size != nil && $ram_initializer then
     2746            f.print( "    struct tag_#{p.get_signature.get_global_name}_VDES #{ptr}#{const2}*#{p.get_name;}_init_;\n" )
     2747          end
     2748          f.print( "    struct tag_#{p.get_signature.get_global_name}_VDES #{ptr}#{const}*#{p.get_name;}#{init};\n" )
     2749#          f.print( "    struct tag_#{p.get_signature.get_global_name}_VDES #{ptr}*#{p.get_name;};\n" )
    22712750          if p.get_array_size == "[]" then
    22722751            f.print( "    int_t n_#{p.get_name};\n" )
     
    22952774
    22962775  #=== Celltype#受け口配列添数を記憶する変数の定義
    2297   def gen_cell_cb_type_entry_port f
     2776  def gen_cell_cb_type_entry_port( f, inib_cb )
    22982777    # 呼び口
    22992778    if @n_entry_port >0 then
     
    23182797        f.print "extern  #{@global_name}_INIB  #{@global_name}_SINGLE_CELL_INIB;\n"
    23192798      end
    2320 
    2321 #     @ordered_cell_list.each{ |c|
    2322 #        f.print "extern  #{@global_name}_CB  #{@global_name}_#{c.get_name}_CB;\n"
    2323 #      }
    2324 
    23252799      f.print "\n"
    2326     elsif @idx_is_id_act then
    2327       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
    23282819    else
    2329       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
    23302826    end
    23312827  end
    23322828
    23332829  def gen_ph_INIB_as_CB f
    2334 
     2830    # ここは、手抜きである。本来なら INIB を出力すべき
    23352831    if ! has_CB? && has_INIB? then
    23362832      f.printf( TECSMsg.get( :DCI_comment ),  "#_DCI_#" )
    2337       f.print "#define #{@global_name}_CB_tab           #{@global_name}_INIB_tab\n"
    2338       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
    23392840      f.print "#define #{@global_name}_CB               #{@global_name}_INIB\n"
    23402841      f.print "#define tag_#{@global_name}_CB           tag_#{@global_name}_INIB\n"
     
    23602861      f.printf( TECSMsg.get( :FEC_comment ), "#_FEC_#" )
    23612862
    2362       if @idx_is_id_act then
     2863      if @b_need_ptab then
    23632864        amp = ''
     2865        tab = 'ptab'
    23642866      else
    23652867        amp = '&'
     2868        tab = 'tab'
    23662869      end
    23672870      f.print <<EOT
    23682871#define FOREACH_CELL(i,p_cb)   \\
    23692872    for( (i) = 0; (i) < #{@global_name}_N_CELL; (i)++ ){ \\
    2370        #{necessity}(p_cb) = #{amp}#{@global_name}_CB_tab[i];
     2873       #{necessity}(p_cb) = #{amp}#{@global_name}_CB_#{tab}[i];
    23712874
    23722875#define END_FOREACH_CELL   }
     
    24182921
    24192922    if @n_cell_gen > 0 && need_CB_initializer? then
     2923      b_var_init = false
    24202924      f.print "#define INITIALIZE_CB#{arg}"
    24212925      @var.each { |v|
     
    24232927        next if init == nil
    24242928
     2929        b_var_init = true
    24252930        type = v.get_type.get_original_type
    24262931        f.print "\\\n"
     
    24382943#            post = ""
    24392944          end
    2440           f.print "\tmemcpy((void*)#{pre}#{@global_name}_VAR_#{v.get_name}#{p_that}#{post}, (void*)#{pre}#{@global_name}_#{v.get_name}_VAR_INIT#{post}, sizeof(#{@global_name}_#{v.get_name}_VAR_INIT));"
     2945          f.print "\tmemcpy((void*)#{pre}#{@global_name}_VAR_#{v.get_name}#{p_that}#{post}, "
     2946          f.print "(void*)#{pre}#{@global_name}_#{v.get_name}_VAR_INIT#{post}, sizeof(#{@global_name}_#{v.get_name}_VAR_INIT));"
    24412947        elsif init.instance_of? C_EXP then
    24422948          f.print "\t#{that}#{v.get_name} = #{init.get_c_exp_string};"
     
    24512957        end
    24522958      }
     2959
     2960      # dynamic call port の初期化コード
     2961      b_dyn_port = false
     2962      @port.each{ |p|
     2963        next if p.get_port_type != :CALL
     2964        if p.is_dynamic? && $ram_initializer then
     2965          if p.get_array_size == nil then
     2966            f.print "\\\n\t#{that}#{p.get_name} = #{that}_inib->#{p.get_name}_init_;"
     2967          else
     2968            if @singleton || p.get_array_size != "[]" then
     2969              p_that = ""
     2970            else
     2971              p_that = "(p_that)"
     2972            end
     2973            if @singleton then
     2974              that = "#{@global_name}_SINGLE_CELL_INIB."
     2975            else
     2976              that = "(p_that)->"
     2977            end
     2978            if has_CB? then
     2979              init = '_init->'
     2980            else
     2981              init = ''
     2982            end
     2983            f.printf( "\\\n%-80s\\\n", '     {' )
     2984            f.printf( "%-80s\\\n", '        int_t   j;' )
     2985            f.printf( "%-80s\\\n", "        for( j = 0; j < N_CP_#{p.get_name}#{p_that}; j++ ){" )
     2986            f.printf( "%-80s\\\n", "            #{that}#{p.get_name}[j] = #{that}#{init}#{p.get_name}_init_[j];" )
     2987            f.printf( "%-80s\\\n", '        }' )
     2988            f.printf( "%-80s", '       }' )
     2989          end
     2990          b_dyn_port = true
     2991        end
     2992      }
     2993      if b_dyn_port then
     2994        f.print( "\n" )
     2995      end
     2996     
     2997      if b_var_init == false && b_dyn_port == false && ! @singleton then
     2998        f.print "\t(void)(p_that);"
     2999      end
    24533000      f.print "\n"
    24543001
     
    24573004        if @singleton then
    24583005          f.print "\t#{that}_inib = &#{@global_name}_SINGLE_CELL_INIB;\n\n"
    2459         elsif @idx_is_id_act
    2460           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"
    24613008        else
    24623009          f.print "\t#{that}_inib = &#{@global_name}_INIB_tab[(i)];\n\n"
     
    26973244              j = am[i]
    26983245              if j then
    2699                 if am[i].get_cell.get_celltype == self then
     3246                if am[i].get_rhs_cell.get_celltype == self then
    27003247                  # 同じセルタイプへ結合している場合(VDES では type conflict になる)
    27013248                  p = am[i].get_rhs_port
     
    27263273            end
    27273274          else
    2728             if j.get_cell.get_celltype == self then
     3275            dbgPrint "me=#{@name} callee=#{j.get_rhs_cell.get_celltype.get_name} #{j.get_cell.get_celltype.get_name} \n"
     3276            if j.get_rhs_cell.get_celltype == self then
    27293277              # 同じセルタイプへ結合している場合(VDES では type conflict になる)
    27303278              p = j.get_rhs_port
     
    27653313
    27663314        jl = c.get_join_list
    2767         jl.get_items.each{ |j|
    2768           definition = j.get_definition
    2769           next unless definition.instance_of? Port
     3315        # ループを回す変数を jl から @port に変更
     3316        # dynamic, optional
     3317#        jl.get_items.each{ |j|
     3318        @port.each { |port|
     3319          next if port.get_port_type != :CALL
     3320          dbgPrint( "gen_cell_ep_vdes_array: #{c.get_name}.#{port.get_name}\n" )
     3321
     3322#          definition = j.get_definition
     3323#          next unless definition.instance_of? Port
     3324          j = jl.get_item( port.get_name )
     3325
    27703326          # port = definition    # definition は composite の Port が得られることがある
    2771           port = find j.get_name # celltype の Port (こちらに最適化情報がある)
     3327          # port = find j.get_name # celltype の Port (こちらに最適化情報がある)
    27723328          next if port.is_cell_unique?
    27733329          next if port.is_omit?
    27743330
    2775           am = j.get_array_member2
    2776           if am  then
     3331          b_array = false
     3332          am = nil
     3333          if j then
     3334            am = j.get_array_member2
     3335            if am then
     3336              b_array = true
     3337            end
     3338          else
     3339            if port.get_array_size == "[]" then
     3340              # this case is dynamic optional and nothing joined
     3341              next
     3342            elsif port.get_array_size then
     3343              b_array = true
     3344            end
     3345          end
     3346          if b_array  then
     3347#          if am then
    27773348            # 左辺は配列
     3349            const = ( port.is_dynamic? && ! $ram_initializer ) ? '' : 'const '
     3350            init = ( port.is_dynamic? && $ram_initializer ) ? '_init_' : ''
    27783351
    27793352            if ! port.is_skelton_useless? then
    2780               f.printf( "struct %s * const %s_%s[] = {\n",
     3353              f.printf( "struct %s * #{const}%s_%s[] = {\n",
    27813354                        "tag_#{port.get_signature.get_global_name}_VDES",
    27823355                        "#{c.get_global_name}",
    2783                         "#{j.get_name}" )
     3356                        "#{port.get_name}" + init )
    27843357            else
    27853358
    27863359#              スケルトン関数不要最適化の場合、この配列は参照されない
    27873360              # mikan このケースがテストされていない
    2788               f.printf( "const %s_IDX  %s_%s[] = {\n",
     3361              f.printf( "#{const}%s_IDX  %s_%s[] = {\n",
    27893362#                        "#{j.get_celltype.get_global_name}",   # 右辺 composite に対応できない
    27903363                        "#{j.get_rhs_cell.get_celltype.get_global_name}",
     
    28003373            i = 0
    28013374            while i < length
     3375              if am == nil then
     3376                f.print( "    0,\n" )
     3377                i += 1
     3378                next
     3379              end
    28023380              j = am[i]
    28033381              i += 1
     
    28413419            # mikan   cell の namespace 未対応、Join で Cell オブジェクトを引当ておく必要あり
    28423420            f.print "};\n"
     3421            # dynamic の呼び口配列
     3422            if port.is_dynamic? && $ram_initializer then
     3423              f.printf( "struct %s * %s_%s[ #{length} ];\n",
     3424                        "tag_#{port.get_signature.get_global_name}_VDES",
     3425                        "#{c.get_global_name}",
     3426                        "#{port.get_name}" )
     3427            end
    28433428          end
    28443429        }
     
    29673552        init = v.get_initializer
    29683553        if init && init.instance_of?( Array ) then
    2969           type = v.get_type.get_original_type
    2970 
    2971           if( type.kind_of? PtrType )then
     3554          type = v.get_type
     3555          org_type = v.get_type.get_original_type
     3556
     3557          if( org_type.kind_of? PtrType )then
    29723558            # PtrType は ArrayType にすり替える
    29733559
     
    29763562            t2.set_type( type.get_type )
    29773563            type = t2
     3564            org_type = t2
    29783565          end
    29793566
     
    29823569          # f.print "const #{type0.get_type_str}\t#{@global_name}_#{v.get_name}_VAR_INIT#{type0.get_type_str_post} = "
    29833570          f.print "const #{type.get_type_str}\t#{@global_name}_#{v.get_name}_VAR_INIT#{type.get_type_str_post} = "
    2984           if type.kind_of? StructType then
     3571          if org_type.kind_of? StructType then
    29853572            # celltype の default の初期値あり
    29863573            str = gen_cell_cb_init( f, c, name_array, type, init, v.get_identifier, 1, true )
    2987           elsif( type.kind_of?( PtrType ) || type.kind_of?( ArrayType ) ) then
     3574          elsif( org_type.kind_of?( PtrType ) || org_type.kind_of?( ArrayType ) ) then
    29883575            str = "{ "
    2989             type = type.get_type
     3576            type = org_type.get_type
    29903577            # mikan ポインタではなく、配列型としないと、ポインタ変数の領域の分、損する
    29913578            init.each { |i|
     
    30153602        fs.each{ |r, f| f.print "#{@global_name}_INIB #{@global_name}_SINGLE_CELL_INIB = \n" }
    30163603        indent = 0
    3017       elsif ! @idx_is_id_act then
     3604      elsif ! @b_need_ptab then
    30183605        fs.each{ |r, f| f.print "#{@global_name}_INIB #{@global_name}_INIB_tab[] = {\n" }
    30193606        indent = 1
     
    30363623
    30373624        print_indent( f, indent )
    3038         if @idx_is_id_act then
     3625        if @b_need_ptab then
    30393626          f.print "const #{@global_name}_INIB #{name_array[5]} = "
    30403627        end
    30413628        f.print "{\n"
    30423629
    3043         gen_cell_cb_port( c, indent, f, name_array )
     3630        gen_cell_cb_port( c, indent, f, name_array, :INIB )
    30443631        gen_cell_cb_attribute( c, indent, f, name_array, :INIB )
    30453632
    30463633        unless @singleton then
    30473634          # 1 つの cell INIB の終わり
    3048           if @idx_is_id_act then
     3635          if @b_need_ptab then
    30493636            f.print( "};\n\n" )
    30503637          else
     
    30533640        end
    30543641      }
    3055       if ! @idx_is_id_act then
     3642      if ! @b_need_ptab then
    30563643        fs.each{ |r, f| f.print( "};\n\n" ) }
    30573644      end
     
    30683655          fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_SINGLE_CELL_CB = \n" }
    30693656          indent = 0
    3070         elsif ! @idx_is_id_act then
     3657        elsif ! @b_need_ptab then
    30713658          fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_CB_tab[] = {\n" }
    30723659          indent = 1
     3660        else
     3661          indent = 0
    30733662        end
    30743663
     
    30873676
    30883677          print_indent( f, indent )
    3089           if @idx_is_id_act then
     3678          if @b_need_ptab then
    30903679            f.print "#{@global_name}_CB #{name_array[2]} = "
    30913680          end
     
    30973686          end
    30983687
    3099           if ! has_INIB? then
    3100             gen_cell_cb_port( c, indent, f, name_array )
     3688          #if ! has_INIB? then
     3689          if $rom == false then
     3690            gen_cell_cb_port( c, indent, f, name_array, :CB_ALL )
     3691          else
     3692            gen_cell_cb_port( c, indent, f, name_array, :CB_DYNAMIC )
    31013693          end
    31023694
     
    31063698          unless @singleton then
    31073699            # 1 つの cell CB の終わり
    3108             if @idx_is_id_act then
     3700            if @b_need_ptab then
    31093701              f.print( "};\n\n" )
    31103702            else
     
    31133705          end
    31143706        }
    3115         if ! @idx_is_id_act then
     3707        if ! @b_need_ptab then
    31163708          fs.each{ |r, f| f.print( "};\n\n" ) }
    31173709        end
     
    31203712          fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_SINGLE_CELL_CB;\n" }
    31213713          indent = 0
    3122         elsif @idx_is_id_act then
     3714        elsif @b_need_ptab then
    31233715          @ordered_cell_list.each{ |c|
    31243716            next if ! c.is_generate?
     
    31393731  def gen_cell_cb_tab f
    31403732    indent = 0
    3141     if @idx_is_id_act then
     3733    if @b_need_ptab then
    31423734      if has_INIB? && ( $ram_initializer || ! has_CB? ) then
    31433735        f.print "/* ID to INIB table #_INTAB_# */\n"
     
    31503742        }
    31513743
    3152         f.print "#{@global_name}_INIB *#{@global_name}_INIB_tab[] ={\n"
     3744        f.print "#{@global_name}_INIB *const #{@global_name}_INIB_ptab[] ={\n"
    31533745        @ordered_cell_list.each{ |c|
    31543746          if c.is_generate? then                           # 生成対象か?
     
    31703762        }
    31713763
    3172         f.print "#{@global_name}_CB *#{@global_name}_CB_tab[] ={\n"
     3764        f.print "#{@global_name}_CB *const #{@global_name}_CB_ptab[] ={\n"
    31733765        @ordered_cell_list.each{ |c|
    31743766          if c.is_generate? then                           # 生成対象か?
     
    31993791  #   name_array[9] = @global_name    # celltype global name
    32003792  #   name_array[10] = cell.get_global_name # cell global name
     3793  #   name_array[11] = cell_INIB_proto #INIB name for proto type
    32013794 
    32023795  def get_name_array( cell )
     
    32073800      cell_CB_proto = "#{@global_name}_SINGLE_CELL_CB"
    32083801      cell_INIB_name = "#{@global_name}_SINGLE_CELL_INIB"
     3802      cell_INIB_proto = cell_INIB_name
    32093803      cell_ID = 0
    32103804    else
    3211       if ! @idx_is_id_act then
     3805      if ! @b_need_ptab then
    32123806        index = cell.get_id - cell.get_celltype.get_id_base
    32133807        cell_CB_name = "#{@global_name}_CB_tab[#{index}]"
     
    32153809        cell_CB_proto = "#{@global_name}_CB_tab[]"
    32163810        cell_INIB_name = "#{@global_name}_INIB_tab[#{index}]"
     3811        cell_INIB_proto = "#{@global_name}_INIB_tab[]"
    32173812      else
    32183813        cell_CB_name = "#{cell.get_global_name}_CB"
     
    32203815        cell_CB_proto = cell_CB_name
    32213816        cell_INIB_name = "#{cell.get_global_name}_INIB"
     3817        cell_INIB_proto = cell_INIB_name
    32223818      end
    32233819      cell_ID = cell.get_id
    32243820    end
     3821
     3822    if has_CB? then
     3823      cell_CBP = "&#{cell_CB_name}"
     3824    elsif has_INIB? then
     3825      cell_CBP = "&#{cell_INIB_name}"
     3826    else
     3827      cell_CBP = "NULL"    # CB も INIB もなければ NULL に置換
     3828    end
     3829
    32253830    if @idx_is_id_act then
    32263831      cell_IDX = cell_ID
    32273832    else
    3228       cell_IDX = "&#{cell_CB_name}"
    3229     end
    3230 
    3231     if ! has_CB? && ! has_INIB? then
    3232       cell_CBP = "NULL"    # CB も INIB もなければ NULL に置換
    3233     else
    3234       cell_CBP = "&#{cell_CB_name}"
     3833      cell_IDX = cell_CBP
    32353834    end
    32363835
     
    32473846    name_array[9] = @global_name    # celltype global name
    32483847    name_array[10] = cell.get_global_name # cell global name
     3848    name_array[11] = cell_INIB_proto # INIB name for prototype
    32493849
    32503850    return name_array
     
    33313931  end
    33323932
    3333   def gen_cell_cb_port( cell, indent, f, name_array )
    3334     gen_cell_cb_call_port( cell, indent, f, name_array )
     3933  #inib_cb::Symbol: :INIB, :CB_ALL, :CB_DYNAMIC
     3934  def gen_cell_cb_port( cell, indent, f, name_array, inib_cb = :INIB )
     3935    gen_cell_cb_call_port( cell, indent, f, name_array, inib_cb )
    33353936    gen_cell_cb_entry_port( cell, indent, f, name_array )
    33363937  end
    33373938
    33383939  #=== 呼び口の初期化コードの生成
    3339   def gen_cell_cb_call_port( cell, indent, f, name_array )
     3940  def gen_cell_cb_call_port( cell, indent, f, name_array, inib_cb )
    33403941    jl = cell.get_join_list
    33413942
    33423943    port = get_port_list
    3343     if @n_call_port != 0 then
     3944    if inib_cb == :INIB && ( @n_call_port - @n_call_port_omitted_in_CB -
     3945                             ( $ram_initializer ? 0 : (@n_call_port_dynamic-@n_call_port_array_dynamic) )  > 0 ) ||
     3946       inib_cb == :CB_ALL && @n_call_port > 0 ||
     3947       inib_cb == :CB_DYNAMIC && (@n_call_port_dynamic - @n_call_port_array_dynamic) > 0 then
    33443948      print_indent( f, indent + 1 )
    3345       f.print "/* call port #_CP_# */ \n"
     3949      f.print "/* call port (#{inib_cb}) #_CP_# */ \n"
    33463950      port.each{ |p|
    33473951        next if p.get_port_type != :CALL
    33483952        next if p.is_omit?
    33493953        next if p.is_cell_unique?        # 最適化(単一セルで呼び口マクロに埋め込まれる)
     3954        next if inib_cb == :INIB && p.is_dynamic? && p.get_array_size == nil && ! $ram_initializer
     3955        next if inib_cb == :CB_DYNAMIC && ( ! p.is_dynamic? || p.get_array_size != nil )
    33503956
    33513957        j = jl.get_item( p.get_name )
     
    33543960        # debug
    33553961        if j == nil then
     3962          dbgPrint "cell_cb_call_port: #{p.get_name} array size=#{p.get_array_size}\n"
    33563963          # optional 呼び口
    33573964          # cdl_error( "H1003 internal error: cell \'$1\' port \'$2\': initializer not found\n" , cell.get_name, p.get_name )
    33583965          # exit( 1 )
    3359           f.printf( "%-40s /* #_CCP5_# */\n",  "0," )
    3360           if p.get_array_size == "[]" then
    3361             # 添数省略の呼び口配列
    3362             print_indent( f, indent + 1 )
    3363             f.printf( "%-40s /* %s #_CCP6_# */\n", "0,", "length of #{p.get_name} (n_#{p.get_name})" )
     3966          if p.get_array_size then
     3967            if p.is_dynamic? then
     3968              if inib_cb == :INIB then
     3969                if  $ram_initializer then
     3970                  f.printf( "%-40s /* #_CCP7_# _init_ */\n",  "#{cell.get_global_name}_#{p.get_name}_init_," )
     3971                  print_indent( f, indent + 1 )
     3972                end
     3973                f.printf( "%-40s /* #_CCP7B_# */\n",  "#{cell.get_global_name}_#{p.get_name}," )
     3974              elsif $rom == false then
     3975                f.printf( "%-40s /* #_CCP8_# */\n",  "#{cell.get_global_name}_#{p.get_name}," )
     3976              end
     3977            else
     3978              f.printf( "%-40s /* #_CCP9_# */\n",  "0," )
     3979            end
     3980            if p.get_array_size == "[]" then
     3981              # 添数省略の呼び口配列
     3982              print_indent( f, indent + 1 )
     3983              f.printf( "%-40s /* %s #_CCP6_# */\n", "0,", "length of #{p.get_name} (n_#{p.get_name})" )
     3984            end
     3985          else
     3986            f.printf( "%-40s /* #_CCP5_# */\n",  "0," )
    33643987          end
    33653988          next
     
    33693992        if am then
    33703993          # 呼び口配列の場合
    3371           f.printf( "%-40s /* #_CCP3_# */\n",  "#{cell.get_global_name}_#{j.get_name}," )
     3994          if inib_cb == :INIB && p.is_dynamic? && p.get_array_size != nil && $ram_initializer then
     3995            f.printf( "%-40s /* #_CCP3_# _init_ */\n",  "#{cell.get_global_name}_#{j.get_name}_init_," )
     3996            print_indent( f, indent + 1 )
     3997          end
     3998          f.printf( "%-40s /* #_CCP3B_# */\n",  "#{cell.get_global_name}_#{j.get_name}," )
    33723999          if p.get_array_size == "[]" then
    33734000            # 添数省略の呼び口配列
     
    33854012          end
    33864013
     4014          init = ( p.is_dynamic? && inib_cb == :INIB ) ? "_init_" : ""
     4015
    33874016          if j.get_rhs_subscript then
    33884017            # 受け口配列の場合
     
    33914020                      # "&#{j.get_cell_global_name}_#{j.get_port_name}_des#{subscript},",
    33924021                      "#{des_type_cast}&#{j.get_port_global_name}_des#{subscript},",
    3393                       p.get_name )
     4022                      p.get_name.to_s + init )
    33944023          else
    33954024            # 呼び口配列でも、受け口配列でもない
     
    33974026              f.printf( "%-40s /* %s #_CCP1_# */\n",
    33984027                        "#{des_type_cast}&#{j.get_port_global_name}_des,",
    3399                         p.get_name )
     4028                        p.get_name.to_s + init )
    34004029            else
    34014030              # スケルトン不要最適化(CB (INIB) へのポインタを埋め込む)
    34024031              c = j.get_rhs_cell                    # 呼び先セル
    34034032              ct = c.get_celltype                   # 呼び先セルタイプ
     4033              name_array = ct.get_name_array( c )   # 呼び先セルタイプで name_array を得る
    34044034              if ct.has_INIB? || ct.has_CB? then
    3405                 name_array = ct.get_name_array( c )   # 呼び先セルタイプで name_array を得る
    34064035                f.printf( "%-40s /* %s #_CCP2_# */\n", "#{name_array[7]},", p.get_name )
    34074036              else
    34084037                # 呼び先は CB も INIB も持たない(NULL に初期化)
    3409                 f.printf( "%-40s /* %s #_CCP2_# */\n", "0,", p.get_name )
     4038                f.printf( "%-40s /* %s #_CCP2B_# */\n", "0,", p.get_name )
    34104039              end
    34114040            end
     
    36894318      f = fs[ c.get_region.get_domain_root ]
    36904319
    3691       ct = c.get_celltype
     4320      ct = c.get_celltype     # ct = self でも同じ
    36924321      jl = c.get_join_list
     4322      name_array = get_name_array( c )
    36934323
    36944324      port = ct.get_port_list
     
    37254355              else
    37264356                if has_CB? then
    3727                   if @singleton then
    3728                     f.print "    &#{@global_name}_SINGLE_CELL_CB,        /* CB */\n"
    3729                   else
    3730                     # f.print "    &#{@global_name}_#{c.get_name}_CB,\n"
    3731                     f.print "    &#{@global_name}_CB_tab[#{index}],      /* CB */\n"
    3732                   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"
    37334364                elsif has_INIB? then
    3734                   if @singleton then
    3735                     f.print "    &#{@global_name}_SINGLE_CELL_INIB,      /* INIB */\n"
    3736                   else
    3737                     f.print "    &#{@global_name}_INIB_tab[#{index}],    /* INIB */\n"
    3738                   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"
    37394371                else
    37404372                  f.print "    0,\n"
     
    37604392            else
    37614393              if has_CB? then
    3762                 if @singleton then
    3763                   f.print "    &#{@global_name}_SINGLE_CELL_CB,       /* CB */\n"
    3764                 else
    3765                   f.print "    &#{@global_name}_CB_tab[#{index}],     /* CB */\n"
    3766                   # f.print "    &#{@global_name}_#{c.get_name}_CB,\n"
    3767                 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"
    37684401              elsif has_INIB? then
    3769                 if @singleton then
    3770                   f.print "    &#{@global_name}_SINGLE_CELL_INIB,     /* INIB */\n"
    3771                 else
    3772                   f.print "    &#{@global_name}_INIB_tab[#{index}],   /* INIB */\n"
    3773                 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"
    37744408              else
    37754409                f.print "    0,\n"
     
    39404574
    39414575        ft.get_paramlist.get_items.each{ |param|
     4576          # p "type_str: #{param.get_type.get_type_str}"
    39424577          f.print( "#{delim} #{param.get_type.get_type_str}" )
    39434578          f.print( " #{param.get_name}#{param.get_type.get_type_str_post}" )
     
    39674602      end
    39684603
     4604      if p.is_ref_desc? then
     4605        subsc = p.get_array_size ? ' int_t subscript ' : ''
     4606        f.print " *   [ref_desc]\n"
     4607        f.printf( " *      %-14s %s;\n",
     4608                  "Descriptor( #{p.get_signature.get_global_name} )",
     4609                  "#{p.get_name}_refer_to_descriptor(#{subsc})" )
     4610        f.printf( " *      %-14s %s;\n",
     4611                  "Descriptor( #{p.get_signature.get_global_name} )",
     4612                  "#{p.get_name}_ref_desc(#{subsc})      (same as above; abbreviated version)" )
     4613      end
     4614      if p.is_dynamic? then
     4615        subsc = p.get_array_size ? 'int_t subscript, ' : ''
     4616        subsc2 = p.get_array_size ? ' int_t subscript' : ''
     4617        if p.is_optional? then
     4618          f.print " *   [dynamic, optional]\n"
     4619        else
     4620          f.print " *   [dynamic]\n"
     4621        end
     4622        f.printf( " *      %-14s %s;\n",
     4623                  "void",
     4624                  "#{p.get_name}_set_descriptor( #{subsc}Descriptor( #{p.get_signature.get_global_name} ) desc )" )
     4625        if p.is_optional? then
     4626          f.printf( " *      %-14s %s;\n",
     4627                    "void",
     4628                    "#{p.get_name}_unjoin( #{subsc2} )" )
     4629        end
     4630      end
    39694631    }
    39704632
     
    40484710          delim = ", "
    40494711          f.print param.get_type.get_type_str
     4712          # p "type_str2: #{param.get_type.get_type_str}"
    40504713          f.print " "
    40514714          f.print param.get_name
     
    41034766  def generate_inline_template_code
    41044767    return if @n_entry_port_inline == 0
     4768    return if @b_reuse && ! $generate_all_template
    41054769    if ! ( @plugin && @plugin.gen_ep_func? ) then
    41064770      return if @b_reuse && ! $generate_all_template
     
    44805144  #  str に以下の置換を行う
    44815145  #-   $ct$ ⇒ セルタイプ名(ct)
    4482   #-   $cell$ ⇒ セル名(cell)   cell が nil ならば3つの置換は行われない
     5146  #-   $cell$ ⇒ セル名(cell)   cell が nil ならば以下の置換は行われない
    44835147  #-   $cb$ ⇒ CB の C 言語名(cb)
    44845148  #-   $cbp$ ⇒ CB へのポインタ(cbp)
    44855149  #-   $cb_proto$ ⇒ CB の C 言語名プロトタイプ宣言用(cb_proto)
    4486   #-   $id$ ⇒ ct_cell
     5150  #-   $id$ ⇒ $ct$_$cell_global$    # ct_cell  before or same V1.5.2
    44875151  #-   $idx$ ⇒ idx
    44885152  #-   $ID$ ⇒ id (整数の番号)
    44895153  #-   $ct_global$ ⇒ セルタイプ名(ct)
    4490   #-   $cell_global$ ⇒ セル名(cell)   cell が nil ならば3つの置換は行われない
     5154  #-   $cell_global$ ⇒ セル名(cell)
    44915155  #-   $$   ⇒ $
    44925156  def subst_name( str, name_array )
     
    45035167
    45045168    str = str.gsub( /(^|[^\$])\$ct\$/, "\\1#{ct}" )
     5169    str = str.gsub( /(^|[^\$])\$ct_global\$/, "\\1#{ct_global}" )
    45055170    if cell then
    45065171      str = str.gsub( /(^|[^\$])\$cell\$/, "\\1#{cell}" )
    45075172      str = str.gsub( /(^|[^\$])\$cb\$/, "\\1#{cb}" )
    4508       str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell}" )
     5173      # str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell}" )
     5174      str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell_global}" )
    45095175      str = str.gsub( /(^|[^\$])\$cb_proto\$/, "\\1#{cb_proto}" )
    45105176      str = str.gsub( /(^|[^\$])\$ID\$/, "\\1#{id}" )
    45115177      str = str.gsub( /(^|[^\$])\$idx\$/, "\\1#{idx}" )
    45125178      str = str.gsub( /(^|[^\$])\$cbp\$/, "\\1#{cbp}" )
    4513       str = str.gsub( /(^|[^\$])\$ct_global\$/, "\\1#{ct_global}" )
    45145179      str = str.gsub( /(^|[^\$])\$cell_global\$/, "\\1#{cell_global}" )
    45155180    end
     
    46315296  end
    46325297end
     5298
     5299class DomainType < Node
     5300  def gen_factory
     5301    # p "DomainType: gen_factory"
     5302    @plugin.gen_factory
     5303  end
     5304end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/location.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/messages.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    8989 end
    9090
     91 #=== TECSMsg#ローカライズされた情報メッセージを得る
     92 # Generator.info2 から呼び出される
     93 def self.get_info_message( body )
     94   body =~ /^[A-Z0-9]+/    # 情報番号を取り出す
     95   num = $&
     96   msg = @@info_message[ num.to_sym ]
     97   if msg == nil then
     98     m = body
     99   else
     100     m = num + " " + msg
     101   end
     102   return m
     103 end
     104
    91105end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/optimize.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    178178
    179179  def set_domain
     180    domain_cells = {}
    180181    @cell_list.each{ |c|
    181182      if c.is_generate? then
     
    191192          @domain_roots[ dn ] = [ dr ]
    192193        end
     194        if domain_cells[ dr ]  then
     195          domain_cells[ dr ] << c
     196        else
     197          domain_cells[ dr ] = [ c ]
     198        end
    193199      end
    194200    }
     
    196202    @domain_roots.each{ |dn, drs|
    197203      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 = ""
    200207        drs.each{ |r|
    201           dbgPrint " region=#{r.get_name}"
     208          print delim, r.get_name
     209          delim = ", "
    202210        }
    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        }
    204221      end
    205222    }
     
    212229      # domain_type は一つのノードに一つしかないので、一つの要素を無条件で取り出す
    213230      if regions.length > 1 then
    214         cdl_info( "celltype:#{@name} has cells in multi domain.\n" )
    215         if @idx_is_id == false then
    216           cdl_info( "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
    219239      end
    220240    }
     
    228248    end
    229249
     250    optimize_call
     251    if $unopt_entry == false then
     252      optimize_entry
     253    end
     254  end
     255
     256  #=== Celltype#呼び口最適化
     257  def optimize_call
    230258    @port.each{ |port|
    231259      next if port.get_port_type != :CALL
     
    238266        if $verbose then
    239267          print "optimized by omit: port: #{port.get_name} : o\n"
     268        end
     269        next
     270      elsif port.is_dynamic? then
     271        if $verbose then
     272          print "unoptimized by dynamic: port: #{port.get_name}\n"
     273        end
     274        next
     275      elsif port.is_ref_desc? then
     276        if $verbose then
     277          print "unoptimized by ref_desc: port: #{port.get_name}\n"
    240278        end
    241279        next
     
    351389      dbgPrint "#{port.get_name} : # of cells : #{port_cells.length}  # of ports : #{port_ports.length}\n"
    352390    }
    353 
     391  end
     392
     393  #=== Celltype#受け口最適化
     394  # optimize_entry は、呼び口最適化の結果を使用している
     395  def optimize_entry
    354396    # 受け口最適化の設定
    355397    @port.each{ |port|
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/plugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3838#++
    3939
    40 #== class モジュール
     40#== Plugin クラス
    4141# ThroughPlugin, SignaturePlugin, CelltypePlugin に include する
    4242class Plugin < Node
     
    7575  end
    7676
    77 ### 意味解析段階で呼び出されるメソッド ###
     77### 構文解釈 または 意味解析段階で呼び出されるメソッド ###
     78# generate 指定子の場合、構文解釈次第(end_of_parseで)呼び出される
     79# generate 文の場合、出現次第呼び出される
     80  ### 意味解析段階で呼び出されるメソッド ### <<< コメント誤り (V1.4.2)
    7881  #===  CDL ファイルの生成
    7982  #      typedef, signature, celltype, cell のコードを生成
     
    157160      #  識別子取得
    158161      if arg =~ /\A[a-zA-Z_]\w*/ then
    159         ident = $~
     162        ident = $~.to_s    #
    160163        arg = $'
    161164      else
     
    285288end
    286289
    287 #== 出力文字列を EUC から出力ファイルに convert する
    288 # tecsgen のソースコードは EUC で記述されている
     290#== 出力文字列を utf-8 から出力ファイルに convert する
     291# tecsgen のソースコードは utf-8 で記述されている
    289292# これを、出力ファイルの文字コードに変換して出力する
    290293#
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/pluginModule.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    4545
    4646  #=== プラグインをロードする
    47   #return:: true : 成功、 false : 失敗
     47  # return:: PluginClass
     48  # V1.4.1 まで return:: true : 成功、 false : 失敗
     49  #
     50  # #{plugin_name}.rb をロードし、plugin_name クラスのオブジェクトを生成する.
     51  # plugin_name が MultiPlugin の場合、get_plugin により、superClass のプラグインオブジェクトをロードする.
    4852  #
    4953  # すでにロードされているものは、重複してロードしない
     
    5963        end
    6064        # "#{plugin_name}.rb" をロード(システム用ではないので、fatal エラーにしない)
    61         if require_tecsgen_lib( "#{plugin_name}.rb", false ) == false
     65        if require_tecsgen_lib( "#{plugin_name}.rb", false ) == false then
    6266          cdl_error( "P2001 $1.rb : fail to load plugin" , plugin_name )
    63           return false
     67          return nil
    6468        end
    6569      end
    6670
    67       plSuper = nil
    68       # eval( "plSuper = #{plugin_name}.superclass" )
    69       eval( "plSuper = #{plugin_name}" )
    70       while plSuper != superClass && plSuper != nil
    71         plSuper = plSuper.superclass
    72       end
    73       if plSuper == nil then
     71      plClass = Object.const_get plugin_name
     72      if ( plClass <= superClass ) then       # plClass inherits superClass
     73        return plClass
     74      elsif (plClass <= MultiPlugin) then     # plClass inherits MultiPlugin
     75        dbgPrint "pluginClass=#{plClass}\n"
     76        plugin_object = plClass.get_plugin superClass
     77        dbgPrint "pluginClass=#{plugin_object}\n"
     78        if plugin_object == nil then
     79          cdl_error( "P9999 '$1': MultiPlugin not support '$2'", plugin_name, superClass.name )
     80        end
     81        @@loaded_plugin_list[ plugin_name.to_sym ] = :MultiPlugin
     82        return plugin_object
     83      else
    7484        cdl_error( "P2002 $1: not kind of $2" ,  plugin_name, superClass.name )
    75         return false
     85        return nil
    7686      end
    7787    rescue Exception => evar
     
    8191      end
    8292      cdl_error( "P2003 $1: load failed" , plugin_name )
    83       return false
     93      return nil
    8494    end
    85     return true
     95    # ここへは来ない
     96    return nil
    8697  end
    8798
     
    92103    end
    93104    plugin_name = plugin_object.class.name.to_sym
    94     if @@loaded_plugin_list[ plugin_name ] == nil
    95       raise "#{plugin_name} might have different name "
    96       # プラグインのファイル名と、プラグインのクラス名が相違する場合
     105    if @@loaded_plugin_list[ plugin_name ] == :MultiPlugin then
     106      p "#{plugin_name}: MultiPlugin"
     107      return
     108    elsif @@loaded_plugin_list[ plugin_name ] == nil then
     109      #raise "#{plugin_name} might have different name "
     110      ## プラグインのファイル名と、プラグインのクラス名が相違する場合
     111      #MultiPlugin の get_plugin で返されたケースでは nil になっている
     112      @@loaded_plugin_list[ plugin_name ] = 0
    97113    end
    98114    count = @@loaded_plugin_list[ plugin_name ]
     
    131147    dbgPrint "PluginModule #{@@loaded_plugin_list}\n"
    132148    @@loaded_plugin_list.each{ |plugin_name,count|
     149      if count == :MultiPlugin then
     150        next
     151      end
    133152      dbgPrint "PluginModule: #{plugin_name}\n"
    134153      eval_str = "#{plugin_name}.gen_post_code( file )"
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/syntaxobj.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2016 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    8686
    8787  #=== 情報を表示する
    88   def cdl_info( message )
    89     Console.puts "info: #{message}"
     88  def cdl_info( message, *arg )
     89    Generator.info2( @locale, message, *arg )
     90  end
     91
     92  #=== 情報を表示する
     93  def cdl_info2( locale, message, *arg )
     94    Generator.info2( locale, message, *arg )
    9095  end
    9196
     
    680685  end
    681686
     687  #=== Decl# print_flowinfo
     688  def print_flowinfo file
     689    if @kind == :VAR then
     690      file.write "#{@identifier} "
     691    end
     692  end
     693
    682694  def show_tree( indent )
    683695    indent.times { print "  " }
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/tecsgen.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    4141class TECSGEN
    4242
     43  @@b_post_coded = false     # ポストコード生成開始後 true
     44
    4345  #=== import パス (-I) を末尾に追加
    4446  # 既に登録済みであれば、追加しない
     
    216218  end
    217219
     220  def self.get_argv
     221    ARGV
     222  end
     223
    218224  #------ TECSGEN CDL analyze and generate ------#
    219225
     
    236242  end # syntax_analisys
    237243
     244  #=== TECSGEN#semantics_analisys_1
     245  # semantics check. only cells here
     246  # other objects (signature, celltype, typedef, etc ) are checked while syntax analisys
    238247  def semantics_analisys_1
    239248    ####  意味解析1 (post コードを除く) ####
    240249    dbgPrint( "## Creating reverse join \n")
    241250    Cell.create_reverse_join
     251
     252    DescriptorType.check_signature
     253    Signature.set_descriptor_list
     254    Celltype.check_dynamic_join
    242255
    243256    #0 set_definition_join は2回呼び出される(1回目)
     
    248261
    249262    ####  post コードの生成と構文解析 ####
     263    @@b_post_coded = true     # ポストコード生成開始後 true
    250264    # 引数がなければ、プラグインのポストコードを出力しない
    251265    if ARGV.length > 0 then
     
    283297    dbgPrint( "## Checking all join (for cells generated by Post Code\n")
    284298    @root_namespace.set_definition_join
     299    @root_namespace.set_max_entry_port_inner_cell
    285300
    286301    dbgPrint( "## Set require join\n")
     
    438453    open( "#{$gen_base}/tecsgen.timestamp", "w" ){|io|}
    439454  end # finalize
     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 
     520  def self.post_coded?
     521    @@b_post_coded
     522  end
    440523end # class TECSGEN
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/core/types.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55#
    6 #   Copyright (C) 2008-2015 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#-- 
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    629629
    630630class FloatType < Type
    631 #  @bit_size::         32, 64, (80), -32, -64
     631#  @bit_size::         32, 64, (80), -32, -64, -128
    632632
    633633  def initialize( bit_size )
     
    684684    when -64
    685685      str = "#{str}double"
     686    when -128
     687      str = "#{str}long double"
    686688    end
    687689    return str
     
    734736#  @b_has_sized_pointer_member:: bool : メンバにポインタ型がある
    735737#  @b_has_unsized_string_member:: bool : メンバにポインタ型がある
     738#  @b_hasTag:: bool : タグがある
    736739#  @member_types_symbol:: Symbol : tag が無い時のみ設定 (それ以外では nil)
    737740
     
    746749    super()
    747750    @tag = tag
     751    if tag then
     752      @b_hasTag = true
     753    else
     754      @b_hasTag = false
     755    end
    748756    @@structtype_current_sp += 1
    749757    @@structtype_current_stack[@@structtype_current_sp] = self
     
    918926    str = super
    919927
    920     if @tag then
     928    if @b_hasTag then
    921929      # typedef struct tag StructType; の形式の場合
    922930      # struct の本体は、別に生成される
    923       return "#{str}struct #{@tag} "
     931      return "#{str}struct #{@tag}"
    924932
    925933    else
    926934      # typedef struct { int a; } StructType; の形式の場合
    927       str += "struct {\n"
     935      str += "struct {"
    928936      @members_decl.get_items.each{ |i|
    929         str += sprintf( "    %-8s %s%s;\n", "#{i.get_type.get_type_str}", "#{i.get_name}", "#{i.get_type.get_type_str_post}" )
     937        str += sprintf( "%s %s%s;", "#{i.get_type.get_type_str}", "#{i.get_name}", "#{i.get_type.get_type_str_post}" )
    930938      }
    931939      str += "} "
     
    12671275  def check_init( locale, ident, initializer, kind, attribute = nil )
    12681276    if ( initializer.instance_of?( Array ) ) then
     1277      # 要素数が指定されている場合、初期化要素数をチェック
     1278      if @subscript then
     1279        n_sub = @subscript.eval_const( nil )
     1280        if n_sub then
     1281          if initializer.length > n_sub then
     1282            cdl_error2( locale, "T9999 $1: too many initializer, $2 for $3" , ident, initializer.length, n_sub )
     1283          end
     1284        end
     1285      end
    12691286      index = 0
    12701287      initializer.each{ |i|
     
    15431560# 動的結合で渡すデスクリプタ型
    15441561class DescriptorType < Type
    1545 # @sinagure_nsp::NamespacePath
     1562  # @sinagure_nsp::NamespacePath
     1563
     1564  @@descriptors = {}
    15461565
    15471566  def initialize( signature_nsp )
    15481567    @signature_nsp = signature_nsp
    1549     obj = Namespace.find signature_nsp
    1550     if ! obj.kind_of? Signature then
    1551       cdl_error( "T9999 '$1': not signature or not found", signature_nsp.to_s )
    1552     else
    1553       if obj.has_descriptor? then
    1554         cdl_error( "T9999 '$1': has Desicrptor in function parameter", signature_nsp.to_s )
    1555       end
    1556     end
     1568    # check_signature ##
     1569    @@descriptors[ self ] = false
    15571570  end
    15581571
    15591572  def get_type_str
    1560     "Descriptor( #{@signature_nsp.to_s} )"
     1573    "Descriptor( #{@signature_nsp.get_global_name} )"
    15611574  end
    15621575
     
    15811594  end
    15821595
     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
     1615    end
     1616  end
     1617
    15831618  #== DescriptorType#
    1584   # 意味解析段階では nil が返される可能性に注意
    15851619  def get_signature
    15861620    Namespace.find @signature_nsp
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/messages/messages_console_en_US.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    11681168@@warning_message[ :"W6004" ] = "need 'void' for no parameter"
    11691169
     1170###
     1171# info メッセージ
     1172@@info_message = {}
     1173
    11701174end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/messages/messages_console_ja_JP.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    11681168@@warning_message[ :"W6004" ] = "パラメータが存在しない場合 'void' が必要です"
    11691169
     1170###
     1171# info メッセージ
     1172@@info_message = {}
     1173
    11701174end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/messages/messages_file_en_US.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    7676#  * このファイルを編集して使用することが意図されていますが
    7777#  * tecsgen の再実行により上書きされてしまうため、通常
    78 #  *   gen/%s_template.c => src/%s.c
     78#  *   gen/%s_templ.c => src/%s.c
    7979#  * のように名前, フォルダを変更してから修正します
    8080#  */
     
    8383 * This file was automatically generated by tecsgen.
    8484 * Move and rename like below before editing,
    85  *   gen/%s_template.c => src/%s.c
     85 *   gen/%s_templ.c => src/%s.c
    8686 * to avoid to be overwritten by tecsgen.
    8787 */
     
    227227@@comment[ :EPM_comment ] = "\n/* entry port function macro (abbrev) %s */\n"
    228228
     229# @@comment[ :CRD_comment ] = "\n/* ディスクリプタ参照関数 %s */\n"
     230@@comment[ :CRD_comment ] = "/* refer to descriptor function %s */\n"
     231
     232# @@comment[ :CRDA_comment ] = "\n/* ディスクリプタ参照マクロ(短縮形) %s */\n"
     233@@comment[ :CRDA_comment ] = "\n/* refer to descriptor macro (abbrev) %s */\n"
     234
     235# @@comment[ :SDF_comment ] = "/* ディスクリプタ設定関数 %s */\n"
     236@@comment[ :SDF_comment ] = "/* set descriptor function %s */\n"
     237
     238# @@comment[ :SDMA_comment ] = "\n/* ディスクリプタ設定マクロ(短縮形) %s */\n"
     239@@comment[ :SDMA_comment ] = "\n/* set descriptor macro (abbrev) %s */\n"
     240
    229241# @@comment[ :CTIX_comment ] = "\n/* セルタイプのIDX型 %s */\n"
    230242@@comment[ :CTIX_comment ] = "\n/* celltype IDX type %s */\n"
     
    323335@@comment[ :TEFB_comment ] = "\t/* Put statements here %s */\n"
    324336
     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"
    325342end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/messages/messages_file_ja_JP.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    6565 * このファイルを編集して使用することが意図されていますが
    6666 * tecsgen の再実行により上書きされてしまうため、通常
    67  *   gen/%s_template.c => src/%s.c
     67 *   gen/%s_templ.c => src/%s.c
    6868 * のように名前, フォルダを変更してから修正します
    6969 */
     
    127127@@comment[ :CPMA_comment ] = "/* 呼び口関数マクロ(短縮形)%s */\n"
    128128@@comment[ :EPM_comment ] = "\n/* 受け口関数マクロ(短縮形) %s */\n"
     129@@comment[ :CRD_comment ] = "/* ディスクリプタ参照関数 %s */\n"
     130@@comment[ :CRDA_comment ] = "\n/* ディスクリプタ参照マクロ(短縮形) %s */\n"
     131@@comment[ :SDF_comment ] = "/* ディスクリプタ設定関数 %s */\n"
     132@@comment[ :SDMA_comment ] = "\n/* ディスクリプタ設定マクロ(短縮形) %s */\n"
    129133@@comment[ :CTIX_comment ] = "\n/* セルタイプのIDX型 %s */\n"
    130134@@comment[ :EPP_comment ] = "\n/* 受け口関数プロトタイプ宣言 %s */\n"
     
    159163@@comment[ :TEPF_comment ] = "/* 受け口関数 %s */\n"
    160164@@comment[ :TEFB_comment ] = "\t/* ここに処理本体を記述します %s */\n"
     165@@comment[ :MCPP_comment ] = "/* CB プロトタイプ宣言 %s */\n"
     166@@comment[ :MCPB_comment ] = "/* CB プロトタイプ宣言 %s */\n"
    161167
    162168end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/DomainPlugin.rb

    r321 r429  
    4646  #option::String : domain 指定子の第二引数
    4747  def initialize( region, domain_type_name, option )
     48    super()
    4849  end
    4950
     
    7778    return false
    7879  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
    7991end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2AlarmHandlerPlugin.rb

    r321 r429  
    3434#   アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
    3535#   の責任を負わない.
     36#
     37#   $Id: HRP2AlarmHandlerPlugin.rb 2640 2017-06-03 11:27:12Z okuma-top $
    3638
    3739#++
     
    5052    def print_cfg_cre(file, cell, val, tab)
    5153        val[:id] = val[:id].gsub( /(^|[^\$])\$id\$/, "\\1#{@celltype.get_name.to_s}_#{cell.get_name.to_s}" )
    52         # $cbp$の代わり
    53         index = cell.get_id - @celltype.get_id_base
    54         cell_CB_name = "#{@celltype.get_global_name}_CB_tab[#{index}]"
     54        # $cbp$  #983
     55        name_array = @celltype.get_name_array cell
     56        cell_CBP = name_array[8]    # CBP
    5557        # CRE_XXXの生成
    5658        if (cell.get_region.get_region_type != :DOMAIN) || (cell.get_region.get_param != :KERNEL_DOMAIN)
     
    5961        else
    6062            file.print <<EOT
    61 #{tab}CRE_ALM(#{val[:id]}, { #{val[:attribute]}, &#{cell_CB_name}, tAlarmHandler_start });
     63#{tab}CRE_ALM(#{val[:id]}, { #{val[:attribute]}, #{cell_CBP}, tAlarmHandler_start });
    6264EOT
    6365        end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2CyclicHandlerPlugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2012 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
     
    5152    def print_cfg_cre(file, cell, val, tab)
    5253        val[:id] = val[:id].gsub( /(^|[^\$])\$id\$/, "\\1#{@celltype.get_name.to_s}_#{cell.get_name.to_s}" )
    53         # $cbp$の代わり
    54         index = cell.get_id - @celltype.get_id_base
    55         cell_CB_name = "#{@celltype.get_global_name}_CB_tab[#{index}]"
     54        # $cbp$  #983
     55        name_array = @celltype.get_name_array cell
     56        cell_CBP = name_array[8]    # CBP
    5657        # CRE_XXXの生成
    5758        if (cell.get_region.get_region_type != :DOMAIN) || (cell.get_region.get_param != :KERNEL_DOMAIN)
     
    6061        else
    6162            file.print <<EOT
    62 #{tab}CRE_CYC(#{val[:id]}, { #{val[:attribute]}, &#{cell_CB_name}, tCyclicHandler_start, #{val[:cyclicTime]}, #{val[:cyclicPhase]} });
     63#{tab}CRE_CYC(#{val[:id]}, { #{val[:attribute]}, #{cell_CBP}, tCyclicHandler_start, #{val[:cyclicTime]}, #{val[:cyclicPhase]} });
    6364EOT
    6465        end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2DataqueuePlugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2012 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2EventflagPlugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2012 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2FixedSizeMemoryPoolPlugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2012 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2HandlerPlugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
    3940#require "HRP2KernelObjectPlugin"
    4041require_tecsgen_lib "HRP2KernelObjectPlugin.rb"
    41 
    4242
    4343#== celltype プラグインの共通の親クラス
     
    5151    # tab  :
    5252    def print_cfg_cre(file, cell, val, tab)
    53         val[:id] = val[:id].gsub( /(^|[^\$])\$id\$/, "\\1#{@celltype.get_name.to_s}_#{cell.get_name.to_s}" )
    54         # $cbp$の代わり
    55         index = cell.get_id - @celltype.get_id_base
    56         cell_CB_name = "#{@celltype.get_global_name}_CB_tab[#{index}]"
     53        if !val[:id].nil?
     54            val[:id] = val[:id].gsub( /(^|[^\$])\$id\$/, "\\1#{@celltype.get_name.to_s}_#{cell.get_name.to_s}" )
     55        end
     56        # $cbp$  #983
     57        name_array = @celltype.get_name_array cell
     58        cell_CBP = name_array[8]    # CBP
    5759        # CRE_XXXの生成
    5860        domainOption = cell.get_region.get_domain_root.get_domain_type.get_option
     
    6365        elsif @plugin_arg_str == "ALARM"
    6466            file.print <<EOT
    65 #{tab}CRE_ALM(#{val[:id]}, { #{val[:attribute]}, &#{cell_CB_name}, tAlarmHandler_start });
     67#{tab}CRE_ALM(#{val[:id]}, { #{val[:attribute]}, #{cell_CBP}, tAlarmHandler_start });
    6668EOT
    6769        elsif @plugin_arg_str == "CYCLIC"
    6870            file.print <<EOT
    69 #{tab}CRE_CYC(#{val[:id]}, { #{val[:attribute]}, &#{cell_CB_name}, tCyclicHandler_start, #{val[:cyclicTime]}, #{val[:cyclicPhase]} });
     71#{tab}CRE_CYC(#{val[:id]}, { #{val[:attribute]}, #{cell_CBP}, tCyclicHandler_start, #{val[:cyclicTime]}, #{val[:cyclicPhase]} });
     72EOT
     73        elsif @plugin_arg_str == "CONFIG_INT"
     74            file.print <<EOT
     75#{tab}CFG_INT( #{val[:interruptNumber]}, { #{val[:attribute]}, #{val[:interruptPriority]} });
     76EOT
     77        elsif @plugin_arg_str == "ISR"
     78            file.print <<EOT
     79#{tab}ATT_ISR({ #{val[:attribute]}, #{cell_CBP}, #{val[:interruptNumber]}, tISR_start, #{val[:priority]} });
     80EOT
     81        elsif @plugin_arg_str == "INIT_ROUTINE"
     82            file.print <<EOT
     83#{tab}ATT_INI({ #{val[:attribute]}, #{cell_CBP}, tInitializeRoutine_start });
     84EOT
     85        elsif @plugin_arg_str == "TERM_ROUTINE"
     86            file.print <<EOT
     87#{tab}ATT_TER({ #{val[:attribute]}, #{cell_CBP}, tTerminateRoutine_start });
    7088EOT
    7189        else
     
    7997        elsif @plugin_arg_str == "CYCLIC"
    8098            file.puts "SAC_CYC(#{val[:id]}, { #{acv[0]}, #{acv[1]}, #{acv[2]}, #{acv[3]} });"
     99        elsif @plugin_arg_str == "CONFIG_INT"
     100            # nothing to do
     101        elsif @plugin_arg_str == "ISR"
     102            # nothing to do
     103        elsif @plugin_arg_str == "INIT_ROUTINE"
     104            # nothing to do
     105        elsif @plugin_arg_str == "TERM_ROUTINE"
     106            # nothing to do
    81107        else
    82108            raise "#{@plugin_arg_str} is unknown option"
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2KernelObjectPlugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2012 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
     
    185186                val = {}
    186187                @celltype.get_attribute_list.each{ |a|
    187                     p a.get_name
     188                    # p a.get_name
    188189                    if a.get_type.kind_of?( ArrayType )
    189190                        val[a.get_name] = []
     
    217218                if val[:id].nil? != true
    218219                    puts val[:id]
    219                     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 ) )
    220222                end
    221223                # $cbp$の代わり
     
    243245                        file2.puts "}\n"
    244246                    else
    245                         print "~~~~~ #{cell.get_region.get_name.to_s} is included in"
    246                         p @@region_list
     247                        dbgPrint "~~~~~ #{cell.get_region.get_name.to_s} is included in"
     248                        # p @@region_list
    247249                    end
    248250                    file3 = AppFile.open( "#{$gen}/tecsgen_#{cell_domain_root.get_name.to_s}.cfg" )
     
    257259                puts "===== end check my domain #{cell.get_name} ====="
    258260                # SAC_XXXの生成
    259                 puts "===== begin check regions #{cell.get_name} ====="
    260                 p val[:accessPattern]
    261                 p val[:accessPattern].class
    262 
    263                 #ep = [ :eTaskActivate, :eTaskControl, :eTaskManage, :eTaskRefer ]
    264                 #各カーネルオブジェクトの受け口名を取得
    265                 # ep = get_entry_ports_name_list()
    266                 i = 0
    267                 acv = []
    268                 # アクセス許可ベクタの生成
    269                 val[:accessPattern].each { |acptnx|
    270                     # アクセス許可パターンの生成
    271                     if acptnx != "OMIT"
    272                         acv << acptnx
    273                         p acv[i]
    274                     elsif cell_domain_type.get_option.to_s == "trusted"
    275                         acv << "TACP_KERNEL"
    276                         p acv[i]
    277                     elsif cell_domain_type.get_option.to_s != "OutOfDomain"
    278                         acv << "TACP(#{cell_domain_root.get_name.to_s})"
     261                if !val[:accessPattern].nil?
     262                    puts "===== begin check regions #{cell.get_name} ====="
     263                    # p val[:accessPattern]
     264                    # p val[:accessPattern].class
     265
     266                    #ep = [ :eTaskActivate, :eTaskControl, :eTaskManage, :eTaskRefer ]
     267                    #各カーネルオブジェクトの受け口名を取得
     268                    # ep = get_entry_ports_name_list()
     269                    i = 0
     270                    acv = []
     271                    # アクセス許可ベクタの生成
     272                    val[:accessPattern].each { |acptnx|
     273                        # アクセス許可パターンの生成
     274                        if acptnx != "OMIT"
     275                            acv << acptnx
     276                            # p acv[i]
     277                        elsif cell_domain_type.get_option.to_s == "trusted"
     278                            acv << "TACP_KERNEL"
     279                            # p acv[i]
     280                        elsif cell_domain_type.get_option.to_s != "OutOfDomain"
     281                            acv << "TACP(#{cell_domain_root.get_name.to_s})"
     282                        else
     283                            acv << "TACP_SHARED"
     284                        end
     285
     286                        i += 1
     287                    }
     288
     289                    dbgPrint "acv = "
     290                    p acv
     291
     292                    #各種SACの生成
     293                    domainOption = cell_domain_type.get_option
     294                    # if cell.get_region.get_region_type == :DOMAIN
     295                    if domainOption != "OutOfDomain"
     296                        # 保護ドメインに属する場合
     297                        file3 = AppFile.open( "#{$gen}/tecsgen_#{cell.get_region.get_name.to_s}.cfg" )
     298                        print_cfg_sac(file3, val, acv)
     299                        file3.close
    279300                    else
    280                         acv << "TACP_SHARED"
     301                        # 無所属の場合
     302                        print_cfg_sac(file2, val, acv)
    281303                    end
    282304
    283                     i += 1
    284                 }
    285 
    286                 print "acv = "
    287                 p acv
    288 
    289                 #各種SACの生成
    290                 domainOption = cell_domain_type.get_option
    291                 # if cell.get_region.get_region_type == :DOMAIN
    292                 if domainOption != "OutOfDomain"
    293                     # 保護ドメインに属する場合
    294                     file3 = AppFile.open( "#{$gen}/tecsgen_#{cell.get_region.get_name.to_s}.cfg" )
    295                     print_cfg_sac(file3, val, acv)
    296                     file3.close
    297                 else
    298                     # 無所属の場合
    299                     print_cfg_sac(file2, val, acv)
     305                    puts "===== end check regions #{cell.get_name} ====="
    300306                end
    301 
    302                 puts "===== end check regions #{cell.get_name} ====="
    303307            end
    304308        }
     
    319323
    320324    def self.check_referenced_cells()
    321         puts "===== begin check registered celltype ====="
     325        dbgPrint "===== begin check registered celltype =====\n"
    322326        self.get_celltype_list.each { |ct|
    323             p ct.get_name.to_s
     327            dbgPrint( ct.get_name.to_s + "\n" )
    324328        }
    325         puts "===== end check registered celltype ====="
     329        dbgPrint "===== end check registered celltype =====\n"
    326330
    327331=begin
     
    331335                j = cell.get_join_list.get_item(p.get_name)
    332336                printf "===== check call port : "
    333                 p p.get_name.to_s
     337                # p p.get_name.to_s
    334338                next if j.nil? # 未結合の場合
    335339                if @@celltype_list.include?(j.get_celltype)
     
    338342                    j.get_cell.set_referenced_cell(cell, j.get_port_name)
    339343                    printf "===== check joined rhs cell : "
    340                     p j.get_cell.get_name.to_s
     344                    # p j.get_cell.get_name.to_s
    341345                    printf "===== check joined rhs port_name : "
    342                     p j.get_port_name
     346                    # p j.get_port_name
    343347                end
    344348            }
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2ObjectPlugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2Plugin.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2014 by TOPPERS Project
     6#   Copyright (C) 2018 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
     
    4344
    4445  def initialize( region, name, option )
    45     print "MyDomainPlugin: initialize: region=#{region.get_name}, domainName=#{name}, option=#{option}\n"
     46    super
     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
    4659  end
    4760
     
    5467    # get_rhs_subscript:Integer or nil 受け口配列の添数 (Join::@rhs_subscript の説明参照)
    5568    # return []
    56     print "MyDomainPlugin: add_through_plugin: #{current_region.get_name}=>#{next_region.get_name}, #{join.get_owner.get_name}.#{join.get_definition.get_name}=>#{join.get_cell.get_name}.#{join.get_port_name}, #{through_type}\n"
     69    print "HRP2Plugin: add_through_plugin: #{current_region.get_name}=>#{next_region.get_name}, #{join.get_owner.get_name}.#{join.get_definition.get_name}=>#{join.get_cell.get_name}.#{join.get_port_name}, #{through_type}\n"
    5770
    5871    puts "=====Join Check Start====="
     
    107120  end
    108121
     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
    109135  def joinable?(current_region, next_region, through_type )
    110     print "MyDomainPlugin: joinable? from #{current_region.get_name} to #{next_region.get_name} (#{through_type})\n"
     136    print "HRP2Plugin: joinable? from #{current_region.get_name} to #{next_region.get_name} (#{through_type})\n"
    111137    return true
    112138  end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2PostHook.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2012 by TOPPERS Project
     6#   Copyright (C) 2017 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2RPCPlugin.rb

    r321 r429  
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
     
    7071  #=== RPCPlugin の initialize
    7172  #  説明は 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 )
    7374    super
    7475    @b_noClientSemaphore = false
     
    234235    if cell.get_allocator_list.length > 0 then
    235236
    236       dbgPrint "make allocator"
     237      dbgPrint "make allocator\n"
    237238      file.print "#{indent_str}[allocator("
    238239
     
    269270    nest = @end_region.gen_region_str_pre file
    270271    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
    271278
    272279    file.print <<EOT
    273280#{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};
    275282//#{indent_str}    #{@call_port_name} = #{@next_cell.get_name}.#{@next_cell_port_name};
    276283#{indent_str}  //cTDR         = #{@channelCellName}.eTDR;
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2SVCPlugin.rb

    r321 r429  
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
     
    8384  @@generated_celltype_header = {}
    8485
    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 )
    8687    super
    8788    @ct_name_body = "#{@ct_name}SVCBody_#{@next_cell.get_name}_#{@next_cell_port_name}".to_sym
     
    217218    nest = @end_region.gen_region_str_pre file
    218219    nest_str = "  " * nest
     220    if @next_cell_port_subscript then
     221      subscript = '[' + @next_cell_port_subscript.to_s + ']'
     222    else
     223      subscript = ""
     224    end
    219225
    220226    # サーバー側チャンネルの生成
     
    224230#{nest_str}  //  Server Side Channel
    225231#{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};
    227233#{nest_str}  };
    228234EOT
     
    241247    nest = @start_region.gen_region_str_pre file
    242248    nest_str = "  " * nest
     249    if @next_cell_port_subscript then
     250      subscript = '[' + @next_cell_port_subscript.to_s + ']'
     251    else
     252      subscript = ""
     253    end
    243254
    244255    # クライアント側チャンネルの生成
     
    247258#{nest_str}  //  Client Side Channel
    248259#{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};
    250261#{nest_str}  };
    251262
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2TaskPlugin.rb

    r321 r429  
    3535#   の責任を負わない.
    3636
     37#   $Id$
    3738#++
    3839
     
    5253    # tab  :
    5354    def print_cfg_cre(file, cell, val, tab)
    54         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 ) )
    5557        # $cbp$の代わり
    5658        index = cell.get_id - @celltype.get_id_base
     
    5860        cell_CB_name = "#{index}"
    5961        # CRE_XXX/DEF_XXXの生成
    60         print "assign task plugin\n"
     62        dbgPrint "assign task plugin\n"
    6163        domainOption = cell.get_region.get_domain_root.get_domain_type.get_option
    6264        # if cell.get_region.get_region_type == :DOMAIN
     65# cell.show_tree 1
    6366        if domainOption != "OutOfDomain"
    6467            # 保護ドメインに属する場合
     
    6871                    raise "system task cannot have user stack."
    6972                end
     73p "CRE_TSK 0 user=#{val[:userStackSize]} system=#{val[:systemStackSize]}"
    7074                file.print <<EOT
    7175#{tab}CRE_TSK(#{val[:id]}, { #{val[:taskAttribute]}, #{cell_CB_name}, tTask_start_task, #{val[:priority]}, #{val[:systemStackSize]}, NULL });
     
    7680                    raise "user task must have user stack."
    7781                end
     82p "CRE_TSK 1"
    7883                if val[:systemStackSize] == "OMIT"
    7984                    file.print <<EOT
     
    8186EOT
    8287                else
     88p "CRE_TSK 2"
    8389                    file.print <<EOT
    8490#{tab}CRE_TSK(#{val[:id]}, { #{val[:taskAttribute]}, #{cell_CB_name}, tTask_start_task, #{val[:priority]}, #{val[:userStackSize]}, NULL, #{val[:systemStackSize]}, NULL });
     
    121127                ct = cell.get_celltype
    122128                if ct.class == Celltype && check_celltype_list.include?( ct ) == false
     129                    # チェック済みセルタイプに登録
     130                    check_celltype_list << ct
     131
    123132                    # 未チェックのセルタイプだった場合
    124133                    # puts "check for ATT_MOD : #{ct.classget_global_name}"
     
    134143                    regions = ct.get_domain_roots
    135144                    regions_hrp2 = regions[ :HRP2 ]
    136                     print "HRP2 domain in #{ct.get_name}: "
     145                    dbgPrint "HRP2 domain in #{ct.get_name}: "
    137146                    regions_hrp2.each { |reg|
    138                         print reg.get_name
     147                        dbgPrint reg.get_name
    139148                    }
    140149                    puts ""
     
    179188                    file.print "ATT_MOD(\"#{ct.get_global_name}.o\");\n"
    180189                    file.close
    181 
    182                     check_celltype_list << ct
    183190                else
    184191                    # 何もしない
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/MrubyBridgePlugin.rb

    r321 r429  
    33#  mruby => TECS bridge
    44
    5 #   Copyright (C) 2008-2015 by TOPPERS Project
     5#   Copyright (C) 2008-2017 by TOPPERS Project
    66#
    77#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3737#
    3838
    39 # Todo:
    40 # 生成するもの
    41 #  gen_cdl_file
    42 #    ブリッジ初期化セルタイプ (シグニチャごと)
    43 #       @@init_celltypes に記録
    44 #    ブリッジセルタイプ (シグニチャごと)
    45 #       @@celltypes に記録
    46 #    構造体セルタイプ
    47 #       @@struct_list に記録
    48 #  new_cell
    49 #    TECS 初期化セル(プロトタイプ宣言)
    50 #       @@VM_init_cells に記録
    51 #       @@VM_struct_list に記録
    52 #       @@VM_ptr_list に記録
    53 #  gen_post_code
    54 #    構造体初期化セル
    55 #    ポインタ初期化セル
    56 #    TECS 初期化セル
    57 #
    58 #   ep_func の作成
    59 #     signature, ポインタ、構造体 … 初期化受け口=mruby VM への登録
    60 #     ポインタ
    61 #   preamble の作成
    62 #     ポインタ、構造体 … アクセス用コードの生成
    63 #     signature … ブリッジ関数のプロトタイプ宣言
    64 #   postamble の作成
    65 #     signature … ブリッジ関数の定義
    66 
    67 class MrubyBridgePlugin < SignaturePlugin
    68 
    69   # プラグイン引数名 => Proc
    70   MrubyBridgePluginArgProc = {
    71       "ignoreUnsigned" => Proc.new { |obj,rhs| obj.set_ignoreUnsigned rhs },
    72       "include" => Proc.new { |obj,rhs| obj.set_include rhs },
    73       "exclude" => Proc.new { |obj,rhs| obj.set_exclude rhs },
    74   }
    75 
    76   @@celltypes = { }             # {celltype_name => [ BridgePlugin のインスタンスの配列 }
    77   @@init_celltypes = { }        # {celltype_name => [ BridgePlugin のインスタンスの配列 }
    78   @@struct_list = { }           # {struct_name=>StructType}
    79   @@ptr_list = { }              # {ptr_celltype_name=> @@TYPE_MAP の対応するもの}
    80   @@VM_list = { }               # VM_name => true
    81   @@VM_celltypes = {  }             # VM_name => { @celltype_name => セルの配列 }
    82   @@VM_struct_list = { }           # {name=>StructType}
    83   @@VM_ptr_list = { }              # { VM_name => {name=> @@TYPE_MAP の対応するもの} }
    84   @@TYPE_MAP = {           # type_str   class             GET_SET
    85     :char_t            => [:char_t,    "Char",     :Char,  :INT   ],
    86     :uchar_t           => [:uchar_t,   "UChar",    :Char,  :INT   ],
    87     :schar_t           => [:schar_t,   "SChar",    :Char,  :INT   ],
    88 
    89     :bool_t            => [:bool_t,    "Bool",     :Bool,  :BOOL  ],
    90     :int8_t            => [:int8_t,    "Int8",     :Int,   :INT   ],
    91     :int16_t           => [:int16_t,   "Int16",    :Int,   :INT   ],
    92     :int32_t           => [:int32_t,   "Int32",    :Int,   :INT   ],
    93     :int64_t           => [:int64_t,   "Int64",    :Int,   :INT   ],
    94     :uint8_t           => [:uint8_t,   "UInt8",    :Int,   :INT   ],
    95     :uint16_t          => [:uint16_t,  "UInt16",   :Int,   :INT   ],
    96     :uint32_t          => [:uint32_t,  "UInt32",   :Int,   :INT   ],
    97     :uint64_t          => [:uint64_t,  "UInt64",   :Int,   :INT   ],
    98 
    99     :int               => [:int,       "Int",      :Int,  :INT   ],
    100     :char              => [:char,      "Char",     :Char, :INT   ],    # char は char_t として扱う
    101     :short             => [:short,     "Short",    :Int,  :INT   ],
    102     :long              => [:long,      "Long",     :Int,  :INT   ],
    103 
    104     :"unsigned char"   => [:uchar_t,   "UChar",         :Char, :INT   ],
    105     :"unsigned int"    => [:"unsigned int",   "UInt",   :Int,  :INT   ],
    106     :"unsigned short"  => [:"unsigned short", "UShort", :Int,  :INT   ],
    107     :"unsigned long"   => [:"unsigned long",  "ULong",  :Int,  :INT   ],
    108     :"signed char"     => [:schar_t,   "SChar",    :Char,  :INT   ],
    109     :"signed int"      => [:int,       "Int",      :Int,   :INT   ],
    110     :"signed short"    => [:short,     "Short",    :Int,   :INT   ],
    111     :"signed long"     => [:long,      "Long",     :Int,   :INT   ],
    112 
    113     :float32_t         => [:float32_t, "Float32",  :Float, :FLOAT ],
    114     :double64_t        => [:double64_t,"Double64", :Float, :FLOAT ],
    115 
    116     :float             => [:float,     "Float32",  :Float, :FLOAT ],
    117     :double            => [:double,    "Double64", :Float, :FLOAT ]
    118   }
    119 
    120   # included  or excluded functions
    121 
    122   ### ロードされた時点で実行される ###
    123 
    124   # -I に $(TECSPATH)/mruby を追加
    125   # TECSGEN::Makefile.add_obj "$(MRUBY_MAIN_OBJ)"
    126   TECSGEN::Makefile.add_ldflag "-lmruby -L$(MRUBYPATH)/lib -lm"
    127   TECSGEN::Makefile.add_search_path "$(MRUBYPATH)/include"
    128   TECSGEN::Makefile.add_var "MRUBYPATH",      "..",  "CHANGE this to suitable path"
    129   # TECSGEN::Makefile.add_var "MRUBY_MAIN_OBJ", "$(_TECS_OBJ_DIR)tecs_mruby.o", "CHANGE this if your have your main"
    130 
    131 
    132   #=== プラグインインスタンスの初期化
    133   # 戻り値、引数の型が使用可能なものかチェックする
    134   #
    135   def initialize( signature, option )
    136     super
    137 
    138     if ! $no_banner
    139       STDERR << "MrubyBridgePlugin: version 1.2.0 (Suitable for mruby ver 1.2.0. Has backward compatibility with ver 1.1.0)\n"
    140     end
    141 
    142     @b_ignoreUnsigned = false
    143     @includes = []
    144     @excludes = []
    145     @struct_list = { }
    146     @ptr_list = { }
    147 
    148     @plugin_arg_check_proc_tab = MrubyBridgePluginArgProc
    149     parse_plugin_arg
    150 
    151     @celltype_name = :"t#{@signature.get_global_name}"
    152     @init_celltype_name = :"#{@celltype_name}_Initializer"
    153         # this variable is sometimes not used. rhs coded directry.
    154     @class_name = :"T#{@signature.get_global_name}"
    155 
    156     @func_head_array = []
    157     if @includes.length > 0 && @excludes.length > 0 then
    158       cdl_error( "MRB1011 both include && exclude are specified" )
    159     end
    160 
    161     if signature.get_function_head_array == nil then
    162       return   # 以前に文法エラー発生
    163     end
    164 
    165     signature.get_function_head_array.each{ |func_head|
    166       if @includes.length > 0 then
    167         if @includes.index func_head.get_name then
    168           dbgPrint "MrubyBridgePlugin: #{func_head.get_name} INCLUDED\n"
    169           @func_head_array << func_head
    170         else
    171           dbgPrint "MrubyBridgePlugin: #{func_head.get_name} NOT included\n"
    172         end
    173       elsif @excludes.length > 0 then
    174         if @excludes.index( func_head.get_name ) == nil then
    175           dbgPrint "MrubyBridgePlugin: #{func_head.get_name} NOT excluded\n"
    176           @func_head_array << func_head
    177         else
    178           dbgPrint "MrubyBridgePlugin: #{func_head.get_name} EXCLUDED\n"
    179         end
    180       else
    181         @func_head_array << func_head
    182       end
    183     }
    184 
    185     if @func_head_array.length == 0 then
    186       cdl_error( "MRB1012 '$1' no function remained by exclude", @signature.get_name )
    187     end
    188 
    189     check_name_and_return_type @func_head_array
    190     check_parameter_type @func_head_array
    191 
    192   end
    193 
    194   #=== check function name & return type
    195   def check_name_and_return_type func_head_array
    196     b_init = false; b_init_cell = false
    197     func_head_array.each{ |func_head|
    198       if( func_head.get_name == :initialize )then
    199         cdl_warning( "MRW2001 initialize: internally defined. change to initialize_cell in ruby" )
    200         b_init = true
    201       elsif( func_head.get_name == :initialize_cell )then
    202         b_init_cell = true
    203       end
    204       rtype = func_head.get_return_type.get_original_type
    205       case rtype
    206       when BoolType, IntType, FloatType, VoidType
    207       else
    208         cdl_error( "MRB1001 cannot return type $1", rtype.get_type_str )
    209       end
    210     }
    211     if( b_init && b_init_cell )then
    212       cdl_warning( "MRB1002 initialize: internally defined. change to initialize_cell in ruby" )
     39#== MrubyBridgePlugin クラス
     40class MrubyBridgePlugin < MultiPlugin
     41  def self.get_plugin superClass
     42    # case when (つまりは ===) では、期待したように一致しない模様
     43    if superClass == SignaturePlugin then
     44      dbgPrint "MrubyBridgePlugin: SignaturePlugin"
     45      require_tecsgen_lib 'tecslib/plugin/MrubyBridgeSignaturePlugin.rb'
     46      return MrubyBridgeSignaturePlugin
     47    elsif superClass == CelltypePlugin
     48      dbgPrint "MrubyBridgePlugin: CelltypePlugin"
     49      require_tecsgen_lib 'tecslib/plugin/MrubyBridgeCelltypePlugin.rb'
     50      return MrubyBridgeCelltypePlugin
     51    elsif superClass == CompositePlugin
     52      dbgPrint "MrubyBridgePlugin: CompositePlugin"
     53      require_tecsgen_lib 'tecslib/plugin/MrubyBridgeCompositePlugin.rb'
     54      return MrubyBridgeCompositePlugin
     55    elsif superClass == CellPlugin
     56      dbgPrint "MrubyBridgePlugin: CellPlugin"
     57      require_tecsgen_lib 'tecslib/plugin/MrubyBridgeCellPlugin.rb'
     58      return MrubyBridgeCellPlugin
     59    #elsif superClass == ThroughPlugin
     60    #  return ThroughPlugin
     61    #elsif superClass == DomainPlugin
     62    #  return DomainPlugin
     63    else
     64      dbgPrint "MrubyBridgePlugin: unsupported"
     65      return nil
    21366    end
    21467  end
    215 
    216   #=== check paramter type
    217   def check_parameter_type func_head_array
    218     # check type of parameters
    219     func_head_array.each{ |fh|
    220       fh.get_paramlist.get_items.each{ |param_decl|
    221         case param_decl.get_direction
    222         when :SEND, :RECEIVE
    223           cdl_error( "MRB1003 $1: $2 parameter cannot be used in mruby Bridge",  param_decl.get_name, param_decl.get_direction.to_s.downcase )
    224         end
    225         type = param_decl.get_type
    226         type_org = type.get_original_type
    227         type_str = type.get_type_str + type.get_type_str_post
    228 
    229         b_ng = false
    230         case type_org
    231         when IntType
    232           case  type_org.get_bit_size
    233           when 8, 16, 32, 64
    234           when -1, -2, -3, -4, -11
    235           else
    236             b_ng = true
    237           end
    238         when BoolType
    239         when FloatType
    240         when PtrType
    241           ttype_org = type_org.get_type       # ポインタの指している先の型
    242           ttype = ttype_org.get_original_type # 上記の typedef されている場合、元の型
    243           register_ptr_type ttype_org
    244 
    245           if( type_org.get_string.to_s == "-1" ) then
    246             case param_decl.get_direction
    247             when :OUT, :INOUT
    248               cdl_error( "MRB9999 string specifier without length cannot be used for out & inout parameter")
    249             end
    250           end
    251 
    252           case ttype
    253           when IntType
    254             bit_size = ttype.get_bit_size
    255             # if  bit_size < 0 && bit_size != -1 then
    256             #   b_ng = true
    257             # end
    258           when FloatType
    259           when BoolType
    260           when StructType
    261             if( type_org.get_size || type_org.get_string || type_org.get_count ) then
    262               cdl_error( "MRB1004 $1: size_is, count_is, string cannot be specified for struct pointer", param_decl.get_name )
    263             end
    264             check_struct_member ttype_org
    265           else
    266             b_ng = true
    267           end
    268         when StructType
    269           check_struct_member type_org
    270         else  # ArrayType, FuncType, EnumType, VoidType
    271           b_ng = true
    272         end
    273         if b_ng then
    274           cdl_error( "MRB1005 $1: type $2 cannot be used in mruby Bridge", param_decl.get_name, type_str )
    275         end
    276       }
    277     }
    278   end
    279 
    280   #=== 構造体のメンバーの型のチェック
    281   def check_struct_member struct_type
    282     #p "tag name:#{struct_type.get_name}"
    283     # sttype = Namespace.find_tag( struct_type.get_name )
    284     sttype = struct_type.get_original_type
    285     if sttype.get_name == nil then
    286       cdl_error( "MRB10007 tagless-struct cannot be handled")
    287     end
    288     sttype.get_members_decl.get_items.each { |d|
    289       t = d.get_type.get_original_type
    290       case t
    291       when IntType, FloatType, BoolType
    292       else
    293         cdl_error( "MRB1006 $1: type $2 not allowed for struct member", d.get_name, d.get_type.get_type_str + d.get_type.get_type_str_post )
    294       end
    295     }
    296     st_name = :"t{}"
    297     if @struct_list[ sttype.get_name ] == nil then
    298       # print_msg "  MrubyBridgePlugin: [struct]   #{struct_type.get_type_str} => class TECS::Struct#{sttype.get_name}\n"
    299       print "  MrubyBridgePlugin: [struct]   #{struct_type.get_type_str} => class TECS::Struct#{sttype.get_name}\n"
    300       @struct_list[ sttype.get_name ] = sttype
    301     end
    302   end
    303 
    304   def register_ptr_type ttype
    305     t_org = ttype.get_original_type
    306     tment = get_type_map_ent t_org
    307     if tment == nil then
    308       return
    309       cdl_error( "MRB1008 unknown pointer type '$1'", ttype.get_type_str )
    310     end
    311     ptr_celltype_name = :"t#{tment[1]}Pointer"
    312     if @@ptr_list[ ptr_celltype_name ] == nil then
    313       # print_msg "  MrubyBridgePlugin: [pointer]  #{ttype.get_type_str}* => class TECS::#{tment[1]}Pointer\n"
    314       print "  MrubyBridgePlugin: [pointer]  #{ttype.get_type_str}* => class TECS::#{tment[1]}Pointer\n"
    315       @@ptr_list[ ptr_celltype_name ] = tment
    316     end
    317     if @ptr_list[ ptr_celltype_name ] == nil then
    318       @ptr_list[ ptr_celltype_name ] = tment
    319     end
    320   end
    321 
    322   def get_type_map_ent ttype
    323     # structure type is registerd in check_struct_member
    324     if ttype.kind_of? StructType
    325       return
    326     end
    327     tstr = ttype.get_type_str.sub( /const /, "" )    # const は無視
    328     tstr = tstr.sub( /volatile /, "" )               # volatile も無視
    329     if @b_ignoreUnsigned then
    330       tstr = tstr.sub( /unsigned /, "" )             # volatile も無視
    331       tstr = tstr.sub( /uint/, "int" )               # volatile も無視
    332       tstr = tstr.sub( /[cs]char/, "char" )          # volatile も無視
    333     end
    334     return @@TYPE_MAP[ tstr.to_sym ]
    335   end
    336 
    337   #===  CDL ファイルの生成
    338   #      typedef, signature, celltype, cell コードを生成
    339   #file::        FILE       生成するファイル
    340   def gen_cdl_file(file)
    341 
    342     # ブリッジセルタイプの生成
    343     if @@celltypes[ @celltype_name ] == nil then
    344       @@celltypes[ @celltype_name ] = [ self ]
    345       @@init_celltypes[ @init_celltype_name ] = true
    346       print_msg <<EOT
    347   MrubyBridgePlugin: [signature] #{@signature.get_namespace_path} => [celltype] nMruby::#{@celltype_name} => [class] TECS::#{@class_name}
    348 EOT
    349 
    350       file.print <<EOT
    351 import( <mruby.cdl> );
    352 
    353 /****  Ruby => TECS Bridge Celltype (MBP500) ****/
    354 namespace nMruby{
    355     // bridge celltype
    356     [idx_is_id,active]   // not actually active, to avoid warning W1002, W1007
    357     celltype #{@celltype_name} {
    358         call #{@signature.get_namespace_path.to_s} cTECS;
    359         attr {
    360             [omit]
    361             char_t *VMname = "VM";
    362         };
    363     };
    364     // bridge initializer celltype
    365     celltype #{@init_celltype_name} {
    366         entry sInitializeTECSBridge eInitialize;
    367     };
    368 };
    369 EOT
    370 
    371       # 構造体セルタイプの生成
    372       @struct_list.each{ |name, sttype|
    373         if @@struct_list[ name ] == nil then
    374           file.print <<EOT
    375 namespace nMruby{
    376     [singleton]
    377     celltype #{name} {
    378         entry sInitializeTECSBridge eInitialize;
    379     };
    380 };
    381 EOT
    382           @@struct_list[ name ] = sttype
    383         end
    384       }
    385 
    386     else
    387       cdl_warning( "MRBW001 MrubyBridgePlugin: signature '$1' duplicate. ignored current one", @signature.get_namespace_path )
    388       @@celltypes[ @celltype_name ] << self
    389     end
    390   end
    391 
    392   #=== gen_cdl_file で定義したセルタイプに 新しいセルが定義された
    393   # cell のセルタイプの名前は @celltype_name
    394   def new_cell cell
    395     if cell.get_celltype.get_name != @celltype_name then
    396       return
    397     end
    398 
    399     join = cell.get_join_list.get_item :VMname
    400     if join then
    401       vm_name = CDLString.remove_dquote(join.get_rhs.to_s).to_sym
    402     else
    403       vm_name = :"VM"
    404     end
    405 
    406     if @@VM_list[ vm_name ] == nil then
    407       @@VM_list[ vm_name ] = true
    408 
    409       initializer_celltype_cdl = "#{$gen}/#{cell.get_name}Initializer.cdl"
    410       file = CFile.open( initializer_celltype_cdl, "w" )
    411 
    412       # TECS 初期化セル(プロトタイプ宣言)
    413       print_msg "  MrubyBridgePlugin: join your VM's cInitialize to #{vm_name}_TECSInitializer.eInitialize\n"
    414 
    415       file.print <<EOT
    416 
    417   // prototype of TECSInitializer (MBP510)
    418   cell nMruby::tTECSInitializer #{vm_name}_TECSInitializer;
    419 EOT
    420       file.close
    421 
    422       Generator.parse( initializer_celltype_cdl, self )
    423     end
    424 
    425     if @@VM_celltypes[ vm_name ] then
    426       vma = @@VM_celltypes[ vm_name ]
    427 
    428       if vma[ @celltype_name ] then
    429         vma[ @celltype_name ] << cell
    430       else
    431         vma[ @celltype_name ] = [cell]
    432         @@VM_celltypes[ vm_name ] = vma
    433       end
    434     else
    435       vma = { }
    436       vma[ @celltype_name ] = [cell]
    437       @@VM_celltypes[ vm_name ] = vma
    438     end
    439 
    440     @struct_list.each{ |stname, sttype|
    441       if @@VM_struct_list[ vm_name ] then
    442         @@VM_struct_list[ vm_name ][ sttype.get_name ] = sttype
    443       else
    444         @@VM_struct_list[ vm_name ] = { sttype.get_name => sttype }
    445       end
    446     }
    447     @ptr_list.each{ |ptr_celltype_name, tment|
    448       if @@VM_ptr_list[ vm_name ] then
    449         @@VM_ptr_list[ vm_name ][ ptr_celltype_name ] = tment
    450       else
    451         @@VM_ptr_list[ vm_name ] = { ptr_celltype_name => tment }
    452       end
    453     }
    454 
    455   end
    456 
    457   #=== プラグインが CDL の POST コードを生成
    458   # tmp_plugin_post_code.cdl への出力
    459   def self.gen_post_code file
    460 
    461 #     file.print <<EOT
    462 # namespace nMruby {
    463 # EOT
    464 #
    465 #     @@ptr_list.each{ |name,tment|
    466 #       file.print <<EOT
    467 #
    468 #     // MBP600
    469 #     [singleton]
    470 #     celltype #{name} {
    471 #         entry  sInitializeTECSBridge eInitialize;
    472 #     };
    473 # EOT
    474 #     }
    475 #
    476 #     file.print <<EOT
    477 # };
    478 # EOT
    479 
    480 # gen_post_code で生成した celltype は gen_ep_func が呼び出されない #847
    481 #    @@struct_list.each{ |name,sttype|
    482 #      file.print <<EOT
    483 #
    484 #    [singleton]
    485 #    celltype #{name} {
    486 #        entry  sInitializeTECSBridge eInitialize;
    487 #    };
    488 #EOT
    489 #    }
    490 
    491     file.print "  // MBP601\n"
    492     @@VM_celltypes.each{ |vm_name, instance_list|
    493       instance_list.each { |celltype_name, array|
    494         cell = array[0]
    495         if cell.get_celltype then
    496           ct_name = cell.get_celltype.get_name
    497         file.print <<EOT
    498   cell nMruby::#{ct_name}_Initializer #{vm_name}_#{ct_name}_Initializer{ };
    499 EOT
    500         end
    501       }
    502     }
    503 
    504     file.print "  // MBP602\n"
    505     @@ptr_list.each{ |name,tment|
    506       file.print <<EOT
    507   cell nMruby::#{name} C#{name} { };
    508 EOT
    509     }
    510 
    511     file.print "  // MBP603\n"
    512     @@struct_list.each{ |name,sttype|
    513       file.print <<EOT
    514   cell nMruby::#{name} C#{name} { };
    515 EOT
    516     }
    517 
    518     if @@VM_celltypes == nil
    519       raise "are0"
    520     end
    521     @@VM_celltypes.each{ |vm_name, instance_list|
    522       file.print "  /* === VM #{vm_name} === (MBP610) */\n"
    523       init_cell_name = "#{vm_name}_TECSInitializer"
    524 
    525       file.print "  cell nMruby::tTECSInitializer #{init_cell_name} {\n"
    526 
    527       instance_list.each { |celltype_name, array|
    528         array.each{ |cell|
    529           ct_name = cell.get_celltype.get_name
    530           file.print "    cInitialize[] = #{vm_name}_#{ct_name}_Initializer.eInitialize;\n"
    531         }
    532       }
    533       if @@VM_ptr_list[vm_name] then
    534         @@VM_ptr_list[vm_name].each{ |name, tment|
    535           file.print "    cInitialize[] = C#{name}.eInitialize;\n"
    536         }
    537       end
    538       if @@VM_struct_list[vm_name] then
    539         @@VM_struct_list[vm_name].each{ |name, sttype|
    540           file.print "    cInitialize[] = C#{name}.eInitialize;\n"
    541         }
    542       end
    543       file.print "  };"
    544     }
    545    
    546   end
    547 
    548   ####### 以下コード生成段階 ######
    549 
    550   #===  受け口関数の本体コードを生成(頭部と末尾は別途出力)
    551   #ct_name:: Symbol    (プラグインで生成された) セルタイプ名 .Symbol として送られてくる
    552   def gen_ep_func_body( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    553     if @@celltypes[ ct_name ] then
    554       gen_ep_func_body_bridge( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    555     elsif @@init_celltypes[ ct_name ] then
    556       gen_ep_func_body_bridge_init( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    557     elsif @@ptr_list[ ct_name ] then
    558       gen_ep_func_body_ptr( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    559     elsif @@struct_list[ ct_name ] then
    560       gen_ep_func_body_struct( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    561     else
    562       raise "Unknown #{ct_name}"
    563     end
    564   end
    565 
    566   def gen_ep_func_body_bridge( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    567     raise "unexpected "
    568   end
    569 
    570   def gen_ep_func_body_bridge_init( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    571     file.print <<EOT
    572     CELLCB *p_cellcb = GET_CELLCB( idx );  /* no error check */     /* MBP700 */
    573     struct RClass       *rc;
    574 
    575     rc = mrb_define_class_under( mrb, TECS, \"#{@class_name}\", mrb->object_class );
    576     mrb_define_method( mrb, rc, "initialize", MrubyBridge_#{@celltype_name}_initialize, MRB_ARGS_REQ(1) );
    577     MRB_SET_INSTANCE_TT(rc, MRB_TT_DATA);
    578 EOT
    579 
    580     @func_head_array.each{ |f|
    581       if ! f.is_function? then
    582         next
    583       end
    584       if f.get_name != :initialize then
    585         func_name = f.get_name
    586       else
    587         func_name = :initialize_cell
    588       end
    589 
    590       ret_type = f.get_return_type
    591       n_param = 0
    592       f.get_paramlist.get_items.each{ |param|
    593         case param.get_direction
    594         when :IN, :INOUT, :OUT
    595           n_param += 1
    596         when :SEND, :RECEIVE
    597           raise "send, receive"
    598         end
    599       }
    600       if n_param > 0 then
    601         p_str = "MRB_ARGS_REQ( #{n_param} )"
    602       else
    603         p_str = "MRB_ARGS_NONE()"
    604       end
    605       file.print <<EOT
    606         mrb_define_method( mrb, rc, "#{func_name}", MrubyBridge_#{@celltype_name}_#{func_name}, #{p_str} );
    607 EOT
    608     }
    609   end
    610 
    611   def gen_ep_func_body_ptr( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    612    
    613     t = @@ptr_list[ct_name]
    614     type = t[1]
    615     file.print <<EOT
    616         struct RClass *a;                                /* MBP710 */
    617 
    618     a = mrb_define_class_under(mrb, TECS, "#{type}Pointer", mrb->object_class);
    619     MRB_SET_INSTANCE_TT(a, MRB_TT_DATA);
    620 
    621     mrb_define_method(mrb, a, "initialize",      #{type}Pointer_initialize,   MRB_ARGS_REQ(1));
    622     mrb_define_method(mrb, a, "[]",              #{type}Pointer_aget,         MRB_ARGS_REQ(1));
    623     mrb_define_method(mrb, a, "value",           #{type}Pointer_get_val,      MRB_ARGS_NONE());
    624     mrb_define_method(mrb, a, "[]=",             #{type}Pointer_aset,         MRB_ARGS_REQ(2));
    625     mrb_define_method(mrb, a, "value=",          #{type}Pointer_set_val,      MRB_ARGS_REQ(1));
    626     mrb_define_method(mrb, a, "size",            #{type}Pointer_size,         MRB_ARGS_NONE());
    627     mrb_define_method(mrb, a, "length",          #{type}Pointer_size,         MRB_ARGS_NONE());
    628 EOT
    629 
    630     if t[2] == :Char then
    631       file.print <<EOT
    632         mrb_define_method(mrb, a, "to_s",            CharPointer_to_s, MRB_ARGS_NONE());
    633         mrb_define_method(mrb, a, "from_s",          CharPointer_from_s, MRB_ARGS_REQ(1));
    634 EOT
    635     end
    636   end
    637 
    638   def gen_ep_func_body_struct( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )
    639     tag = ct_name
    640     structType = @@struct_list[ tag ]
    641     file.print  <<EOT
    642         struct RClass *a;                                /* MBP720 */
    643 
    644         a = mrb_define_class_under(mrb, TECS, "Struct#{tag}", mrb->object_class);
    645         MRB_SET_INSTANCE_TT(a, MRB_TT_DATA);
    646 
    647         mrb_define_method(mrb, a, "initialize", Struct_#{tag}_initialize, MRB_ARGS_NONE());
    648 EOT
    649 
    650       structType.get_members_decl.get_items.each{ |d|
    651         file.print "  STRUCT_INIT_MEMBER( #{tag}, #{d.get_name} )\n"
    652       }
    653   end
    654 
    655   #===  受け口関数の preamble (C言語)を生成する
    656   #     必要なら preamble 部に出力する
    657   #file::           FILE        出力先ファイル
    658   #b_singleton::    bool        true if singleton
    659   #ct_name::        Symbol
    660   #global_ct_name:: string
    661   def gen_preamble( file, b_singleton, ct_name, global_ct_name )
    662     if @@celltypes[ ct_name ] then
    663       gen_preamble_mruby( file, b_singleton, ct_name, global_ct_name )
    664       gen_preamble_instance( file, b_singleton, ct_name, global_ct_name )
    665       gen_preamble_instance_initialize( file, b_singleton, ct_name, global_ct_name )
    666       gen_preamble_bridge_func( file, b_singleton, ct_name, global_ct_name )
    667     elsif @@init_celltypes[ ct_name ] then
    668       gen_preamble_mruby( file, b_singleton, ct_name, global_ct_name )
    669       gen_preamble_instance_proto( file, b_singleton, ct_name, global_ct_name )
    670     elsif @@ptr_list[ ct_name ] then
    671       gen_preamble_ptr( file, b_singleton, ct_name, global_ct_name )
    672     elsif @@struct_list[ ct_name ] then
    673       gen_preamble_struct( file, b_singleton, ct_name, global_ct_name )
    674     else
    675       raise "Unknown #{ct_name}"
    676     end
    677   end
    678 
    679   def gen_preamble_mruby( file, b_singleton, ct_name, global_ct_name )
    680     file.print <<EOT
    681 /* MBP: MrubyBridgePlugin: MBP000 */
    682 #include "mruby.h"
    683 #include "mruby/class.h"
    684 #include "mruby/data.h"
    685 #include "mruby/string.h"
    686 #include "TECSPointer.h"
    687 #include "TECSStruct.h"
    688 
    689 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
    690 #define DLLEXPORT __declspec(dllexport)
    691 #else
    692 #define DLLEXPORT
    693 #endif
    694 
    695 #ifndef NULL
    696 #define NULL 0
    697 #endif
    698 EOT
    699   end
    700 
    701   def gen_preamble_instance( file, b_singleton, ct_name, global_ct_name )
    702     file.print <<EOT
    703 
    704 /* RData MBP001 */
    705 static void
    706 #{@celltype_name}_free( mrb_state *mrb, void *p )
    707 {
    708         if( p )
    709                 (void)mrb_free( mrb, p );
    710 }
    711 
    712 /* RData MBP002 */
    713 struct mrb_data_type data_type_#{@celltype_name} =
    714 {
    715         "#{@celltype_name}",
    716         #{@celltype_name}_free
    717 };
    718 
    719 /* RData MBP003 */
    720 struct tecs_#{@celltype_name} {
    721     CELLCB  *cbp;
    722 };
    723 
    724 /* name_to_cbp MBP010 */
    725 const struct name_to_cbp_#{@celltype_name} {
    726     char   *name;    /* Cell Name */
    727     CELLCB *cbp;
    728 } Name_to_cbp_#{@celltype_name}[] = {
    729 EOT
    730 
    731     # mikan namespace
    732     nsp = NamespacePath.new( :nMruby, true )
    733     nsp.append! ct_name
    734     ct = Namespace.find nsp
    735 
    736     ct.get_cell_list.each{ |cell|
    737       if cell.is_generate? then
    738         name_array = ct.get_name_array( cell )
    739         file.print "\t{ \"#{cell.get_name}\", #{name_array[8]} },\n"
    740       end
    741     }
    742 
    743     file.print <<EOT
    744 \t{ 0, 0 },
    745 };
    746 
    747 EOT
    748 
    749   end
    750 
    751   def gen_preamble_ptr( file, b_singleton, ct_name, global_ct_name )
    752     tment = @@ptr_list[ ct_name ]
    753     file.print <<EOT
    754 
    755 GET_SET_#{tment[3]}( #{tment[1]}, #{tment[0]} )
    756 POINTER_CLASS( #{tment[1]}, #{tment[0]} )
    757 EOT
    758   end
    759 
    760   def gen_preamble_struct( file, b_singleton, ct_name, global_ct_name )
    761     tag = ct_name
    762     structType = @@struct_list[ tag ]
    763     file.print <<EOT
    764 /* struct #{tag} */
    765 STRUCT_CLASS( #{tag} )
    766 EOT
    767 
    768     structType.get_members_decl.get_items.each{ |d|
    769       type = d.get_type.get_original_type
    770       case type
    771       when IntType, CIntType
    772         bit_size = type.get_bit_size
    773         case bit_size
    774         when -11, -1
    775           tType = "Char"
    776           ttype = "char"
    777         when -2
    778           tType = "Short"
    779           ttype = "short"
    780         when -3
    781           tType = "Int"
    782           ttype = "int"
    783         when -4
    784           tType = "Long"
    785           ttype = "long"
    786         when -5
    787           tType = "IntPtr"
    788           ttype = "intptr"
    789         when 8, 16, 32, 64
    790           tType = "Int#{bit_size}"
    791           ttype = "int#{bit_size}"
    792         else
    793             raise "cannot handle bit_size #{bit_size}"
    794         end
    795         file.print "MEMBER_GET_SET_INT( #{tag}, #{d.get_name}, #{tType}, #{ttype} )\n"
    796       when FloatType, CFloatType
    797         file.print "MEMBER_GET_SET_FLOAT( #{tag}, #{d.get_name} )\n"
    798       else
    799         raise "cannot handle type"
    800       end
    801     }
    802 
    803   end
    804 
    805   def gen_preamble_instance_proto( file, b_singleton, ct_name, global_ct_name )
    806     file.print <<EOT
    807 //  Prototype MBP400
    808 mrb_value  MrubyBridge_#{@celltype_name}_initialize( mrb_state *mrb, mrb_value self);
    809 EOT
    810 
    811     @func_head_array.each{ |f|
    812       if ! f.is_function? then
    813         next
    814       end
    815       if f.get_name != :initialize then
    816         func_name = f.get_name
    817       else
    818         func_name = :initialize_cell
    819       end
    820 
    821       ret_type  = f.get_return_type
    822       ret_type0 = f.get_return_type.get_original_type
    823       b_void    = ret_type0.is_void?
    824       plist     = f.get_paramlist.get_items
    825 
    826       file.print <<EOT
    827 mrb_value  MrubyBridge_#{@celltype_name}_#{func_name}( mrb_state *mrb, mrb_value self );
    828 EOT
    829     }
    830   end
    831 
    832   def gen_preamble_instance_initialize( file, b_singleton, ct_name, global_ct_name )
    833     file.print <<EOT
    834 
    835 /* MBP100 */
    836 mrb_value
    837 MrubyBridge_#{@celltype_name}_initialize( mrb_state *mrb, mrb_value self)
    838 {
    839         mrb_value       name;
    840         struct tecs_#{@celltype_name} *tecs_cb;
    841         const struct name_to_cbp_#{@celltype_name} *ntc;
    842 
    843         /* set DATA_TYPE earlier to avoid SEGV */
    844         DATA_TYPE( self ) = &data_type_#{@celltype_name};
    845 
    846         mrb_get_args(mrb, "o", &name );
    847         if( mrb_type( name ) != MRB_TT_STRING ){
    848                 mrb_raise(mrb, E_NAME_ERROR, "cell name not string");
    849         }
    850         for( ntc = &Name_to_cbp_#{@celltype_name}[0]; ntc->name != NULL; ntc++ ){
    851                 if( strcmp( ntc->name, RSTRING_PTR( name ) ) == 0 )
    852                         break;
    853         }
    854         if( ntc->name == 0 ){
    855                 mrb_raise(mrb, E_ARGUMENT_ERROR, "cell not found");
    856         }
    857         tecs_cb = (struct tecs_#{@celltype_name} *)mrb_malloc(mrb, sizeof(struct tecs_#{@celltype_name}) );
    858         tecs_cb->cbp = ntc->cbp;
    859         DATA_PTR( self ) = (void *)tecs_cb;
    860 
    861         return self;
    862 }
    863 EOT
    864   end
    865 
    866   def gen_preamble_bridge_func( file, b_singleton, ct_name, global_ct_name )
    867 
    868     @func_head_array.each{ |f|
    869       if ! f.is_function? then
    870         next
    871       end
    872       if f.get_name != :initialize then
    873         func_name = f.get_name
    874       else
    875         func_name = :initialize_cell
    876       end
    877 
    878       ret_type  = f.get_return_type
    879       ret_type0 = f.get_return_type.get_original_type
    880       b_void    = ret_type0.is_void?
    881       plist     = f.get_paramlist.get_items
    882 
    883       file.print <<EOT
    884 
    885 /* bridge function (MBP101) */
    886 mrb_value
    887 MrubyBridge_#{ct_name}_#{func_name}( mrb_state *mrb, mrb_value self )
    888 {
    889         /* cellcbp (MBP105) */
    890         CELLCB  *p_cellcb = ((struct tecs_#{@celltype_name} *)DATA_PTR(self))->cbp;
    891 EOT
    892      
    893       file.print "      /* variables for return & parameter (MBP110) */\n"
    894       if ! b_void then
    895         file.print "    ", ret_type.get_type_str, "\tret_val", ret_type.get_type_str_post, ";\n"
    896       end
    897       arg_str = ""
    898       n_param  = 0
    899       n_scalar = 0
    900       n_ptr    = 0
    901       n_struct = 0
    902       plist.each{ |param|
    903         case param.get_direction
    904         when :IN, :INOUT, :OUT
    905           type = param.get_type.get_original_type
    906           case type
    907           when IntType
    908             file.print "        mrb_int mrb_", param.get_name, ";\n"
    909             file.print "        #{param.get_type.get_type_str}  #{param.get_name}#{param.get_type.get_type_str_post};\n"
    910             arg_str += "i"
    911             n_param += 1
    912             n_scalar += 1
    913           when FloatType
    914             file.print "        mrb_float       mrb_", param.get_name, ";\n"
    915             file.print "        #{param.get_type.get_type_str}  #{param.get_name}#{param.get_type.get_type_str_post};\n"
    916             arg_str += "f"
    917             n_param += 1
    918             n_scalar += 1
    919           when BoolType
    920             file.print "        mrb_value       mrb_", param.get_name, ";\n"
    921             file.print "        #{param.get_type.get_type_str}  #{param.get_name}#{param.get_type.get_type_str_post};\n"
    922             arg_str += "o"
    923             n_param += 1
    924             n_scalar += 1
    925           when PtrType
    926             file.print "        mrb_value       mrb_", param.get_name, ";\n"
    927             file.print "        #{param.get_type.get_type_str}  #{param.get_name}#{param.get_type.get_type_str_post};\n"
    928             arg_str += "o"
    929             n_param += 1
    930             n_ptr += 1
    931           when StructType
    932             file.print "        mrb_value       mrb_", param.get_name, ";\n"
    933             file.print "        #{param.get_type.get_type_str}  *#{param.get_name}#{param.get_type.get_type_str_post};\n"
    934             arg_str += "o"
    935             n_param += 1
    936             n_struct += 1
    937           else
    938             raise "Unkown type"
    939           end
    940         end
    941       }
    942 
    943       if n_param > 0 then
    944         file.print "    /* retrieve arguments (MBP111) */\n"
    945         file.print "    mrb_get_args(mrb, \"#{arg_str}\""
    946         plist.each{ |param|
    947           case param.get_direction
    948           when :IN, :INOUT, :OUT
    949             type = param.get_type.get_original_type
    950             case type
    951             when IntType
    952               file.print ", &mrb_", param.get_name
    953             when FloatType
    954               file.print ", &mrb_", param.get_name
    955             when BoolType
    956               file.print ", &mrb_", param.get_name
    957             when PtrType
    958               file.print ", &mrb_", param.get_name
    959             when StructType
    960               file.print ", &mrb_", param.get_name
    961             else
    962               raise "Unkown type"
    963             end
    964           end
    965         }
    966         file.print " );\n"
    967 
    968         if n_scalar > 0 || n_struct > 0 then
    969           file.print "  /* convert mrb to C (MBP112) */\n"
    970         end
    971         plist.each{ |param|
    972           case param.get_direction
    973           when :IN, :INOUT, :OUT
    974             type = param.get_type.get_original_type
    975             case type
    976             when IntType
    977               ttype = type.get_original_type
    978               tment = get_type_map_ent ttype
    979               file.print "      VALCHECK_#{tment[1]}( mrb, mrb_#{param.get_name} );\n"
    980               file.print "      #{param.get_name} = (#{param.get_type.get_type_str})mrb_#{param.get_name};\n"
    981             when FloatType
    982               file.print "      #{param.get_name} = (#{param.get_type.get_type_str})mrb_#{param.get_name};\n"
    983             when BoolType
    984               file.print "      #{param.get_name} = mrb_test( mrb_#{param.get_name} );\n"
    985             when PtrType
    986               ttype = type.get_type.get_original_type
    987               case ttype
    988               when StructType
    989                 file.print "    CHECK_STRUCT( #{ttype.get_name}, mrb_#{param.get_name} );\n"
    990                 file.print "    #{param.get_name} = (struct #{ttype.get_name}*)DATA_PTR(mrb_#{param.get_name});\n"
    991               when IntType
    992               when FloatType
    993               when BoolType
    994               else
    995                 raise "cannot handle type"
    996               end
    997             when StructType
    998               file.print "      CHECK_STRUCT( #{type.get_name}, mrb_#{param.get_name} );\n"
    999               file.print "      #{param.get_name} = (struct #{type.get_name}*)DATA_PTR(mrb_#{param.get_name});\n"
    1000             else
    1001               raise( "canot treat class" )
    1002             end
    1003           end
    1004         }
    1005 
    1006         if n_ptr > 0 then
    1007           file.print "  /* convert mrb to C for pointer types (MBP113) */\n"
    1008         end
    1009         plist.each{ |param|
    1010           case param.get_direction
    1011           when :IN, :INOUT, :OUT
    1012             type = param.get_type.get_original_type
    1013             case type
    1014             when IntType
    1015             when FloatType
    1016             when BoolType
    1017             when PtrType
    1018               case type.get_type.get_original_type
    1019               when StructType
    1020               when IntType
    1021                 ptrMrb2C file, type, param
    1022               when FloatType
    1023                 ptrMrb2C file, type, param
    1024               when BoolType
    1025                 ptrMrb2C file, type, param
    1026               else
    1027                 raise "cannot handle type"
    1028               end
    1029             when StructType
    1030             else
    1031               raise( "canot treat class" )
    1032             end
    1033           end
    1034         }
    1035 
    1036       end
    1037 
    1038       file.print "      /* calling target (MBP120) */\n"
    1039       if ! b_void then
    1040         file.print "    ret_val = "
    1041       else
    1042         file.print "    "
    1043       end
    1044       delim = ""
    1045       file.print "cTECS_", f.get_name, "( "
    1046       plist.each{ |param|
    1047         if param.get_type.get_original_type.kind_of? StructType then
    1048           aster = "*"
    1049         else
    1050           aster = ""
    1051         end
    1052         file.print delim, aster, param.get_name
    1053         delim = ", "
    1054       }
    1055       file.print " );\n"
    1056      
    1057       file.print "      /* return (MBP130) */\n"
    1058       case ret_type0
    1059       when BoolType
    1060         file.print "    return ret_val ? mrb_true_value() : mrb_false_value();\n"
    1061       when IntType
    1062         file.print "    return mrb_fixnum_value( ret_val );\n"
    1063       when FloatType
    1064         file.print "    return mrb_float_value( mrb, ret_val );\n"
    1065       when VoidType
    1066         file.print "    return  mrb_nil_value();\n"
    1067       else
    1068         raise "unknown type"
    1069       end
    1070 
    1071       file.print "}\n"
    1072     }
    1073   end
    1074 
    1075   def ptrMrb2C file, type, param
    1076     ttype = type.get_type.get_original_type
    1077     tment = get_type_map_ent ttype
    1078     tstr = tment[1]
    1079 =begin
    1080     case ttype
    1081     when IntType
    1082       bit_size = ttype.get_bit_size
    1083       case bit_size
    1084       when -1, -11
    1085         tstr = "Char"
    1086       when 8, 16, 32, 64
    1087         tstr = "Int#{bit_size}"
    1088       when -2
    1089         tstr = "Short"
    1090       when -3
    1091         tstr = "Int"
    1092       when -4
    1093         tstr = "Long"
    1094       when -5
    1095         tstr = "IntPtr"
    1096       else
    1097         raise "not handle type"
    1098       end
    1099     when FloatType
    1100       if ttype.get_bit_size == 32 then
    1101         tstr = "Float32"
    1102       else
    1103         tstr = "Double64"
    1104       end
    1105     when BoolType
    1106       tstr = "Bool"
    1107     when StructType
    1108       raise "not handle type 2 #{ttype}"
    1109     else
    1110       raise "not handle type 2 #{ttype}"
    1111     end
    1112 =end
    1113     if( param.get_size ) then
    1114       sz_str = param.get_size.to_s
    1115     elsif param.get_string then      # mikan とりあえず size_is と string の同時指定 (二重ポインタ) はなし
    1116       sz_str = param.get_string.to_s
    1117     else
    1118       sz_str = "1"
    1119     end
    1120     # unsigned 型の場合には cast が必要
    1121     if ttype.get_original_type.get_type_str != param.get_type.get_type.get_type_str then
    1122       cast_str = "(#{param.get_type.get_type_str})"
    1123     else
    1124       cast_str = ""
    1125     end
    1126 
    1127     modify = ""
    1128     case param.get_direction
    1129     when :OUT, :INOUT
    1130       case tstr
    1131       when "Char", "SChar", "UChar"
    1132         modify = "Mod"
    1133       end
    1134     end
    1135     if param.is_nullable? then
    1136       nullable = "Nullable"
    1137     else
    1138       nullable = ""
    1139     end
    1140 
    1141     # file.print "      CHECK_POINTER( #{tstr}, mrb_#{param.get_name}, #{sz_str} );\n"
    1142     # file.print "      #{param.get_name} = #{cast_str}((struct #{tstr}PointerBody*)(DATA_PTR(mrb_#{param.get_name})))->buf;\n"
    1143     file.print "        #{param.get_name} = CheckAndGet#{tstr}Pointer#{modify}#{nullable}( mrb, mrb_#{param.get_name}, #{sz_str} );\n"
    1144   end
    1145 
    1146   def get_celltype_name
    1147     @celltype_name
    1148   end
    1149 
    1150   #=== プラグイン引数 ignoreUnsigned
    1151   def set_ignoreUnsigned rhs
    1152     if rhs == "true" || rhs == nil then
    1153       @b_ignoreUnsigned = true
    1154     end
    1155   end
    1156   #=== プラグイン引数 include
    1157   def set_include rhs
    1158     funcs = rhs.split ','
    1159     funcs.each{ |rhs_func|
    1160       found = false
    1161       rhs_func.gsub!( /\s/, "" )
    1162       @signature.get_function_head_array.each{ |a|
    1163         if rhs_func.to_sym == a.get_name then
    1164           found = true
    1165         end
    1166       }
    1167       if found == false then
    1168         cdl_error( "MRB1009 include function '$1' not found in signagture '$2'", rhs, @signature.get_name )
    1169       else
    1170         @includes << rhs_func.to_sym
    1171       end
    1172     }
    1173   end
    1174   #=== プラグイン引数 exclude
    1175   def set_exclude rhs
    1176     funcs = rhs.split ','
    1177     funcs.each{ |rhs_func|
    1178       found = false
    1179       rhs_func.gsub!( /\s/, "" )
    1180       @signature.get_function_head_array.each{ |a|
    1181         if rhs_func.to_sym == a.get_name then
    1182           found = true
    1183         end
    1184       }
    1185       if found == false then
    1186         cdl_error( "MRB1010 exclude function '$1' not found in signagture '$2", rhs, @signature.get_name )
    1187       else
    1188         @excludes << rhs_func.to_sym
    1189       end
    1190     }
    1191   end
    119268end
    1193 
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/NotifierPlugin.rb

    r321 r429  
    11# -*- coding: utf-8 -*-
     2#
     3#  TECS Generator
     4#      Generator for TOPPERS Embedded Component System
    25#
    36#  Copyright (C) 2015 by Ushio Laboratory
     
    58#  Copyright (C) 2015-2016 by Embedded and Real-Time Systems Laboratory
    69#              Graduate School of Information Science, Nagoya Univ., JAPAN
     10#  Copyright (C) 2015-2018 by TOPPERS Project
    711#
     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#++
    844
    945NotifierPluginArgProc = {
     
    3167        #  - 受け口関数 - 一般化を行うと,実行時コストが大きく増大してしまうことが
    3268        #    確認されている.このため,一般化は行わない.EntryPropertyにも含めない.
    33         #  - セルインデックス - CELLIDX型で,型の規定はないが,"ポインタ値であったり
    34         #    整数値あったりする。" (TECS 5.3.6) より,インデックスかポインタある
     69        #  - セルインデックス - CELLIDX型で,型の規定はないが,"ホ゜インタ値て゛あったり
     70        #    整数値て゛あったりする。" (TECS 5.3.6) より,インデックスかポインタある
    3571        #    ことが分かる.インデックスだとすると,この値はセルCBのアドレッシングに
    3672        #    使用されるので,intptr_tに収まる筈である.ポインタの場合,当然intptr_t
     
    5894        #  - アダプタ関数へののポインタ
    5995        #  - アダプタ関数の引数
     96        #
     97        #   $Id$
    6098
    6199        # @private
     
    126164                        # @param [Cell, Symbol] cell セル.セルについて一般化する場合は `:generic`
    127165                        # @param [Integer, Symbol, nil] subscript 添字.添字について一般化する場合は `:generic`
     166                        # @param [Celltype] 呼び先のセルタイプ、cell==:generic の場合のみ有効
    128167                        # @private
    129                         def generate_inner(context, fn_name, cell, subscript)
     168                        def generate_inner(context, fn_name, cell, subscript, callee_ct=nil)
    130169                                source_file = context.source_file
    131170                                header_file = context.header_file
     
    139178                                unless ct.is_singleton?
    140179                                        if cell == :generic
    141                                                 params << "(CELLIDX)extinf"
     180                                                params << "(#{callee_ct.get_global_name}_IDX)extinf"
     181                                                # params << "(CELLIDX)extinf"
    142182                                        else
    143183                                                # セルのCELLIDXを得る
     
    231271
    232272                                                generate_inner context, fn_name,
    233                                                         :generic, subscript
     273                                                        :generic, subscript, ct
    234274
    235275                                                props.each { |prop|
     
    443483            # join:: Join : 結合 (declarationがPortであるもの)
    444484                def validate_join(handler, cell, join)
    445                 return !generate_attr_map(handler, cell).nil?
     485        return !generate_attr_map(handler, cell).nil?
    446486                end
    447487
     
    870910        parse_plugin_arg
    871911        unless @factory
    872                 cdl_error("ASP1003 celltype $1: option factory is not specified",
     912                cdl_error("NTF1003 celltype $1: option factory is not specified",
    873913                        celltype.get_name)
    874914        end
    875915        unless @output_file
    876                 cdl_error("ASP1003 celltype $1: option output_file is not specified",
     916                cdl_error("NTF1003 celltype $1: option output_file is not specified",
    877917                        celltype.get_name)
    878918        end
     
    881921    def set_factory(template_string)
    882922        unless @factory.nil?
    883                 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",
    884924                        celltype.get_name)
    885925        end
     
    889929    def set_factory_output_file(output_file)
    890930        unless @output_file.nil?
    891                 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",
    892932                        celltype.get_name)
    893933        end
     
    896936
    897937    def gen_factory file
    898         puts "===== begin #{@celltype.get_name.to_s} plugin ====="
     938        # puts "===== begin #{@celltype.get_name.to_s} plugin ====="
    899939
    900940        kernelCfg = AppFile.open( "#{$gen}/#{@output_file}" )
     
    920960                        subst_attr = @celltype.find(name)
    921961                        unless subst_attr
    922                         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.",
    923963                                @celltype.get_name, name)
    924964                        end
     
    933973
    934974        kernelCfg.close
    935         puts "===== end #{@celltype.get_name.to_s} plugin ====="
     975        # puts "===== end #{@celltype.get_name.to_s} plugin ====="
    936976    end
    937977
    938978    def gen_factory_for_cell(kernelCfg, cell)
     979      # print "########## gen_factory_for_cell cell=#{cell.get_name}\n"
    939980        handler_flags = []
    940981        handler_args = []
     
    957998                        when 'false' then ignoreErrors = false
    958999                        else
    959                                 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",
    9601001                                        cell.get_name, ignoreErrors )
    9611002                                ignoreErrors = false
    9621003                end
    9631004
     1005    # ドメイン指定用文字列
     1006    pre_text  = ""
     1007    post_text = "\n"
     1008    indent    = ""
     1009 
    9641010        [EVENT_HANDLER, ERROR_HANDLER].each { |handler|
    9651011                # 呼び口の結合を取得
    9661012                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
    9671024
    9681025                # ハンドラタイプを判別する
     
    9721029
    9731030                if matches.length == 0
    974                         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 )
    9751032                        next
    976                 end
     1033        end
    9771034
    9781035                        # 最初に見つかった有効なハンドラタイプを使用
    9791036                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
    9801086
    9811087                        # 通知ハンドラで「エラーが発生するはずがない」のに「エラーハンドラが指定されている」
     
    9841090                        #  なため、検出は行わない。)
    9851091                if handler == ERROR_HANDLER && !ht.is_a?(NullHandlerType) && !event_handler_might_fail
    986                         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.",
    9871093                                cell.get_name, handler_flag)
    9881094                end
    9891095                if handler == ERROR_HANDLER && ht.is_a?(NullHandlerType) && event_handler_might_fail && !ignoreErrors
    990                         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.",
    9911097                                cell.get_name, handler_flag)
    9921098                end
     
    10551161                        # $id$等の置換
    10561162                        cell.get_celltype.subst_name(subst, name_array)
    1057         }
    1058 
    1059         # 出力
    1060         kernelCfg.puts text
    1061 
    1062     end
    1063     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
    10641192
    10651193end
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/OpaqueRPCPlugin.rb

    r321 r429  
    5656  #=== RPCPlugin の initialize
    5757  #  説明は 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 )
    5959    super
    6060    @b_noClientSemaphore = false
     
    254254    nest = @end_region.gen_region_str_pre file
    255255    nest_str = "  " * nest
     256    if @next_cell_port_subscript then
     257      subscript = '[' + @next_cell_port_subscript.to_s + ']'
     258    else
     259      subscript = ""
     260    end
    256261
    257262    if @serverErrorHandler then
     
    282287#{nest_str}  cell #{@rpc_server_channel_celltype_name} #{@serverChannelCell}_Unmarshaler {
    283288#{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};
    285290#{serverErrorHandler_str}#{nest_str}  };
    286291EOT
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/RPCPlugin.rb

    r321 r429  
    6565  #=== RPCPlugin の initialize
    6666  #  説明は 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 )
    6868    super
    6969    @b_noClientSemaphore = false
     
    197197    nest = @region.gen_region_str_pre file
    198198    indent_str = "  " * nest
     199    if @next_cell_port_subscript then
     200      subscript = '[' + @next_cell_port_subscript.to_s + ']'
     201    else
     202      subscript = ""
     203    end
    199204
    200205    file.print <<EOT
     
    233238    file.print <<EOT
    234239#{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};
    236241#{indent_str}  cTDR         = #{@channelCellName}.eTDR;
    237242#{indent_str}  cEventflag   = #{@channelCellName}.eEventflag;
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/SharedOpaqueRPCPlugin.rb

    r321 r429  
    6868  #=== RPCPlugin の initialize
    6969  #  説明は 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 )
    7171    super
    7272    initialize_opaque_marshaler
     
    221221    nest = @start_region.gen_region_str_pre file
    222222    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
    223229
    224230    # セルを探す
     
    303309#{indent_str}cell #{@unmarshaler_celltype_name} #{@cell_name}_Server {
    304310#{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};
    306312#{ppallocator_join}#{indent_str}};
    307313EOT
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/SharedRPCPlugin.rb

    r321 r429  
    6262  #=== RPCPlugin の initialize
    6363  #  説明は 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 )
    6565
    6666    # mikan プラグインオプション指定の不一致のチェック task_priority,
     
    236236    nest = @region.gen_region_str_pre file
    237237    indent_str = "  " * nest
     238    if @next_cell_port_subscript then
     239      subscript = '[' + @next_cell_port_subscript.to_s + ']'
     240    else
     241      subscript = ""
     242    end
    238243
    239244    # セルを探す
     
    291296    file.print <<EOT
    292297#{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};
    294299#{indent_str}  cTDR         = #{@shared_channel_cell}.eTDR;
    295300#{indent_str}  cEventflag   = #{@shared_channel_cell}.eEventflag;
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/ThroughPlugin.rb

    r321 r429  
    4747#@next_cell:: Cell                    呼び口を結合するセル
    4848#@next_cell_port_name:: Symbol       呼び口を結合する受口の名前
     49#@next_cell_port_subscript::Nil|Integer   呼び口を結合する受口の配列添数.受け口配列でない場合 nil
    4950#@signature::      Signature          シグニチャ
    5051#@celltype::       Celltype           呼び先のセルのセルタイプ. through が連接する場合、最終的な呼び先のセルのセルタイプ
     
    7475  #next_cell::      Cell               呼び口を接続するセル
    7576  #next_cell_port_name:: Symbol        呼び口を接続する受口の名前
     77  #next_cell_port_subscript:: Nil|Integer  呼び口を接続する受口配列添数
    7678  #signature::      Signature          シグニチャ
    7779  #celltype::       Celltype           セルタイプ (呼び先のセルのセルタイプ)
    7880  #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 )
    8082    super()
    8183    @cell_name = cell_name                      # 生成すべきセル名(受け口側のセル名)
     
    8385    @next_cell = next_cell                      # 呼び先のセル
    8486    @next_cell_port_name = next_cell_port_name
     87    @next_cell_port_subscript = next_cell_port_subscript
    8588    @signature = signature
    8689    @entry_port_name = :"eThroughEntry"
     
    136139  def get_through_entry_port_name
    137140    @entry_port_name
     141  end
     142
     143  #===  生成されたセルの受け口配列添数を得る
     144  def get_through_entry_port_subscript
     145    @entry_port_subscript
    138146  end
    139147
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/TracePlugin.rb

    r321 r429  
    4444  #=== TracePlugin の initialize
    4545  #  説明は 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 )
    4747
    4848    @maxArrayDisplay = 16
     
    141141      nest = @region.gen_region_str_pre file
    142142      indent_str =  "  " * nest
     143      if @next_cell_port_subscript then
     144        subscript = '[' + @next_cell_port_subscript.to_s + ']'
     145      else
     146        subscript = ""
     147      end
    143148
    144149      if @probeName then
     
    155160      file.print <<EOT
    156161#{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};
    158163#{probeName_str}#{caller_cell_str}#{indent_str}};
    159164EOT
     
    210215    }
    211216    file.print( " );\n" )
     217    if @next_cell_port_subscript then
     218      subscript = '[' + @next_cell_port_subscript.to_s + ']'
     219    else
     220      subscript = ""
     221    end
    212222
    213223    file.print <<EOT
    214224\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 );
    216226EOT
    217227
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenOpaqueMarshaler.rb

    r321 r429  
    44#      Generator for TOPPERS Embedded Component System
    55
    6 #   Copyright (C) 2008-2014 by TOPPERS Project
     6#   Copyright (C) 2008-2018 by TOPPERS Project
    77#--
    88#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    464464        /* Channel Lock */
    465465        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        }
    468470EOT
    469471
     
    554556        /* Channel Unlock */
    555557        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        }
     562EOT
     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_;
    558568EOT
    559569
     
    630640        file.print <<EOT
    631641        }else{
    632                 return;
     642                return E_ID;
    633643        }
    634644EOT
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenTransparentMarshaler.rb

    r321 r429  
    388388    };
    389389#{ppallocator_dealloc_str}
    390     return;
     390    return E_OK;
    391391
    392392error_reset:
     
    394394        (void)cTDR_reset();
    395395#{ppallocator_dealloc_str}
     396    return E_OK;
    396397EOT
    397398
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecslib/version.rb

    r321 r429  
    11$package = "tecsgen"
    2 $version = "1.3.1.5"
     2$version = "1.6.4"
  • EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecsmerge.rb

    r321 r429  
    66#      Merger for TECS generated templates
    77
    8 #   Copyright (C) 2008-2015 by TOPPERS Project
     8#   Copyright (C) 2008-2017 by TOPPERS Project
    99#--
    1010#   上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    3737#   の責任を負わない.
    3838
    39 #   $Id$
     39#   $Id: tecsmerge.rb 2633 2017-04-02 06:02:05Z okuma-top $
    4040#++
    4141
     
    4444#Authors::   大山 博司
    4545#Version::   
    46 #Copyright:: Copyright (C) TOPPERS Project, 2008-2015. All rights reserved.
     46#Copyright:: Copyright (C) TOPPERS Project, 2008-2017. All rights reserved.
    4747#License::   TOPPERS ライセンスに準拠
    4848
     
    285285
    286286        next if next_stat == :HEAD || ( next_stat == :EOF && line != nil )
     287        # #1002 tecsmerge の非受け口関数 (POSTAMBLE部) の行頭に '{' があるとエラーになる     
     288        if (! $old_mode) && ( /^\{/ =~ line ) && ( stat == :PREAMBLE_BODY || stat == :POSTAMBLE_BODY )
     289          p line + "  next_stat=" + next_stat.to_s + "stat=" + stat.to_s
     290          next
     291        end
    287292
    288293        # p "R: #{stat_info[0]}"
  • EcnlProtoTool/trunk/asp3_dcre/tinet/Makefile.tinet

    r331 r429  
    9393               in_subr.o route_cfg.o
    9494TINET_CFG_COBJS := $(TINET_CFG_COBJS) tinet_cfg.o
     95TINET_CFG2_OUT_SRCS := $(TINET_CFG2_OUT_SRCS) tinet_cfg.h tinet_cfg.c
    9596
    9697#  IPv6
     
    328329
    329330        CFG_COBJS := $(CFG_COBJS) $(TINET_CFG_COBJS)
     331        CFG2_OUT_SRCS := $(CFG2_OUT_SRCS) $(TINET_CFG2_OUT_SRCS)
    330332
    331333        CLEAN_FILES := $(CLEAN_FILES) $(TINET_CFG_OUT) $(MAKE_TINET_LIB)
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/ethernet.c

    r331 r429  
    195195
    196196/**
    197  * Called by a driver when its link goes up
    198  */
    199 void ether_set_link_up(T_IFNET *ether)
    200 {
    201   if (!(ether->flags & IF_FLAG_LINK_UP)) {
    202     ether->flags |= IF_FLAG_LINK_UP;
    203 
    204     if (ether->flags & IF_FLAG_UP) {
    205 #if LWIP_ARP
    206       /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
    207       if (ether->flags & IF_FLAG_ETHARP) {
    208         etharp_gratuitous(ether);
    209       }
    210 #endif /* LWIP_ARP */
    211 
    212 #if LWIP_IGMP
    213       /* resend IGMP memberships */
    214       if (ether->_flags & IF_FLAG_IGMP) {
    215         igmp_report_groups(ether);
    216       }
    217 #endif /* LWIP_IGMP */
    218     }
    219     if (ether->link_callback) {
    220       (ether->link_callback)(ether);
    221     }
    222   }
    223 }
     197 * ether_set_link_up -- リンクしたときにNICから呼び出される
     198 */
     199void
     200ether_set_link_up()
     201{
     202        if (!(ether_ifnet.flags & IF_FLAG_LINK_UP)) {
     203                ether_ifnet.flags |= IF_FLAG_LINK_UP;
     204
     205                if (ether_ifnet.flags & IF_FLAG_UP) {
     206#if defined(_IP4_CFG) && defined(SUPPORT_ETHER)
     207                        /* ARP再構築? */
     208#endif /* #if defined(_IP4_CFG) && defined(SUPPORT_ETHER) */
     209
     210#ifdef SUPPORT_IGMP
     211                        /* IGMP参加 */
     212#endif /* #ifdef SUPPORT_IGMP */
     213                        }
     214                if (ether_ifnet.link_callback) {
     215                        (ether_ifnet.link_callback)(&ether_ifnet);
     216                        }
     217                }
     218        }
    224219
    225220/**
    226  * Called by a driver when its link goes down
    227  */
    228 void ether_set_link_down(T_IFNET *ether)
    229 {
    230   if (ether->flags & IF_FLAG_LINK_UP) {
    231     ether->flags &= ~IF_FLAG_LINK_UP;
    232     if (ether->link_callback) {
    233       (ether->link_callback)(ether);
    234     }
    235   }
    236 }
    237 
    238 /**
    239  * Set callback to be called when link is brought up/down
    240  */
    241 void ether_set_link_callback(ether_status_callback_fn link_callback)
     221 * ether_set_link_up -- リンクが切断したときにNICから呼び出される
     222 */
     223void
     224ether_set_link_down()
     225{
     226        if (ether_ifnet.flags & IF_FLAG_LINK_UP) {
     227                ether_ifnet.flags &= ~IF_FLAG_LINK_UP;
     228                if (ether_ifnet.link_callback) {
     229                        (ether_ifnet.link_callback)(&ether_ifnet);
     230                        }
     231                }
     232        }
     233
     234/*
     235 * ether_set_up -- DHCPでアドレスが設定されたとき呼び出される
     236 */
     237
     238void
     239ether_set_up()
     240{
     241        if (!(ether_ifnet.flags & IF_FLAG_UP)) {
     242                ether_ifnet.flags |= IF_FLAG_UP;
     243                if (ether_ifnet.link_callback) {
     244                        (ether_ifnet.link_callback)(&ether_ifnet);
     245                        }
     246                }
     247        }
     248
     249/*
     250 * ether_set_down -- DHCPでアドレスが解放されたとき呼び出される
     251 */
     252
     253void
     254ether_set_down()
     255{
     256        if (ether_ifnet.flags & IF_FLAG_UP) {
     257                ether_ifnet.flags &= ~IF_FLAG_UP;
     258                if (ether_ifnet.link_callback) {
     259                        (ether_ifnet.link_callback)(&ether_ifnet);
     260                        }
     261                }
     262        }
     263
     264/*
     265 * ether_set_link_callback -- リンク状態変化時のコールバック登録
     266 */
     267
     268void
     269ether_set_link_callback(ether_status_callback_fn link_callback)
    242270{
    243271        ether_ifnet.link_callback = link_callback;
    244 }
     272        if (ether_ifnet.link_callback) {
     273                (ether_ifnet.link_callback)(&ether_ifnet);
     274                }
     275        }
    245276
    246277/*
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/ethernet.h

    r331 r429  
    9999
    100100#if defined(__RX)
    101 
    102101#pragma pack
     102#elif defined(_MSC_VER)
     103#pragma pack(push, 1)
     104#endif
     105
     106#if defined(__RX) || defined(_MSC_VER)
     107
    103108typedef struct t_ether_header {
    104109
     
    113118        uint16_t        type;
    114119        } T_ETHER_HDR;
    115 #pragma packoption
    116120
    117121#elif defined(TOPPERS_S810_CLG3_85)     /* of #if defined(__RX) */
     
    143147        uint8_t         shost[ETHER_ADDR_LEN];
    144148        uint16_t        type;
    145         } __attribute__((packed, aligned(2)))T_ETHER_HDR;
     149        } __attribute__((packed, aligned(2))) T_ETHER_HDR;
    146150
    147151#endif  /* of #if defined(__RX) */
     
    158162typedef struct t_ether_addr {
    159163        uint8_t         lladdr[ETHER_ADDR_LEN];
    160         } __attribute__((packed, aligned(2)))T_ETHER_ADDR;
     164        } __attribute__((packed, aligned(2))) T_ETHER_ADDR;
     165
     166#if defined(__RX)
     167#pragma packoption
     168#elif defined(_MSC_VER)
     169#pragma pack(pop)
     170#endif
    161171
    162172/*
     
    208218                                                        /* インタフェースのマルチキャストアドレスへの変換              */
    209219
     220#define IF_FLAG_UP                              0x01U
     221#define IF_FLAG_LINK_UP                 0x10U
     222
    210223/*
    211224 *  前方参照
     
    266279#endif  /* of #ifdef T_IF_ETHER_NIC_SOFTC */
    267280
    268 #define IF_FLAG_UP                              0x01U
    269 #define IF_FLAG_LINK_UP                 0x10U
    270 
    271281/*
    272282 *  変数
     
    304314extern uint32_t ether_srand (void);
    305315
    306 /** Function prototype for netif status- or link-callback functions. */
    307316typedef void (*ether_status_callback_fn)(T_IFNET *ether);
    308317extern void ether_set_link_callback(ether_status_callback_fn link_callback);
    309 extern void ether_set_link_up(T_IFNET *ether);
    310 extern void ether_set_link_down(T_IFNET *ether);
     318extern void ether_set_link_up();
     319extern void ether_set_link_down();
     320extern void ether_set_up();
     321extern void ether_set_down();
    311322
    312323#endif  /* of #ifdef SUPPORT_ETHER */
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/if_arp.h

    r331 r429  
    9191        uint8_t         proto_len;      /* プロトコル長                       */
    9292        uint16_t        opcode;         /* 命令コード                        */
    93         } __attribute__((packed, aligned(2)))T_ARP_HDR;
     93        } __attribute__((packed, aligned(2))) T_ARP_HDR;
    9494
    9595#define ARP_HDR_SIZE                    (sizeof(T_ARP_HDR))
     
    119119typedef struct arpcom {
    120120        uint8_t         mac_addr[ETHER_ADDR_LEN];
    121         } __attribute__((packed, aligned(2)))T_ARPCOM;
     121        } __attribute__((packed, aligned(2))) T_ARPCOM;
    122122
    123123/*
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/net_asp.cfg

    r331 r429  
    4141
    4242INCLUDE("net/net.cfg");
     43
     44#ifndef NOUSE_MPF_NET_BUF
    4345
    4446/*
     
    169171                });
    170172#endif  /* of #if defined(NUM_MPF_NET_BUF6_65536) && NUM_MPF_NET_BUF6_65536 > 0 */
     173
     174#endif
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/net_buf.c

    r331 r429  
    6868#include <netinet/tcp_var.h>
    6969
     70#ifndef NOUSE_MPF_NET_BUF
     71
    7072/*
    7173 *  関数
     
    226228#endif  /* of #if defined(NUM_MPF_NET_BUF_128) && NUM_MPF_NET_BUF_128 > 0 */
    227229
    228 #if defined(_IP4_CFG)
     230#if defined(_IP6_CFG)
     231
     232#if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0
     233        {
     234                MPF_NET_BUF_CSEG,
     235                IF_HDR_SIZE + IP_HDR_SIZE + TCP_HDR_SIZE,
     236
     237#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
     238
     239                NUM_MPF_NET_BUF_CSEG,
     240
     241#endif  /* of #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF */
     242
     243                },
     244#endif  /* of #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 */
     245
     246#endif  /* of #if defined(_IP6_CFG) */
    229247
    230248#if defined(NUM_MPF_NET_BUF_64) && NUM_MPF_NET_BUF_64 > 0
     
    242260#endif  /* of #if defined(NUM_MPF_NET_BUF_64) && NUM_MPF_NET_BUF_64 > 0 */
    243261
    244 #endif  /* of #if defined(_IP4_CFG) */
     262#if defined(_IP4_CFG) && !defined(_IP6_CFG)
    245263
    246264#if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0
     
    257275                },
    258276#endif  /* of #if defined(NUM_MPF_NET_BUF_CSEG) && NUM_MPF_NET_BUF_CSEG > 0 */
     277
     278#endif  /* of #if defined(_IP4_CFG) && !defined(_IP6_CFG) */
    259279
    260280        };
     
    307327
    308328        while (1) {
    309                 if ((error = tget_mpf((ID)net_buf_table[ix].index, (void*)buf, ix == 0 ? tmout : TMO_POL)) == E_OK) {
     329                if ((error = tget_mpf((ID)net_buf_table[ix].index, (void **)buf, ix == 0 ? tmout : TMO_POL)) == E_OK) {
    310330                        (*buf)->idix  = (uint8_t)ix;
    311331                        (*buf)->len   = (uint16_t)minlen;
    312332                        (*buf)->flags = 0;
    313 
     333#ifdef IF_ETHER_MULTI_NIC
     334                        (*buf)->conn_pos = 0;
     335#endif
    314336#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
    315337                        NET_COUNT_NET_BUF(net_buf_table[ix].allocs, 1);
     
    318340                        return error;
    319341                        }
    320                 else if (ix == 0 || net_buf_table[ix].size > maxlen)
     342                ix --;
     343                if (ix < 0 || net_buf_table[ix].size > maxlen)
    321344                        break;
    322                 ix --;
    323345                }
    324346
     
    349371
    350372        while (1) {
    351                 if ((error = tget_mpf((ID)net_buf_table[ix].index, (void*)buf,
     373                if ((error = tget_mpf((ID)net_buf_table[ix].index, (void **)buf,
    352374                                      ix == sizeof(net_buf_table) / sizeof(T_NET_BUF_ENTRY) - 1 ? tmout : TMO_POL)) == E_OK) {
    353375                        (*buf)->idix  = (uint8_t)ix;
    354376                        (*buf)->len   = net_buf_table[ix].size;
    355377                        (*buf)->flags = 0;
     378#ifdef IF_ETHER_MULTI_NIC
     379                        (*buf)->conn_pos = 0;
     380#endif
    356381
    357382#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
     
    450475                /* 固定メモリプールに返す。*/
    451476
    452 #if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
    453                 net_buf_table[buf->idix].busies --;
    454 #endif
    455                 if ((error = rel_mpf((ID)net_buf_table[buf->idix].index, buf)) != E_OK) {
    456                         syslog(LOG_WARNING, "[NET BUF] %s, ID=%d.", itron_strerror(error), buf->idix);
     477                int idix = buf->idix;
     478#if NET_COUNT_ENABLE & PROTO_FLG_NET_BUF
     479                net_buf_table[idix].busies --;
     480#endif
     481                if ((error = rel_mpf((ID)net_buf_table[idix].index, buf)) != E_OK) {
     482                        syslog(LOG_WARNING, "[NET BUF] %s, ID=%d.", itron_strerror(error), idix);
    457483                        }
    458484                }
     
    505531        return (uint_t)net_buf_table[0].size;
    506532        }
     533
     534#else
     535#include <stdlib.h>
     536
     537/*
     538 *  tget_net_buf_ex -- ネットワークバッファを獲得する(拡張機能)。
     539 */
     540
     541ER
     542tget_net_buf_ex (T_NET_BUF **buf, uint_t minlen, uint_t maxlen, ATR nbatr, TMO tmout)
     543{
     544        uint_t len = (minlen > maxlen) ? minlen : maxlen;
     545        *buf = (T_NET_BUF *)malloc(sizeof(T_NET_BUF) - sizeof(((T_NET_BUF *)0)->buf) + len);
     546        if (*buf == NULL)
     547                return E_NOMEM;
     548
     549        (*buf)->idix = 0;
     550        (*buf)->len = (uint16_t)len;
     551        (*buf)->flags = 0;
     552#ifdef IF_ETHER_MULTI_NIC
     553        (*buf)->conn_pos = 0;
     554#endif
     555
     556        return E_OK;
     557        }
     558
     559/*
     560 *  tget_net_buf -- ネットワークバッファを獲得する(互換)。
     561 */
     562
     563ER
     564tget_net_buf (T_NET_BUF **buf, uint_t len, TMO tmout)
     565{
     566        return tget_net_buf_ex(buf, len, len, NBA_SEARCH_ASCENT, tmout);
     567        }
     568
     569
     570/*
     571 * rel_net_buf -- ネットワークバッファを返却する。
     572 */
     573
     574ER
     575rel_net_buf (T_NET_BUF *buf)
     576{
     577        free(buf);
     578
     579        return E_OK;
     580        }
     581
     582
     583/*
     584 * net_buf_max_siz -- ネットワークバッファの最大サイズを返す。
     585 */
     586
     587uint_t
     588net_buf_max_siz (void)
     589{
     590        return (uint_t)IF_PDU_SIZE;
     591        }
     592
     593#endif
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/net_buf.h

    r331 r429  
    5555        uint8_t         idix;   /* mpfid のインデックス        */
    5656        uint8_t         flags;  /* フラグ          */
     57#ifdef IF_ETHER_MULTI_NIC
     58        uint8_t         conn_pos;
     59#endif
    5760#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    5861        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    8083        uint8_t         idix;   /* mpfid のインデックス        */
    8184        uint8_t         flags;  /* フラグ          */
     85#ifdef IF_ETHER_MULTI_NIC
     86        uint8_t         conn_pos;
     87#endif
    8288#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    8389        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    97103        uint8_t         idix;   /* mpfid のインデックス        */
    98104        uint8_t         flags;  /* フラグ          */
     105#ifdef IF_ETHER_MULTI_NIC
     106        uint8_t         conn_pos;
     107#endif
    99108#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    100109        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    114123        uint8_t         idix;   /* mpfid のインデックス        */
    115124        uint8_t         flags;  /* フラグ          */
     125#ifdef IF_ETHER_MULTI_NIC
     126        uint8_t         conn_pos;
     127#endif
    116128#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    117129        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    131143        uint8_t         idix;   /* mpfid のインデックス        */
    132144        uint8_t         flags;  /* フラグ          */
     145#ifdef IF_ETHER_MULTI_NIC
     146        uint8_t         conn_pos;
     147#endif
    133148#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    134149        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    148163        uint8_t         idix;   /* mpfid のインデックス        */
    149164        uint8_t         flags;  /* フラグ          */
     165#ifdef IF_ETHER_MULTI_NIC
     166        uint8_t         conn_pos;
     167#endif
    150168#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    151169        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    167185        uint8_t         idix;   /* mpfid のインデックス        */
    168186        uint8_t         flags;  /* フラグ          */
     187#ifdef IF_ETHER_MULTI_NIC
     188        uint8_t         conn_pos;
     189#endif
    169190#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    170191        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/net_count.c

    r331 r429  
    222222T_NET_COUNT     net_count_igmp;
    223223
    224 #endif  /* of #if NET_COUNT_ENABLE & PROTO_FLG_ICMP4 */
     224#endif  /* of #if NET_COUNT_ENABLE & PROTO_FLG_IGMP */
    225225
    226226#endif  /* of #if defined(_IP4_CFG) */
  • EcnlProtoTool/trunk/asp3_dcre/tinet/net/net_rename.h

    r331 r429  
    7171#define tget_net_buf_ex         _tinet_tget_net_buf_ex
    7272#define tget_net_buf            _tinet_tget_net_buf
    73 #define rel_net_buf             _tinet_rel_net_buf
    74 #define rus_net_buf             _tinet_rus_net_buf
    75 #define net_buf_siz             _tinet_net_buf_siz
     73#define rel_net_buf                     _tinet_rel_net_buf
     74#define rus_net_buf                     _tinet_rus_net_buf
     75#define net_buf_siz                     _tinet_net_buf_siz
    7676#define net_buf_max_siz         _tinet_net_buf_max_siz
    7777#define nbuf_get_tbl            _tinet_nbuf_get_tbl
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/Makefile.netapp

    r331 r429  
    183183                NETAPP_COBJS := $(NETAPP_COBJS) udp6_echo_cli.o
    184184                NETAPP_KERNEL_CFG := $(NETAPP_KERNEL_CFG) $(NETAPP_DIRS)/udp6_echo_cli.cfg
    185        
     185
    186186                ifeq ($(SUPPORT_INET4),true)
    187187                        ifeq ($(USE_UDP4_ECHO_CLI),true)
     
    191191                        endif
    192192                endif
    193         else
     193                else
    194194                ifeq ($(SUPPORT_INET4),true)
    195195                        SUPPORT_UDP = true
     
    364364ifeq ($(TARGET_KERNEL),ASP)
    365365
    366         APPLDIR := $(APPLDIR) $(NETAPP_DIRS)
     366        APPLDIRS := $(APPLDIRS) $(NETAPP_DIRS)
    367367        APPL_COBJS := $(APPL_COBJS) $(NETAPP_COBJS)
    368368        APPL_CFLAGS := $(APPL_CFLAGS) -fno-strict-aliasing
     
    382382ifeq ($(TARGET_KERNEL),ASP)
    383383
    384         APPLDIR := $(APPLDIR) $(SRCDIR)/pdic/sc1602
     384        APPLDIRS := $(APPLDIRS) $(SRCDIR)/pdic/sc1602
    385385
    386386endif
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dbg_cons.c

    r331 r429  
    666666                    "IX Expire State      MAC Address       IP Address\n");
    667667
    668         /* expire の単位は [ms]。*/
     668        /* expire の単位は [us]。*/
    669669        get_tim(&now);
    670670        cache = nd6_get_cache();
     
    705705                    "IX Expire MAC Address       IP Address\n");
    706706
    707         /* expire の単位は [ms]。*/
     707        /* expire の単位は [us]。*/
    708708        cache = arp_get_cache();
    709709        for (ix = 0; ix < NUM_ARP_ENTRY; ix ++) {
     
    753753        WAI_NET_CONS_PRINTF();
    754754        get_tim(&now);
    755         cons_printf(portid, "ネットワーク統計情報\t経過時間[ms]\t%lu\t", now);
     755        cons_printf(portid, "ネットワーク統計情報\t経過時間[us]\t%lu\t", now);
    756756        if (now > (1000 * 3600 * 24))
    757757                cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
     
    938938                }
    939939
    940         cons_printf(portid, "\nネットワーク統計情報\t経過時間[ms]\t%lu\t", now);
     940        cons_printf(portid, "\nネットワーク統計情報\t経過時間[us]\t%lu\t", now);
    941941        if (now > (1000 * 3600 * 24))
    942942                cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
     
    10651065        WAI_NET_CONS_PRINTF();
    10661066        get_tim(&now);
    1067         cons_printf(portid, "ネットワークバッファ情報\t経過時間[ms]\t%u\n", now);
     1067        cons_printf(portid, "ネットワークバッファ情報\t経過時間[us]\t%u\n", now);
    10681068
    10691069#if NET_COUNT_ENABLE
     
    15771577        cons_printf(portid, " IP Address\n");
    15781578
    1579         /* expire の単位は [ms]。*/
     1579        /* expire の単位は [us]。*/
    15801580        get_tim(&now);
    15811581        dr = nd6_get_drl(&count);
     
    22982298
    22992299        cons_printf(portid, "ND:\n");
    2300         cons_printf(portid, "  TMO_ND6_RTR_SOL_DELAY:    %5d[ms]\n", TMO_ND6_RTR_SOL_DELAY);
    2301         cons_printf(portid, "  TMO_ND6_RTR_SOL_INTERVAL: %5d[ms]\n", TMO_ND6_RTR_SOL_INTERVAL);
     2300        cons_printf(portid, "  TMO_ND6_RTR_SOL_DELAY:    %5d[us]\n", TMO_ND6_RTR_SOL_DELAY);
     2301        cons_printf(portid, "  TMO_ND6_RTR_SOL_INTERVAL: %5d[us]\n", TMO_ND6_RTR_SOL_INTERVAL);
    23022302        cons_printf(portid, "  NUM_IP6_DAD_COUNT:        %5d\n",     NUM_IP6_DAD_COUNT);
    23032303        cons_printf(portid, "  NUM_ND6_CACHE_ENTRY:      %5d\n",     NUM_ND6_CACHE_ENTRY);
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dhcp4.h

    r331 r429  
    9393        uint8_t         file   [DHCP4_FILE_LEN];                /* boot file name               */
    9494        uint8_t         options[DHCP4_DFLT_OPT_LEN];    /* optional parameters field    */
    95         } T_DHCP4_MSG;
     95        } __attribute__((packed)) T_DHCP4_MSG;
    9696
    9797/* packet type の定義 */
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dhcp4_cli.c

    r331 r429  
    206206#endif
    207207
     208#ifdef SEM_DHCP4_CLI_TIMER
     209#define DHCP4_CLI_TIMER_LOCK() do { syscall(wai_sem(SEM_DHCP4_CLI_TIMER)); } while(0)
     210#define DHCP4_CLI_TIMER_UNLOCK() do { syscall(sig_sem(SEM_DHCP4_CLI_TIMER)); } while(0)
     211#else
     212#define DHCP4_CLI_TIMER_LOCK() do { } while(0)
     213#define DHCP4_CLI_TIMER_UNLOCK() do { } while(0)
     214#endif
     215
     216#ifdef SEM_DHCP4_CLI_READY
     217#define DHCP4_CLI_READY_WAIT(ct) do { syscall(wai_sem(SEM_DHCP4_CLI_READY)); } while(0)
     218#define DHCP4_CLI_READY_SIGNAL(ct) do { syscall(sig_sem(SEM_DHCP4_CLI_READY)); } while(0)
     219#else
     220#define DHCP4_CLI_READY_WAIT(ct) do { } while(0)
     221#define DHCP4_CLI_READY_SIGNAL(ct) do { ct->sig = 1; syscall(wup_tsk(ct->tskid)); } while(0)
     222#endif
     223
    208224/*
    209225 *  dhcp4_cksum -- チェックサムの計算関数
     
    381397#endif  /* of #ifdef USE_LCD */
    382398#endif
    383 
     399                ether_set_down();
    384400                }
    385401        }
     
    508524                lcd_putc(LCD_PORTID, '\n');
    509525#endif  /* of #ifdef USE_LCD */
    510         if (ct->set_addr_callback != NULL)
    511                 ct->set_addr_callback();
    512 
     526                ether_set_up();
    513527                }
    514528        }
     
    951965        int ix;
    952966
    953         syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     967        DHCP4_CLI_TIMER_LOCK();
    954968        for (ix = NUM_DHCP4C_TIMERS; ix -- > 0; )
    955969                ct->timers[ix] = 0;
    956         syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     970        DHCP4_CLI_TIMER_UNLOCK();
    957971        }
    958972
     
    970984
    971985        /* OFFER メッセージ受信タイムアウトを設定する。*/
    972         syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     986        DHCP4_CLI_TIMER_LOCK();
    973987        ct->timers[DHCP4C_TIMER_RCV_OFFER] = SYSTIM2TIMER(TMO_DHCP4C_OFFER);
    974         syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     988        DHCP4_CLI_TIMER_UNLOCK();
    975989
    976990        /* 送信å
     
    9871001        /* DISCOVER メッセージを送信する。*/
    9881002        ct->flags |= DHCP4C_FLAG_TMOUT_SND_DISC;
    989         syscall(sig_sem(SEM_DHCP4_CLI_READY));
     1003        DHCP4_CLI_READY_SIGNAL(ct);
    9901004        }
    9911005
     
    10181032
    10191033        /* EXPIRE、RENEW、REBIND タイマーを設定する。*/
    1020         syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1034        DHCP4_CLI_TIMER_LOCK();
    10211035        ct->timers[DHCP4C_TIMER_EXPIRE] = SYSTIM2TIMER(ct->expire);             /* EXPIRE      までの時間 */
    10221036        ct->timers[DHCP4C_TIMER_REBIND] = SYSTIM2TIMER(ct->rebind);             /* REBIND(T2)までの時間 */
    10231037        ct->timers[DHCP4C_TIMER_RENEW]  = SYSTIM2TIMER(ct->renew);              /* RENEW (T1)までの時間 */
    1024         syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     1038        DHCP4_CLI_TIMER_UNLOCK();
    10251039
    10261040        /* BOUND 状æ
     
    10481062‹ãŒ RENEW 以外では ACK/NAK メッセージ受信タイムアウトを設定する。*/
    10491063        if (fsm != DHCP4_FSM_RENEW) {
    1050                 syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1064                DHCP4_CLI_TIMER_LOCK();
    10511065                ct->timers[DHCP4C_TIMER_RCV_ACK] = SYSTIM2TIMER(TMO_DHCP4C_ACK);
    1052                 syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     1066                DHCP4_CLI_TIMER_UNLOCK();
    10531067                }
    10541068
     
    10731087        /* REQUEST メッセージを送信する。*/
    10741088        ct->flags |= DHCP4C_FLAG_TMOUT_SND_REQ;
    1075         syscall(sig_sem(SEM_DHCP4_CLI_READY));
     1089        DHCP4_CLI_READY_SIGNAL(ct);
    10761090        }
    10771091
     
    11031117        /* RELEASE メッセージを送信する。*/
    11041118        ct->flags |= DHCP4C_FLAG_TMOUT_SND_REL;
    1105         syscall(sig_sem(SEM_DHCP4_CLI_READY));
     1119        DHCP4_CLI_READY_SIGNAL(ct);
    11061120        }
    11071121
     
    11161130        uint8_t *option;
    11171131
    1118         memset((void*)&ct->snd_msg->msg, sizeof(ct->snd_msg->msg), 0);
     1132        memset((void*)&ct->snd_msg->msg, 0, sizeof(ct->snd_msg->msg));
    11191133        ct->snd_msg->len = sizeof(ct->snd_msg->msg);
    11201134
     
    14101424
    14111425                /* REQUEST メッセージ送信タイマーを停止する。*/
    1412                 syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1426                DHCP4_CLI_TIMER_LOCK();
    14131427                ct->timers[DHCP4C_TIMER_SND_REQ] = 0;
    1414                 syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     1428                DHCP4_CLI_TIMER_UNLOCK();
    14151429
    14161430                /*
     
    14641478
    14651479                /* ACK/NAK メッセージ受信タイマーを停止する。*/
    1466                 syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1480                DHCP4_CLI_TIMER_LOCK();
    14671481                ct->timers[DHCP4C_TIMER_RCV_ACK] = 0;
    1468                 syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     1482                DHCP4_CLI_TIMER_UNLOCK();
    14691483
    14701484                /*
     
    15441558
    15451559        /* 再送信タイムアウトを設定する。*/
    1546         syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1560        DHCP4_CLI_TIMER_LOCK();
    15471561        ct->timers[DHCP4C_TIMER_SND_REQ] = SYSTIM2TIMER(ct->interval);
    1548         syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     1562        DHCP4_CLI_TIMER_UNLOCK();
    15491563        }
    15501564
     
    15821596        /* メッセージ送信å¾
    15831597ちを行う。*/
    1584         syscall(wai_sem(SEM_DHCP4_CLI_READY));
     1598        DHCP4_CLI_READY_WAIT(ct);
    15851599
    15861600        /* SLEEP 状æ
     
    16021616
    16031617                /* DISCOVER メッセージ送信タイマーを停止する。*/
    1604                 syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1618                DHCP4_CLI_TIMER_LOCK();
    16051619                ct->timers[DHCP4C_TIMER_SND_DISC] = 0;
    1606                 syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     1620                DHCP4_CLI_TIMER_UNLOCK();
    16071621
    16081622                /* REQUEST メッセージを送信して REQUEST 状æ
     
    16341648
    16351649                /* OFFER メッセージ受信タイマーを停止する。*/
    1636                 syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1650                DHCP4_CLI_TIMER_LOCK();
    16371651                ct->timers[DHCP4C_TIMER_RCV_OFFER] = 0;
    1638                 syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     1652                DHCP4_CLI_TIMER_UNLOCK();
    16391653
    16401654                /* REQUEST メッセージを送信して REQUEST 状æ
     
    16921706
    16931707        /* 再送信タイムアウトを設定する。*/
    1694         syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1708        DHCP4_CLI_TIMER_LOCK();
    16951709        ct->timers[DHCP4C_TIMER_SND_DISC] = SYSTIM2TIMER(ct->interval);
    1696         syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
    1697         }
     1710        DHCP4_CLI_TIMER_UNLOCK();
     1711        }
     1712
     1713#ifdef DHCP4_CLI_TASK
    16981714
    16991715/*
     
    17061722        int ix;
    17071723
    1708         syscall(wai_sem(SEM_DHCP4_CLI_TIMER));
     1724        DHCP4_CLI_TIMER_LOCK();
    17091725        for (ix = NUM_DHCP4C_TIMERS; ix -- > 0; ) {
    17101726                if (ct->timers[ix] != 0) {
     
    17121728                        if (ct->timers[ix] == 0) {
    17131729                                ct->flags = (ct->flags & ~DHCP4C_FLAG_TMOUT_MASK) | DHCP4C_FLAG_TMOUT_TIMER | ix;
    1714                                 syscall(sig_sem(SEM_DHCP4_CLI_READY));
     1730                                DHCP4_CLI_READY_SIGNAL(ct);
    17151731                                }
    17161732                        }
    17171733                }
    1718         syscall(sig_sem(SEM_DHCP4_CLI_TIMER));
     1734        DHCP4_CLI_TIMER_UNLOCK();
    17191735
    17201736        /* 1秒毎にタイムアウトする。*/
    17211737        timeout((callout_func)dhcpc_timer, ct, NET_TIMER_HZ);
    17221738        }
     1739
     1740#endif
    17231741
    17241742/*
     
    18321850        }
    18331851
     1852#ifdef DHCP4_CLI_TASK
     1853
    18341854/*
    18351855 *  dispatch_event -- イベント毎の処理
     
    18451865                /* メッセージの受信とタイムアウトをå¾
    18461866つ。*/
    1847                 syscall(wai_sem(SEM_DHCP4_CLI_READY));
     1867                DHCP4_CLI_READY_WAIT(ct);
    18481868
    18491869                if (ct->flags & DHCP4C_FLAG_RCV_MSG) {
     
    18631883        }
    18641884
     1885#endif
     1886
    18651887/*
    18661888 *  init_context -- DHCP クライアントコンテキスト構造体を初期化する。
     
    18681890
    18691891static void
    1870 init_context (T_DHCP4_CLI_CONTEXT *ct, ID cepid)
     1892init_context (T_DHCP4_CLI_CONTEXT *ct, ID tskid, ID cepid)
    18711893{
    18721894        memset(ct, 0, sizeof(*ct));
     1895        ct->tskid       = tskid;
    18731896        ct->cepid       = cepid;
    18741897        ct->sc          = IF_ETHER_NIC_GET_SOFTC();
    18751898        ct->dst.portno  = DHCP4_SRV_CFG_PORTNO;
    18761899        ct->dst.ipaddr  = IPV4_ADDRANY;
    1877         ct->set_addr_callback = DHCP4_CLI_SET_ADDR_CALLBACK;
    18781900        }
    18791901
     
    19681990
    19691991                /* SLEEP を解除する。*/
    1970                 wup_tsk(DHCP4_CLI_TASK);
     1992                context.req = 1;
     1993                wup_tsk(context.tskid);
    19711994                return E_OK;
    19721995                }
     
    20612084                                }
    20622085                        }
    2063                 syscall(sig_sem(SEM_DHCP4_CLI_READY));
     2086                DHCP4_CLI_READY_SIGNAL((&context));
    20642087                }
    20652088        return E_OK;
    20662089        }
     2090
     2091#ifdef DHCP4_CLI_TASK
    20672092
    20682093/*
     
    20752100        T_DHCP4_CLI_CONTEXT     *ct;
    20762101        ID                      tskid;
    2077         ER                      error;
     2102        ER                      error = E_OK;
    20782103
    20792104        dly_tsk(1000);
     
    20842109
    20852110        /* DHCP クライアントコンテキスト構造体を初期化する。*/
    2086         init_context(ct, (ID)exinf);
     2111        init_context(ct, tskid, (ID)exinf);
     2112        ct->fsm = DHCP4_FSM_SLEEP;
    20872113
    20882114        while (true) {
    2089 
    2090                 /* 1秒毎にタイムアウトするようにタイマーを設定する。*/
    2091                 timeout((callout_func)dhcpc_timer, ct, NET_TIMER_HZ / DHCP4C_TIMER_HZ);
    2092 
    2093                 /* メッセージ構造体を初期化する。*/
    2094                 if ((error = init_cli_msg(ct)) == E_OK) {
    2095 
    2096                         /* SELECT 状æ
    2097 ‹ã«é·ç§»ã™ã‚‹ã€‚*/
    2098                         start_select(ct);
    2099 
    2100                         /* メインループ */
    2101                         error = dispatch_event(ct);
    2102                         }
    2103 
    2104                 /* å
    2105 ¨ã¦ã® TIMER をキャンセルする。*/
    2106                 cancel_all_timers(ct);
    2107 
    2108                 /* タイマーを停止する。*/
    2109                 untimeout((callout_func)dhcpc_timer, ct);
    2110 
    2111                 /* メッセージ構造体を解放する。*/
    2112                 rel_cli_msg (ct);
    21132115
    21142116                /* リースを解放後、再取得が指定されていなければ休止する。*/
     
    21162118
    21172119                        /* 休止する。*/
    2118                         if (error == E_OK)
    2119                                 syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
     2120                        if (error == E_OK) {
     2121                                if (ct->fsm != DHCP4_FSM_SLEEP)
     2122                                        syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
     2123                        }
    21202124                        else {
    21212125                                syslog(LOG_NOTICE, "[DHCP4C] server not available, go to sleep, error: %s.", itron_strerror(error));
     
    21262130                ct->flags = 0;
    21272131                ct->error = E_OK;
    2128                 }
    2129         }
    2130 
     2132
     2133                /* 1秒毎にタイムアウトするようにタイマーを設定する。*/
     2134                timeout((callout_func)dhcpc_timer, ct, NET_TIMER_HZ / DHCP4C_TIMER_HZ);
     2135
     2136                /* メッセージ構造体を初期化する。*/
     2137                if ((error = init_cli_msg(ct)) == E_OK) {
     2138
     2139                        /* SELECT 状æ
     2140‹ã«é·ç§»ã™ã‚‹ã€‚*/
     2141                        start_select(ct);
     2142
     2143                        /* メインループ */
     2144                        error = dispatch_event(ct);
     2145                        }
     2146
     2147                /* å
     2148¨ã¦ã® TIMER をキャンセルする。*/
     2149                cancel_all_timers(ct);
     2150
     2151                /* タイマーを停止する。*/
     2152                untimeout((callout_func)dhcpc_timer, ct);
     2153
     2154                /* メッセージ構造体を解放する。*/
     2155                rel_cli_msg (ct);
     2156                }
     2157        }
     2158
     2159#else
     2160
     2161T_DHCP4_CLI_CONTEXT *
     2162dhcp4_cli_initialize(ID tskid, ID cepid)
     2163{
     2164        T_DHCP4_CLI_CONTEXT *ct = &context;
     2165        /* DHCP クライアントコンテキスト構造体を初期化する。*/
     2166        init_context(ct, tskid, cepid);
     2167        ct->fsm = DHCP4_FSM_SLEEP;
     2168        ct->timer = TMO_FEVR;
     2169        return ct;
     2170        }
     2171
     2172int
     2173dhcp4_cli_get_timer(T_DHCP4_CLI_CONTEXT *ct)
     2174{
     2175        if (ct->fsm == DHCP4_FSM_SLEEP)
     2176                return TMO_FEVR;
     2177
     2178        return ct->timer;
     2179        }
     2180
     2181void
     2182dhcp4_cli_progress(T_DHCP4_CLI_CONTEXT *ct, int elapse)
     2183{
     2184        int ix;
     2185
     2186        if ((ct->fsm == DHCP4_FSM_SLEEP) || (ct->timer == TMO_FEVR))
     2187                return;
     2188
     2189        ct->timer -= elapse;
     2190        if (ct->timer > 0)
     2191                return;
     2192
     2193        /* 1秒毎にタイムアウトするようにタイマーを設定する。*/
     2194        ct->timer = 1000 * 1000;
     2195
     2196        for (ix = NUM_DHCP4C_TIMERS; ix-- > 0; ) {
     2197                if (ct->timers[ix] != 0) {
     2198                        ct->timers[ix] --;
     2199                        if (ct->timers[ix] <= 0) {
     2200                                ct->timers[ix] = 0;
     2201                                ct->flags = (ct->flags & ~DHCP4C_FLAG_TMOUT_MASK) | DHCP4C_FLAG_TMOUT_TIMER | ix;
     2202                                DHCP4_CLI_READY_SIGNAL(ct);
     2203                                }
     2204                        }
     2205                }
     2206        }
     2207
     2208void
     2209dhcp4_cli_wakeup(T_DHCP4_CLI_CONTEXT *ct)
     2210{
     2211        if (ct->req) {
     2212                ct->req = 0;
     2213                if (ct->snd_msg == NULL) {
     2214                        ct->flags = 0;
     2215                        ct->error = E_OK;
     2216
     2217                        /* メッセージ構造体を初期化する。*/
     2218                        if ((ct->error = init_cli_msg(ct)) != E_OK)
     2219                                return;
     2220
     2221                        ct->timer = 1000 * 1000;
     2222
     2223                        /* SELECT 状æ
     2224‹ã«é·ç§»ã™ã‚‹ã€‚*/
     2225                        start_select(ct);
     2226                        }
     2227                }
     2228
     2229        if (!ct->sig)
     2230                return;
     2231        ct->sig = 0;
     2232
     2233        if (ct->flags & DHCP4C_FLAG_RCV_MSG) {
     2234                while (ct->val_lst != NULL) {
     2235                        ct->error = eval_rcv_msg(ct);
     2236                        }
     2237                ct->flags &= ~DHCP4C_FLAG_RCV_MSG;
     2238                }
     2239        }
     2240
     2241void
     2242dhcp4_cli_timeout(T_DHCP4_CLI_CONTEXT *ct)
     2243{
     2244        if (ct->flags & DHCP4C_FLAG_TMOUT_MASK)
     2245                ct->error = dispatch_timeout(ct);
     2246
     2247        if (ct->error != E_OK || ct->fsm == DHCP4_FSM_SLEEP) {
     2248                /* å
     2249¨ã¦ã® TIMER をキャンセルする。*/
     2250                cancel_all_timers(ct);
     2251                ct->timer = TMO_FEVR;
     2252
     2253                /* メッセージ構造体を解放する。*/
     2254                rel_cli_msg(ct);
     2255
     2256                /* リースを解放後、再取得が指定されていなければ休止する。*/
     2257                if (!(ct->flags & DHCP4C_FLAG_RENEW)) {
     2258
     2259                        /* 休止する。*/
     2260                        if (ct->error == E_OK) {
     2261                                if (ct->fsm != DHCP4_FSM_SLEEP)
     2262                                        syslog(LOG_NOTICE, "[DHCP4C] lease released, go to sleep.");
     2263                        }
     2264                        else {
     2265                                syslog(LOG_NOTICE, "[DHCP4C] server not available, go to sleep, error: %s.", itron_strerror(ct->error));
     2266                                ct->error = E_OK;
     2267                                ct->fsm = DHCP4_FSM_SLEEP;
     2268                                }
     2269                        }
     2270                }
     2271        }
     2272
     2273#endif /* DHCP4_CLI_TASK */
    21312274#endif  /* of #ifdef DHCP4_CLI_CFG */
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dhcp4_cli.h

    r331 r429  
    206206
    207207/* 受信タイムアウト     */
    208 #define TMO_DHCP4C_OFFER        ULONG_C(120*1000)       /* OFFER メッセージ        */
    209 #define TMO_DHCP4C_ACK          ULONG_C(60*1000)        /* ACK/NAK メッセージ      */
     208#define TMO_DHCP4C_OFFER        (ULONG_C(120)*SYSTIM_HZ)        /* OFFER メッセージ        */
     209#define TMO_DHCP4C_ACK          (ULONG_C(60)*SYSTIM_HZ) /* ACK/NAK メッセージ      */
    210210
    211211/* リース時間の既定値  */
    212 #define TMO_DHCP4C_DEF_LEASE    ULONG_C(12*60*60*1000)  /* 標準時間 */
    213 #define TMO_DHCP4C_MIN_LEASE    ULONG_C(60*1000)        /* 最小時間 */
     212#define TMO_DHCP4C_DEF_LEASE    (ULONG_C(12*60*60)*SYSTIM_HZ)   /* 標準時間 */
     213#define TMO_DHCP4C_MIN_LEASE    (ULONG_C(60)*SYSTIM_HZ) /* 最小時間 */
    214214
    215215/* メッセージの送信周期       */
    216 #define TMO_DHCP4C_INIT_INTVL   ULONG_C(3*1000)         /* 初期値    */
    217 #define TMO_DHCP4C_MAX_BACKOFF  ULONG_C(15*1000)        /* 制限値    */
     216#define TMO_DHCP4C_INIT_INTVL   (ULONG_C(3)*SYSTIM_HZ)          /* 初期値    */
     217#define TMO_DHCP4C_MAX_BACKOFF  (ULONG_C(15)*SYSTIM_HZ) /* 制限値    */
    218218
    219219/* DHCP サーバへの UDP 送信タイムアウト    */
     
    230230ち時間       */
    231231#define TMO_DHCP4C_SND_REL_WAIT ULONG_C(1000000)        /* [us] */
    232 
    233 /* DHCP でアドレスが更新された時に呼び出すコールバック関数 */
    234 #ifndef DHCP4_CLI_SET_ADDR_CALLBACK
    235 #define DHCP4_CLI_SET_ADDR_CALLBACK NULL
    236 #endif
    237232
    238233#ifndef _MACRO_ONLY
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dhcp4_cli_var.h

    r331 r429  
    181181        RELTIM          interval;       /* 送信間隔                 */
    182182        ER_UINT         error;          /* エラー・データ長             */
    183         ID              cepid;          /* CEP ID                       */
     183        ID                      tskid;          /* タスクID */
     184        ID                      cepid;          /* CEP ID                       */
    184185        uint32_t        xid;            /* トランザクション ID          */
    185186        uint16_t        flags;          /* 各種フラグ                      */
     
    188189        uint8_t         fsm;            /* 現在の状æ
    189190‹                       */
    190         void (* set_addr_callback)();   /* アドレス設定時のコールバック */
     191        uint8_t         req;
     192        uint8_t         sig;
     193        int timer;
    191194        } T_DHCP4_CLI_CONTEXT;
    192195
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/netapp_subr.c

    r331 r429  
    4444#include <sil.h>
    4545#include <syssvc/serial.h>
    46 #include <syssvc/logtask.h>
     46#include <target_syssvc.h>
     47#define LOGTASK_PORTID SIO_PORTID
    4748#include <t_syslog.h>
    4849#include "kernel_cfg.h"
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/resolver.c

    r331 r429  
    5959#include <kernel.h>
    6060#include <t_syslog.h>
    61 #include <syssvc/logtask.h>
     61#include <target_syssvc.h>
     62#define LOGTASK_PORTID SIO_PORTID
    6263#include "kernel_cfg.h"
    6364#include "tinet_cfg.h"
     
    253254{
    254255        uint_t          label_len;
    255         uint8_t         *tail;
     256        char            *tail;
    256257
    257258        while (*name != '\0') {
     
    265266
    266267                /* ラベル長を設定する。*/
    267                 label_len = tail - (uint8_t*)name;
     268                label_len = tail - name;
    268269                if (label_len > DNS_LABEL_LENGTH) {     /* 63 オクテットをè¶
    269270えるとエラー */
     
    421422
    422423                        /* ドメイン名を追加する。*/
    423                         if ((offset = add_name(msg, msg_size, offset, dns_domain_name)) < 0)
     424                        if ((offset = add_name(msg, msg_size, offset, (char *)dns_domain_name)) < 0)
    424425                                return offset;
    425426
     
    10751076
    10761077        if (new == NULL)
    1077                 strcpy(dns_domain_name, RSLV_CFG_DNS_DOMAIN_NAME_STR);
     1078                strcpy((char *)dns_domain_name, RSLV_CFG_DNS_DOMAIN_NAME_STR);
    10781079        else {
    10791080                dst = dns_domain_name;
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/resolver.h

    r331 r429  
    7070 */
    7171
    72 #define TMO_DNS_UDP_SND         ULONG_C(1*1000) /* [ms]、DNS サーバへの   UDP 送信タイムアウト    */
    73 #define TMO_DNS_UDP_RCV         ULONG_C(5*1000) /* [ms]、DNS サーバからの UDP 受信タイムアウト   */
     72#define TMO_DNS_UDP_SND         ULONG_C(1*1000*1000)    /* [us]、DNS サーバへの   UDP 送信タイムアウト    */
     73#define TMO_DNS_UDP_RCV         ULONG_C(5*1000*1000)    /* [us]、DNS サーバからの UDP 受信タイムアウト   */
    7474#define NUM_DNS_UDP_RETRY       1               /* リトライ回数                                   */
    7575
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/wwws.c

    r331 r429  
    708708        len += put_str(cepid, srbuf, response);
    709709        get_tim(&finish);
    710         syslog(LOG_NOTICE, "[WWWn:%02u SND] send: index.html, len: %4u, time: %lu [ms]",
     710        syslog(LOG_NOTICE, "[WWWn:%02u SND] send: index.html, len: %4u, time: %lu [us]",
    711711                           cepid, len, (finish - start) * 1000 / SYSTIM_HZ);
    712712        return E_OK;
     
    16091609
    16101610        get_tim(&finish);
    1611         syslog(LOG_NOTICE, "[WWWn:%02u SND]send: stat.html,  len: %4u, time: %lu [ms]",
     1611        syslog(LOG_NOTICE, "[WWWn:%02u SND]send: stat.html,  len: %4u, time: %lu [us]",
    16121612                           cepid, len, (finish - start) * 1000 / SYSTIM_HZ);
    16131613        return E_OK;
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netdev/if_mbed/if_mbed.c

    r331 r429  
    44 *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    6  *  Copyright (C) 2014 Cores Co., Ltd. Japan
     6 *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
    77 *
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
     
    6464 * SUCH DAMAGE.
    6565 *
    66  * $FreeBSD: src/sys/i386/isa/if_mbed.c,v 1.148.2.4 1999/09/25 13:08:18 nyan Exp $
     66 * $FreeBSD: src/sys/i386/isa/if_ed.c,v 1.148.2.4 1999/09/25 13:08:18 nyan Exp $
    6767 */
    6868
     
    200200if_mbed_setrcr(T_IF_SOFTC *ic)
    201201{
    202         T_MBED_SOFTC    *sc = ic->sc;
    203202}
    204203
     
    318317if_mbed_init(T_IF_SOFTC *ic)
    319318{
    320         T_MBED_SOFTC *sc = ic->sc;
    321 
    322319        /* mbed_init 本体を呼び出す。*/
    323320        if_mbed_init_sub(ic);
     
    347344                                }
    348345                                if (link_mode_new != NEGO_FAIL) {
    349                                         ethernetext_set_link_mode(link_mode_new);
     346                                        ethernetext_set_link_mode(link_mode_new | PROMISCUOUS_MODE);
    350347                                        ETHER.EESIPR0 |= EDMAC_EESIPR_INI_TRANS;
    351348                                        ether_set_link_up(ether);
     
    373370if_mbed_read(T_IF_SOFTC *ic)
    374371{
    375         T_MBED_SOFTC *sc = ic->sc;
    376372        T_NET_BUF *input = NULL;
    377373        uint_t align;
     
    406402if_mbed_start(T_IF_SOFTC *ic, T_NET_BUF *output)
    407403{
    408         T_MBED_SOFTC *sc = ic->sc;
    409404        int32_t len, res, pos;
    410405
     
    429424if_mbed_eth_handler(void)
    430425{
    431     uint32_t stat_edmac;
    432     uint32_t stat_etherc;
    433 
    434     /* Clear the interrupt request flag */
    435     stat_edmac = (ETHER.EESR0 & ETHER.EESIPR0);       /* Targets are restricted to allowed interrupts */
    436     ETHER.EESR0 = stat_edmac;
    437     /* Reception-related */
    438     if (stat_edmac & EDMAC_EESIPR_INI_RECV) {
    439                 isig_sem(if_softc.semid_rxb_ready);
    440     }
     426        uint32_t stat_edmac;
     427        uint32_t stat_etherc;
     428        ER ret;
     429       
     430        /* Clear the interrupt request flag */
     431        stat_edmac = (ETHER.EESR0 & ETHER.EESIPR0);       /* Targets are restricted to allowed interrupts */
     432        ETHER.EESR0 = stat_edmac;
     433        /* Reception-related */
     434        if (stat_edmac & EDMAC_EESIPR_INI_RECV) {
     435                ret = isig_sem(if_softc.semid_rxb_ready);
     436                if (ret != E_OK)
     437                        syslog(LOG_INFO, "semid_rxb_ready %d %x", ret, stat_edmac & EDMAC_EESIPR_INI_RECV);
     438        }
    441439        if (stat_edmac & EDMAC_EESIPR_INI_TRANS) {
    442                 isig_sem(if_softc.semid_txb_ready);
    443         }
    444     /* E-MAC-related */
    445     if (stat_edmac & EDMAC_EESIPR_INI_EtherC) {
    446         /* Clear the interrupt request flag */
    447         stat_etherc = (ETHER.ECSR0 & ETHER.ECSIPR0);  /* Targets are restricted to allowed interrupts */
    448         ETHER.ECSR0  = stat_etherc;
    449     }
    450 }
     440                ret = isig_sem(if_softc.semid_txb_ready);
     441                if (ret != E_OK)
     442                        syslog(LOG_INFO, "semid_txb_ready %d %x", ret, stat_edmac & EDMAC_EESIPR_INI_TRANS);
     443        }
     444        /* E-MAC-related */
     445        if (stat_edmac & EDMAC_EESIPR_INI_EtherC) {
     446                /* Clear the interrupt request flag */
     447                stat_etherc = (ETHER.ECSR0 & ETHER.ECSIPR0);  /* Targets are restricted to allowed interrupts */
     448                ETHER.ECSR0  = stat_etherc;
     449        }
     450}
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netdev/if_mbed/if_mbed.cfg

    r321 r429  
    44 *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    6  *  Copyright (C) 2014 Cores Co., Ltd. Japan
     6 *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
    77 *
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netdev/if_mbed/if_mbed.h

    r321 r429  
    44 *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    6  *  Copyright (C) 2014 Cores Co., Ltd. Japan
     6 *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
    77 *
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netdev/if_mbed/nic.cfg

    r321 r429  
    44 *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    6  *  Copyright (C) 2014 Cores Co., Ltd. Japan
     6 *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
    77 *
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netdev/if_mbed/nic_asp.cfg

    r321 r429  
    44 *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    6  *  Copyright (C) 2014 Cores Co., Ltd. Japan
     6 *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
    77 *
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netdev/if_mbed/nic_rename.h

    r321 r429  
    44 *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    6  *  Copyright (C) 2014 Cores Co., Ltd. Japan
     6 *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
    77 *
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netdev/if_mbed/tinet_nic_config.h

    r321 r429  
    44 *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    6  *  Copyright (C) 2014 Cores Co., Ltd. Japan
     6 *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
    77 *
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netdev/if_mbed/tinet_nic_defs.h

    r321 r429  
    44 *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    6  *  Copyright (C) 2014 Cores Co., Ltd. Japan
     6 *  Copyright (C) 2014-2019 Cores Co., Ltd. Japan
    77 *
    88 *  上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/icmp6.h

    r331 r429  
    291291typedef struct t_router_advert_hdr {
    292292        T_ICMP6_HDR     hdr;
    293         uint32_t        reachable;              /* [ms] 到達可能時間  */
    294         uint32_t        retransmit;             /* [ms] 近隣要請送信間隔        */
     293        uint32_t        reachable;              /* [us] 到達可能時間  */
     294        uint32_t        retransmit;             /* [us] 近隣要請送信間隔        */
    295295        /* この後にオプションが続く */
    296296        } __attribute__((packed, aligned(2))) T_ROUTER_ADVERT_HDR;
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/in4_subr.c

    r331 r429  
    115115#include <net/if_var.h>
    116116
     117#ifdef SUPPORT_IGMP
     118#include <netinet/udp_var.h>
     119#include <netinet/ip_igmp.h>
     120#endif /* of #ifdef SUPPORT_IGMP */
     121
    117122#if defined(_IP4_CFG)
    118123
     
    294299
    295300        /* IP ヘッダを設定する。*/
    296         if ((error = in4_set_header(*nbuf, len, dstaddr, srcaddr, proto, ttl)) != E_OK)
     301        if ((error = in4_set_header(*nbuf, len, dstaddr, srcaddr, proto, ttl)) != E_OK) {
     302                syscall(rel_net_buf(*nbuf));
     303                *nbuf = NULL;
    297304                return error;
     305                }
    298306
    299307        /* 4 オクテット境界までパディングで埋める。*/
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/in_itron.h

    r331 r429  
    6262#define TFN_TCP_ALL             (0)
    6363
    64 #define TEV_TCP_RCV_OOB         (-0x201)
     64#define TEV_TCP_RCV_OOB         (0x201)
    6565
    6666/* UDP 関係 */
     
    7575#define TFN_UDP_ALL             (0)
    7676
    77 #define TEV_UDP_RCV_DAT         (-0x221)
     77#define TEV_UDP_RCV_DAT         (0x221)
    7878
    7979/* 一般 */
     
    139139extern ER       udp_cre_cep (ID cepid, T_UDP_CCEP *pk_ccep);
    140140
     141extern ER       udp6_del_cep(ID cepid);
     142extern ER       udp6_set_opt(ID cepid, int_t optname, void *optval, int_t optlen);
     143extern ER       udp6_get_opt(ID cepid, int_t optname, void *optval, int_t optlen);
    141144extern ER       udp6_cre_cep (ID cepid, T_UDP6_CCEP *pk_ccep);
    142145
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/in_rename.h

    r331 r429  
    242242#define arp_get_cache           _tinet_arp_get_cache
    243243
    244 #define ether_map_ipv4_multicast        _tinet_ether_map_ipv4_multicast
     244#define ether_map_ipv4_multicast        \
     245                                                                _tinet_ether_map_ipv4_multicast
    245246
    246247/* netinet6/icmp6.c */
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/in_var.h

    r331 r429  
    141141                                        inn_get_datagram(nbuf,len,maxlen,dst,src,next,hlim,nbatr,tmout)
    142142#define IN_IS_ADDR_MULTICAST(addr)      inn_is_addr_multicast(addr)
    143 #define IN_IS_NET_ADDR_MULTICAST(nbuf)  IN_IS_ADDR_MULTICAST(&GET_IP6_HDR(nbuf)->dst)
     143#define IN_IS_NET_ADDR_MULTICAST(nbuf)  (GET_IP_VER(input)==IPV6_VERSION        \
     144                                        ?IN_IS_ADDR_MULTICAST(&GET_IP6_HDR(input)->dst) \
     145                                        :IN4_IS_ADDR_MULTICAST(ntohl(GET_IP4_HDR(input)->dst)))
    144146#define IN_ADDRWITHIFP(ifp,src,dst)     inn_addrwithifp(ifp,src,dst)
    145147#define IN_IS_ADDR_ANY(addr)            IN6_IS_ADDR_UNSPECIFIED(addr)
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/ip4_var.h

    r331 r429  
    106106        uint8_t         idix;   /* mpfid のインデックス  */
    107107        uint8_t         flags;  /* フラグ            */
     108#ifdef IF_ETHER_MULTI_NIC
     109        uint8_t         conn_pos;
     110#endif
    108111#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    109112        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    124127        uint8_t         idix;   /* mpfid のインデックス  */
    125128        uint8_t         flags;  /* フラグ            */
     129#ifdef IF_ETHER_MULTI_NIC
     130        uint8_t         conn_pos;
     131#endif
    126132#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    127133        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    178184        uint8_t         idix;   /* mpfid のインデックス  */
    179185        uint8_t         flags;  /* フラグ            */
     186#ifdef IF_ETHER_MULTI_NIC
     187        uint8_t         conn_pos;
     188#endif
    180189#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    181190        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/ip_igmp.c

    r331 r429  
    55*                   Tomakomai National College of Technology, JAPAN
    66*
    7 *  ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì (1)`(4) ‚ÌðŒ‚©CFree Software Foundation
    8 *  ‚É‚æ‚Á‚ÄŒö•\‚³‚ê‚Ä‚¢‚é GNU General Public License ‚Ì Version 2 ‚É‹L
    9 *  q‚³‚ê‚Ä‚¢‚éðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒFƒAi–{ƒ\ƒtƒgƒEƒFƒA
    10 *  ‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü•ÏEÄ”z•ziˆÈ‰ºC
    11 *  —˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
    12 *  (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
    13 *      Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
    14 *      ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
    15 *  (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
    16 *      —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ
    17 ƒƒ“ƒgi—˜—p
    18 *      ŽÒƒ}ƒjƒ
    19 ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
    20 *      ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
    21 *  (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
    22 *      —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚ÌðŒ‚ð–ž‚½‚·‚±‚ƁD
    23 *    (a) Ä”z•z‚É”º‚¤ƒhƒLƒ
    24 ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ
    25 ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
    26 *        ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
    27 *  (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
    28 *      ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
     7*  上記著作権è€
     8は,以下の (1)~(4) の条件か,Free Software Foundation
     9*  によってå
     10¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
     11*  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
     12*  を改変したものを含む.以下同じ)を使用・複製・改変・再é
     13å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
     14*  利用と呼ぶ)することを無償で許諾する.
     15*  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     16*      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     17*      スコード中に含まれていること.
     18*  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     19*      用できる形で再é
     20å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é
     21å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
     22*      è€
     23マニュアルなど)に,上記の著作権表示,この利用条件および下記
     24*      の無保証規定を掲載すること.
     25*  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     26*      用できない形で再é
     27å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®æ¡ä»¶ã‚’満たすこと.
     28*    (a) 再é
     29å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€
     30マニュアルなど)に,上記の著
     31*        作権表示,この利用条件および下記の無保証規定を掲載すること.
     32*  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     33*      害からも,上記著作権è€
     34およびTOPPERSプロジェクトをå
     35è²¬ã™ã‚‹ã“と.
    2936*
    30 *  –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
    31 *  ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC‚»‚Ì“K—p‰Â”\«‚à
    32 *  ŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼
    33 *  Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»‚̐ӔC‚𕉂í‚È‚¢D
     37*  本ソフトウェアは,無保証で提供されているものである.上記著作権è€
     38お
     39*  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
     40*  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
     41*  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
    3442*
    3543*  @(#) $Id$
     
    8896
    8997static bool_t igmp_send_report_v2(T_IN4_ADDR dst);
    90 static uint16_t igmp_get_timer(T_IGMP_ENTRY *entry);
     98static int16_t igmp_get_timer(T_IGMP_ENTRY *entry);
    9199
    92100ER igmp_set_loop(T_UDP_CEP *cep, uint8_t optval)
     
    155163        T_IGMP_ENTRY *entry = NULL;
    156164        int             i;
    157         uint16_t        min;
    158165        T_IFNET *ifp = IF_GET_IFNET();
    159166        ER ret = E_NOMEM;
     
    168175                entry = &igmp_groups[i];
    169176                if (entry->timer == -1) {
    170                         entry->timer = igmp_get_timer(entry);
     177                        entry->timer = 0;
    171178                        entry->ip_addr = optval->imr_multiaddr;
    172179                        ret = E_OK;
     
    184191        T_IGMP_ENTRY *entry = NULL;
    185192        int             i;
    186         uint16_t        min;
    187193        ER ret = E_PAR;
    188194        T_IFNET *ifp = IF_GET_IFNET();
     
    223229        T_NET_BUF       *input = *inputp;
    224230        T_IGMPV2_HDR    *igmph;
    225         T_IN4_ADDR      addr;
    226231        uint_t          len, align;
    227232        T_IP4_HDR       *ip4h;
     
    234239        NET_COUNT_IGMP(net_count_igmp.in_packets, 1);
    235240
    236         /* ICMP ƒwƒbƒ_‚Ì’·‚³‚ðƒ`ƒFƒbƒN‚·‚éB*/
     241        /* ICMP ヘッダの長さをチェックする。*/
    237242        if (input->len < IF_IP4_IGMP_HDR_SIZE) {
    238243                NET_COUNT_IGMP(net_count_igmp.in_err_packets, 1);
     
    243248        igmph = (T_IGMPV2_HDR *)(input->buf + *offp);
    244249
    245         /* 4 ƒIƒNƒeƒbƒg‹«ŠE‚̃f[ƒ^’· */
     250        /* 4 オクテット境界のデータ長 */
    246251        len = input->len - *offp;
    247252        align = (len + 3) >> 2 << 2;
    248253
    249         /* 4 ƒIƒNƒeƒbƒg‹«ŠE‚܂ŃpƒfƒBƒ“ƒO‚Å–„‚ß‚éB*/
     254        /* 4 オクテット境界までパディングで埋める。*/
    250255        if (align > len)
    251256                memset((uint8_t*)input->buf + input->len, 0, (size_t)(align - len));
    252257
    253         /* ƒ`ƒFƒbƒNƒTƒ€‚ðŒvŽZ‚·‚éB*/
     258        /* チェックサムを計算する。*/
    254259        if (in_cksum(igmph, align) != 0) {
    255260                NET_COUNT_IGMP(net_count_igmp.in_err_packets, 1);
     
    257262        }
    258263
    259         /* ƒƒbƒZ[ƒW‚ÌŒ^‚É‚æ‚蕪Šò‚·‚éB*/
     264        /* メッセージの型により分岐する。*/
    260265        switch (igmph->type) {
    261266        case IGMP_MEMBERSHIP_QUERY:
     
    263268                ret = false;
    264269
    265                 /* ŽQ‰Á’†‚̃Oƒ‹[ƒvƒAƒhƒŒƒX‚©‚ç‚̃NƒGƒŠ[‚̏ꍇ */
     270                /* 参加中のグループアドレスからのクエリーの場合 */
    266271                syscall(wai_sem(SEM_IGMP_GROUP_LOCK));
    267272
    268273                for (i = 0; i < NUM_IGMP_ENTRY; i++) {
    269274                        entry = &igmp_groups[i];
    270                         if ((entry->timer >= 0) && (entry->ip_addr == addr)) {
     275                        if ((entry->timer >= 0) && (entry->ip_addr == igmph->addr)) {
    271276                                entry->resptime = igmph->time;
    272277                                ret = true;
     
    278283
    279284                if (ret) {
    280                         /* ƒƒ“ƒo[ƒVƒbƒvƒŠƒ|[ƒg‚𑗐M */
     285                        /* メンバーシップリポートを送信 */
    281286                        igmp_send_report_v2(ip4h->src);
    282287                }
     
    293298        T_IGMPV2_HDR    *igmph;
    294299        T_NET_BUF               *output;
    295         uint_t                  len, align;
     300        uint_t                  len = 0, align;
    296301
    297302        if (in4_get_datagram(&output, (uint_t)(IF_IP4_IGMP_HDR_SIZE + len), 0,
     
    300305                return false;
    301306
    302         /* IGMP ƒwƒbƒ_‚ðÝ’è‚·‚éB*/
     307        /* IGMP ヘッダを設定する。*/
    303308        igmph = GET_IGMPV2_HDR(output, IF_IP4_IGMP_HDR_OFFSET);
    304309        igmph->type = IGMP_MEMBERSHIP_REPORT_V2;
    305310        igmph->time = 0;
    306         igmph->addr = dst;
    307 
    308         /* 4 ƒIƒNƒeƒbƒg‹«ŠE‚̃f[ƒ^’· */
     311        igmph->addr = htonl(dst);
     312
     313        /* 4 オクテット境界のデータ長 */
    309314        align = (len + 3) >> 2 << 2;
    310315
    311         /* 4 ƒIƒNƒeƒbƒg‹«ŠE‚܂ŃpƒfƒBƒ“ƒO‚Å–„‚ß‚éB*/
     316        /* 4 オクテット境界までパディングで埋める。*/
    312317        if (align > len)
    313                 memset((uint8_t*)GET_IGMP_SDU(output, IF_IP4_IGMP_HDR_OFFSET) + IP4_HDR_SIZE + len,
     318                memset((uint8_t*)GET_IGMP_SDU(output, IF_IP4_IGMP_HDR_OFFSET) + len,
    314319                        0, (size_t)(align - len));
    315320
    316         /* ƒ`ƒFƒbƒNƒTƒ€‚ðŒvŽZ‚·‚éB*/
     321        /* チェックサムを計算する。*/
    317322        igmph->sum = 0;
    318         igmph->sum = in_cksum(igmph, (uint_t)(IF_IP4_IGMP_HDR_SIZE + align));
    319 
    320         /* ‘—M‚·‚éB*/
     323        igmph->sum = in_cksum(igmph, (uint_t)(IGMP_HDR_SIZE + align));
     324
     325        /* 送信する。*/
    321326        NET_COUNT_IGMP(net_count_igmp.out_octets,
    322327                output->len - GET_IF_IP4_HDR_SIZE(output));
     
    330335
    331336/*
    332 *  igmp_timer -- IGMP ‹¤’ʃ^ƒCƒ}[
     337*  igmp_timer -- IGMP å
     338±é€šã‚¿ã‚¤ãƒžãƒ¼
    333339*/
    334340static void igmp_timer(void *ignore)
     
    361367
    362368/*
    363 *  igmp_init -- IGMP ‹@”\‚ð‰Šú‰»‚·‚éB
     369*  igmp_init -- IGMP 機能を初期化する。
    364370*/
    365371
    366372void igmp_init(void)
    367373{
    368         T_IGMP_ENTRY *entry = NULL;
    369374        int i;
    370375
     
    397402}
    398403
    399 uint16_t igmp_get_timer(T_IGMP_ENTRY *entry)
    400 {
    401         uint16_t time = entry->resptime;
     404int16_t igmp_get_timer(T_IGMP_ENTRY *entry)
     405{
     406        int16_t time = entry->resptime;
    402407
    403408        if (time == 0)
    404                 time = 10;
    405 
    406         return net_rand() / (0x7fffffff / time);
     409                time = 590;
     410
     411        return (int16_t)(net_rand() % time) + 10;
    407412}
    408413
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/ip_igmp.cfg

    r331 r429  
    55 *                   Tomakomai National College of Technology, JAPAN
    66 *
    7  *  ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì (1)`(4) ‚ÌðŒ‚©CFree Software Foundation
    8  *  ‚É‚æ‚Á‚ÄŒö•\‚³‚ê‚Ä‚¢‚é GNU General Public License ‚Ì Version 2 ‚É‹L
    9  *  q‚³‚ê‚Ä‚¢‚éðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒFƒAi–{ƒ\ƒtƒgƒEƒFƒA
    10  *  ‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü•ÏEÄ”z•ziˆÈ‰ºC
    11  *  —˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
    12  *  (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
    13  *      Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
    14  *      ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
    15  *  (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
    16  *      —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ
    17 ƒƒ“ƒgi—˜—p
    18  *      ŽÒƒ}ƒjƒ
    19 ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
    20  *      ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
    21  *  (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
    22  *      —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚ÌðŒ‚ð–ž‚½‚·‚±‚ƁD
    23  *    (a) Ä”z•z‚É”º‚¤ƒhƒLƒ
    24 ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ
    25 ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
    26  *        ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
    27  *  (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
    28  *      ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
     7 *  上記著作権è€
     8は,以下の (1)~(4) の条件か,Free Software Foundation
     9 *  によってå
     10¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
     11 *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
     12 *  を改変したものを含む.以下同じ)を使用・複製・改変・再é
     13å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
     14 *  利用と呼ぶ)することを無償で許諾する.
     15 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     16 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     17 *      スコード中に含まれていること.
     18 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     19 *      用できる形で再é
     20å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é
     21å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
     22 *      è€
     23マニュアルなど)に,上記の著作権表示,この利用条件および下記
     24 *      の無保証規定を掲載すること.
     25 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     26 *      用できない形で再é
     27å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®æ¡ä»¶ã‚’満たすこと.
     28 *    (a) 再é
     29å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€
     30マニュアルなど)に,上記の著
     31 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     32 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     33 *      害からも,上記著作権è€
     34およびTOPPERSプロジェクトをå
     35è²¬ã™ã‚‹ã“と.
    2936 *
    30  *  –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
    31  *  ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC‚»‚Ì“K—p‰Â”\«‚à
    32  *  ŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼
    33  *  Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»‚̐ӔC‚𕉂í‚È‚¢D
     37 *  本ソフトウェアは,無保証で提供されているものである.上記著作権è€
     38お
     39 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
     40 *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
     41 *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
    3442 *
    3543 *  @(#) $Id$
     
    3745
    3846/*
    39  *  IGMP ƒRƒ“ƒtƒBƒMƒ
    40 ƒŒ[ƒVƒ‡ƒ“ƒtƒ@ƒCƒ‹
     47 *  IGMP コンフィギュレーションファイル
    4148 */
    4249
    4350#if defined(_IP4_CFG) && defined(SUPPORT_IGMP)
    4451
    45 /* IGMP ƒOƒ‹[ƒvXV—pƒZƒ}ƒtƒH */
     52/* IGMP グループ更新用セマフォ */
    4653
    4754CRE_SEM(SEM_IGMP_GROUP_LOCK, { TA_TPRI, 1, 1 });
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/ip_igmp.h

    r331 r429  
    55 *                   Tomakomai National College of Technology, JAPAN
    66 *
    7  *  ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì (1)`(4) ‚ÌðŒ‚©CFree Software Foundation
    8  *  ‚É‚æ‚Á‚ÄŒö•\‚³‚ê‚Ä‚¢‚é GNU General Public License ‚Ì Version 2 ‚É‹L
    9  *  q‚³‚ê‚Ä‚¢‚éðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒFƒAi–{ƒ\ƒtƒgƒEƒFƒA
    10  *  ‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü•ÏEÄ”z•ziˆÈ‰ºC
    11  *  —˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
    12  *  (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
    13  *      Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
    14  *      ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
    15  *  (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
    16  *      —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ
    17 ƒƒ“ƒgi—˜—p
    18  *      ŽÒƒ}ƒjƒ
    19 ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
    20  *      ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
    21  *  (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
    22  *      —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚ÌðŒ‚ð–ž‚½‚·‚±‚ƁD
    23  *    (a) Ä”z•z‚É”º‚¤ƒhƒLƒ
    24 ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ
    25 ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
    26  *        ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
    27  *  (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
    28  *      ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
     7 *  上記著作権è€
     8は,以下の (1)~(4) の条件か,Free Software Foundation
     9 *  によってå
     10¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
     11 *  述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
     12 *  を改変したものを含む.以下同じ)を使用・複製・改変・再é
     13å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
     14 *  利用と呼ぶ)することを無償で許諾する.
     15 *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
     16 *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
     17 *      スコード中に含まれていること.
     18 *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
     19 *      用できる形で再é
     20å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é
     21å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
     22 *      è€
     23マニュアルなど)に,上記の著作権表示,この利用条件および下記
     24 *      の無保証規定を掲載すること.
     25 *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
     26 *      用できない形で再é
     27å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®æ¡ä»¶ã‚’満たすこと.
     28 *    (a) 再é
     29å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€
     30マニュアルなど)に,上記の著
     31 *        作権表示,この利用条件および下記の無保証規定を掲載すること.
     32 *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
     33 *      害からも,上記著作権è€
     34およびTOPPERSプロジェクトをå
     35è²¬ã™ã‚‹ã“と.
    2936 *
    30  *  –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
    31  *  ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC‚»‚Ì“K—p‰Â”\«‚à
    32  *  ŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼
    33  *  Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»‚̐ӔC‚𕉂í‚È‚¢D
     37 *  本ソフトウェアは,無保証で提供されているものである.上記著作権è€
     38お
     39 *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
     40 *  含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
     41 *  接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
    3442 *
    3543 *  @(#) $Id$
     
    3947#define _IP_IGMP_H_
    4048
    41 #define NUM_IGMP_ENTRY                          5       /* ƒ}ƒ‹ƒ`ƒLƒƒƒXƒgƒOƒ‹[ƒv‚̃Gƒ“ƒgƒŠ” */
    42 
    43 #ifdef __CA850__
    44 #pragma pack(1)
    45 #elif __RX
    46 #pragma pack
    47 #elif _MSC_VER
    48 #pragma pack(push, 1)
    49 #endif
     49#define NUM_IGMP_ENTRY                          5       /* マルチキャストグループのエントリ数 */
    5050
    5151 /*
    52   *  IGMPv1 ƒwƒbƒ_‚Ì’è‹`ARFC 1112
     52  *  IGMPv1 ヘッダの定義、RFC 1112
    5353  */
    5454
    5555typedef struct t_igmpv1_hdr
    5656{
    57         uint8_t         type;           /* ƒƒbƒZ[ƒW‚ÌŒ^       */
    58         uint8_t         unused;         /* –¢Žg—p                       */
    59         uint16_t        sum;            /* ƒ`ƒFƒbƒNƒTƒ€         */
    60         T_IN4_ADDR      addr;           /* ƒOƒ‹[ƒvƒAƒhƒŒƒX */
    61 } T_IGMPV1_HDR;
     57        uint8_t         type;           /* メッセージの型        */
     58        uint8_t         unused;         /* 未使用                    */
     59        uint16_t        sum;            /* チェックサム           */
     60        T_IN4_ADDR      addr;           /* グループアドレス */
     61}  __attribute__((packed)) T_IGMPV1_HDR;
    6262
    6363/*
    64 *  IGMPv2 ƒwƒbƒ_‚Ì’è‹`ARFC 2236
     64*  IGMPv2 ヘッダの定義、RFC 2236
    6565*/
    6666
    6767typedef struct t_igmpv2_hdr
    6868{
    69         uint8_t         type;           /* ƒƒbƒZ[ƒW‚ÌŒ^       */
    70         uint8_t         time;           /* Å‘剞“šŽžŠÔ         */
    71         uint16_t        sum;            /* ƒ`ƒFƒbƒNƒTƒ€         */
    72         T_IN4_ADDR      addr;           /* ƒOƒ‹[ƒvƒAƒhƒŒƒX */
    73 } T_IGMPV2_HDR;
     69        uint8_t         type;           /* メッセージの型        */
     70        uint8_t         time;           /* 最大応答時間           */
     71        uint16_t        sum;            /* チェックサム           */
     72        T_IN4_ADDR      addr;           /* グループアドレス */
     73}  __attribute__((packed)) T_IGMPV2_HDR;
    7474
    7575typedef struct t_igmpv3_query_hdr
    7676{
    77         uint8_t         type;           /* ƒƒbƒZ[ƒW‚ÌŒ^       */
    78         uint8_t         time;           /* Å‘剞“šŽžŠÔ         */
    79         uint16_t        sum;            /* ƒ`ƒFƒbƒNƒTƒ€         */
    80         T_IN4_ADDR      grpaddr;        /* ƒOƒ‹[ƒvƒAƒhƒŒƒX */
    81         uint8_t         sqrv;           /* Sƒtƒ‰ƒOAQuerier Robustness Value */
     77        uint8_t         type;           /* メッセージの型        */
     78        uint8_t         time;           /* 最大応答時間           */
     79        uint16_t        sum;            /* チェックサム           */
     80        T_IN4_ADDR      grpaddr;        /* グループアドレス */
     81        uint8_t         sqrv;           /* Sフラグ、Querier Robustness Value */
    8282        uint8_t         qqic;           /* Qurier's Query Interval Code */
    83         uint16_t        num;            /* ‘—MŒ³‚̐” */
    84         T_IN4_ADDR      sdraddr;        /* ‘—MŒ³ƒAƒhƒŒƒX */
    85 } T_IGMPV3Q_HDR;
     83        uint16_t        num;            /* 送信å
     84ƒã®æ•° */
     85        T_IN4_ADDR      sdraddr;        /* 送信å
     86ƒã‚¢ãƒ‰ãƒ¬ã‚¹ */
     87}  __attribute__((packed)) T_IGMPV3Q_HDR;
    8688
    8789typedef struct t_igmp_group_record
    8890{
    89         uint8_t         type;           /* ƒƒbƒZ[ƒW‚ÌŒ^       */
    90         uint8_t         len;            /* •â•ƒf[ƒ^’·         */
    91         uint16_t        num;            /* ‘—MŒ³‚̐” */
    92         T_IN4_ADDR      grpaddr;        /* ƒOƒ‹[ƒvƒAƒhƒŒƒX */
    93         T_IN4_ADDR      sdraddr;        /* ‘—MŒ³ƒAƒhƒŒƒX       */
    94                                                         /* •â•ƒf[ƒ^           */
    95 } T_IGMP_GROUP_RECORD;
     91        uint8_t         type;           /* メッセージの型        */
     92        uint8_t         len;            /* 補助データ長           */
     93        uint16_t        num;            /* 送信å
     94ƒã®æ•° */
     95        T_IN4_ADDR      grpaddr;        /* グループアドレス */
     96        T_IN4_ADDR      sdraddr;        /* 送信å
     97ƒã‚¢ãƒ‰ãƒ¬ã‚¹   */
     98                                                        /* 補助データ              */
     99}  __attribute__((packed)) T_IGMP_GROUP_RECORD;
    96100
    97101typedef struct t_igmpv3_report_hdr
    98102{
    99         uint8_t         type;           /* ƒƒbƒZ[ƒW‚ÌŒ^       */
    100         uint8_t         rsv1;           /* —\–ñ                         */
    101         uint16_t        sum;            /* ƒ`ƒFƒbƒNƒTƒ€         */
    102         uint16_t        rsv2;           /* —\–ñ                         */
    103         uint16_t        num;            /* ƒOƒ‹[ƒvƒŒƒR[ƒh‚̐” */
    104         T_IGMP_GROUP_RECORD record;     /* ƒOƒ‹[ƒvƒŒƒR[ƒh */
    105 } T_IGMPV3R_HDR;
    106 
    107 #ifdef __CA850__
    108 #pragma pack(8)
    109 #elif __RX
    110 #pragma unpack
    111 #elif _MSC_VER
    112 #pragma pack(pop)
    113 #endif
     103        uint8_t         type;           /* メッセージの型        */
     104        uint8_t         rsv1;           /* 予約                               */
     105        uint16_t        sum;            /* チェックサム           */
     106        uint16_t        rsv2;           /* 予約                               */
     107        uint16_t        num;            /* グループレコードの数 */
     108        T_IGMP_GROUP_RECORD record;     /* グループレコード */
     109}  __attribute__((packed)) T_IGMPV3R_HDR;
    114110
    115111#define IGMP_HDR_SIZE                   (sizeof(T_IGMPV1_HDR))
     
    125121
    126122/*
    127 ƒƒbƒZ[ƒW‚ÌŒ^
     123メッセージの型
    128124*/
    129125
    130 #define IGMP_MEMBERSHIP_QUERY           0x11    /* ƒƒ“ƒo[ƒVƒbƒvƒNƒGƒŠ[               */
    131 #define IGMP_MEMBERSHIP_REPORT          0x12    /* ƒƒ“ƒo[ƒVƒbƒvƒŒƒ|[ƒg               */
    132 #define IGMP_MEMBERSHIP_REPORT_V2       0x16    /* ƒƒ“ƒo[ƒVƒbƒvƒŒƒ|[ƒg               */
    133 #define IGMP_LEAVE_GROUP                        0x17    /* ƒŠ[ƒuƒOƒ‹[ƒv                               */
    134 #define IGMP_MEMBERSHIP_REPORT_V3       0x22    /* ƒƒ“ƒo[ƒVƒbƒvƒŒƒ|[ƒg               */
     126#define IGMP_MEMBERSHIP_QUERY           0x11    /* メンバーシップクエリー            */
     127#define IGMP_MEMBERSHIP_REPORT          0x12    /* メンバーシップレポート            */
     128#define IGMP_MEMBERSHIP_REPORT_V2       0x16    /* メンバーシップレポート            */
     129#define IGMP_LEAVE_GROUP                        0x17    /* リーブグループ                                */
     130#define IGMP_MEMBERSHIP_REPORT_V3       0x22    /* メンバーシップレポート            */
    135131
    136132/*
    137 *  UDP’ʐM’[“_ƒIƒvƒVƒ‡ƒ“
     133*  UDP通信端点オプション
    138134*/
    139135
     
    168164
    169165/*
    170  *  IGMP ƒOƒ‹[ƒvƒGƒ“ƒgƒŠ
     166 *  IGMP グループエントリ
    171167 */
    172168
    173169typedef struct igmp_entry
    174170{
    175         uint16_t        timer;          /* ‘—M‚Ü‚Å‚ÌŽžŠÔ[•b]   */
    176         uint16_t        resptime;       /* Å‘剞“šŽžŠÔ[•b]     */
    177         T_IN4_ADDR      ip_addr;        /* IP ƒAƒhƒŒƒX                  */
     171        int16_t         timer;          /* 送信までの時間[秒]   */
     172        int16_t         resptime;       /* 最大応答時間[秒]      */
     173        T_IN4_ADDR      ip_addr;        /* IP アドレス                      */
    178174} T_IGMP_ENTRY;
    179175
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/tcp_input.c

    r331 r429  
    521521
    522522                                /* 相手のアドレスをコピーする。*/
     523
     524#if defined(_IP6_CFG) && defined(_IP4_CFG)
     525
     526                                if (cep->flags & TCP_CEP_FLG_IPV4) {
     527                                        (*cep->p_dstaddr4).ipaddr = ntohl(cep->dstaddr.ipaddr.s6_addr32[3]);
     528                                        (*cep->p_dstaddr4).portno = cep->dstaddr.portno;
     529                                        }
     530                                else
     531                                        *cep->p_dstaddr = cep->dstaddr;
     532
     533#else   /* of #if defined(_IP6_CFG) && defined(_IP4_CFG) */
     534
    523535                                *cep->p_dstaddr = cep->dstaddr;
     536
     537#endif  /* of #if defined(_IP6_CFG) && defined(_IP4_CFG) */
    524538
    525539                                if (IS_PTR_DEFINED(cep->callback)) {
     
    847861
    848862                                /* 相手のアドレスをコピーする。*/
     863
     864#if defined(_IP6_CFG) && defined(_IP4_CFG)
     865
     866                                if (cep->flags & TCP_CEP_FLG_IPV4) {
     867                                        (*cep->p_dstaddr4).ipaddr = ntohl(cep->dstaddr.ipaddr.s6_addr32[3]);
     868                                        (*cep->p_dstaddr4).portno = cep->dstaddr.portno;
     869                                        }
     870                                else
     871                                        *cep->p_dstaddr = cep->dstaddr;
     872
     873#else   /* of #if defined(_IP6_CFG) && defined(_IP4_CFG) */
     874
    849875                                *cep->p_dstaddr = cep->dstaddr;
     876
     877#endif  /* of #if defined(_IP6_CFG) && defined(_IP4_CFG) */
    850878
    851879                                if (IS_PTR_DEFINED(cep->callback)) {
     
    13631391        NTOHS(tcph->sport);
    13641392        NTOHS(tcph->dport);
     1393
     1394        /* SDU 長 より 緊急ポインタが大きい場合 */
     1395        if (tcph->urp > tcph->sum)
     1396                goto drop;
    13651397
    13661398find_cep:
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/tcp_output.c

    r331 r429  
    369369                tcph->flags |= TCP_FLG_URG;
    370370                }
    371         else
     371        else {
     372                tcph->urp = 0;
    372373                cep->snd_up  = cep->snd_una;
     374                }
    373375
    374376#endif  /* of #ifdef TCP_CFG_EXTENTIONS */
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/tcp_subr.c

    r331 r429  
    805805
    806806T_TCP_CEP *
    807 tcp_drop (T_TCP_CEP *cep, ER errno)
     807tcp_drop (T_TCP_CEP *cep, ER err)
    808808{
    809809#ifdef SUPPORT_MIB
     
    815815#endif  /* of #ifdef SUPPORT_MIB */
    816816
    817         cep->error = errno;
     817        cep->error = err;
    818818        if (TCP_FSM_HAVE_RCVD_SYN(cep->fsm_state)) {
    819819                cep->fsm_state = TCP_FSM_CLOSED;
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/tcp_timer.h

    r331 r429  
    8686 */
    8787
    88 #define TCP_SLOW_TMO            (ULONG_C(500)/NET_TIMER_CYCLE)  /* 500 [ms]     */
    89 #define TCP_FAST_TMO            (ULONG_C(200)/NET_TIMER_CYCLE)  /* 200 [ms]     */
     88#define TCP_SLOW_TMO            (ULONG_C(500000)/NET_TIMER_CYCLE)       /* 500,000 [us] */
     89#define TCP_FAST_TMO            (ULONG_C(200000)/NET_TIMER_CYCLE)       /* 200,000 [us] */
    9090
    91 #define TCP_SLOW_HZ             (ULONG_C(1000)/TCP_SLOW_TMO/NET_TIMER_CYCLE)    /* Hz   */
     91#define TCP_SLOW_HZ             (ULONG_C(1000000)/TCP_SLOW_TMO/NET_TIMER_CYCLE) /* Hz   */
    9292
    9393/* TCP タイマ値 */
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/tcp_usrreq.c

    r331 r429  
    897897
    898898        /* tcp_rcv_buf の割当て長をリセットする。*/
    899         cep->rcv_buf_len = 0;
     899        cep->rcv_buf_len -= len;
    900900
    901901        /* 通信端点のロックを解除する。*/
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/tcp_var.h

    r331 r429  
    505505        uint8_t         idix;   /* mpfid のインデックス        */
    506506        uint8_t         flags;  /* フラグ          */
     507#ifdef IF_ETHER_MULTI_NIC
     508        uint8_t         conn_pos;
     509#endif
    507510#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    508511        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    817820extern void tcp_init_iss (void);
    818821extern T_TCP_CEP *tcp_close (T_TCP_CEP *cep);
    819 extern T_TCP_CEP *tcp_drop  (T_TCP_CEP *cep, ER errno);
     822extern T_TCP_CEP *tcp_drop  (T_TCP_CEP *cep, ER err);
    820823extern void tcp_respond (T_NET_BUF *nbuf, T_TCP_CEP *cep,
    821824                         T_TCP_SEQ ack, T_TCP_SEQ seq, uint_t rbfree, uint8_t flags);
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/tcpn_usrreq.c

    r331 r429  
    689689                cep->p_myaddr4    = p_myaddr;
    690690                cep->p_dstaddr    = NULL;
    691                 cep->p_myaddr     = NULL;
     691                cep->p_myaddr     = NADR;
    692692
    693693#else   /* of #if API_PROTO == API_PROTO_IPV4 */
    694694
    695695                cep->p_dstaddr4   = NULL;
    696                 cep->p_myaddr4    = NULL;
     696                cep->p_myaddr4    = NADR;
    697697                cep->p_dstaddr    = p_dstaddr;
    698698                cep->p_myaddr     = p_myaddr;
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/udp_output.c

    r331 r429  
    182182#if defined(_IP6_CFG) && TNUM_UDP6_CEPID > 0
    183183
    184                 for (ix = tmax_udp6_cepid; ix -- > 0; ) {
     184                for (ix = TNUM_UDP6_CEPID - 1; ix -- > 0; ) {
    185185
    186186                        if (udp6_cep[ix].flags & UDP_CEP_FLG_POST_OUTPUT) {
     
    194194#if defined(_IP4_CFG) && TNUM_UDP4_CEPID > 0
    195195
    196                 for (ix = tmax_udp4_cepid; ix -- > 0; ) {
     196                for (ix = TNUM_UDP4_CEPID - 1; ix -- > 0; ) {
    197197
    198198                        if (udp4_cep[ix].flags & UDP_CEP_FLG_POST_OUTPUT) {
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/udp_subr.c

    r331 r429  
    146146#define UDP_FIND_CEP            udp6_find_cep
    147147#define UDP_NOTIFY              udp6_notify
    148 #define TMAX_UDP_CEPID          tmax_udp6_cepid
     148#define TMAX_UDP_CEPID          (TNUM_UDP6_CEPID - 1)
    149149#define UDP_CEP                 udp6_cep
    150150#define T_UDP_CEP               T_UDP6_CEP
     
    183183#define UDP_FIND_CEP            udp4_find_cep
    184184#define UDP_NOTIFY              udp4_notify
    185 #define TMAX_UDP_CEPID          tmax_udp4_cepid
     185#define TMAX_UDP_CEPID          (TNUM_UDP4_CEPID - 1)
    186186#define T_UDP_CEP               T_UDP4_CEP
    187187#define UDP_CEP                 udp4_cep
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/udp_var.h

    r331 r429  
    101101typedef ER      (*t_udp_callback)(ID cepid, FN fncd, void *p_parblk);
    102102
     103typedef struct t_udp_rcv_dat_para {
     104        uint_t          len;
     105        T_NET_BUF       *input;
     106        uint_t          off;
     107        union {
     108                T_IPV4EP rep4;
     109                T_IPV6EP rep6;
     110        };
     111        } T_UDP_RCV_DAT_PARA;
     112
    103113/*
    104114 *  UDP 通信端点
     
    141151#endif
    142152
     153#ifdef SUPPORT_IGMP
     154        bool_t igmp_loopback;
     155        uint8_t igmp_ttl;
     156        T_IN4_ADDR      igmp_mcaddr;    /*  */
     157#endif
     158
    143159        } T_UDP6_CEP;
    144160
     
    178194        ER              error;          /* 待ち中に発生したエラー  */
    179195#endif
     196
    180197#ifdef SUPPORT_IGMP
    181198        bool_t igmp_loopback;
     
    183200        T_IN4_ADDR      igmp_mcaddr;    /*  */
    184201#endif
     202
    185203        } T_UDP4_CEP;
    186204
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/udpn_input.c

    r331 r429  
    8888{
    8989        T_UDP_HDR       *udph;
    90         uint_t          len;
     90        T_UDP_RCV_DAT_PARA para;
    9191
    9292        udph = (T_UDP_HDR *)(input->buf + off);
    93         len  = (uint_t)(ntohs(udph->ulen) - UDP_HDR_SIZE);
     93        para.len  = (uint_t)(ntohs(udph->ulen) - UDP_HDR_SIZE);
    9494
    9595        if (cep->rcv_tskid != TA_NULL) {        /* 非ノンブロッキングコールでペンディング中 */
     
    111111                /* データをバッファに移す。*/
    112112                memcpy(cep->rcv_data, GET_UDP_SDU(input, off),
    113                        (size_t)(len < cep->rcv_len ? len : cep->rcv_len));
     113                       (size_t)(para.len < cep->rcv_len ? para.len : cep->rcv_len));
    114114                syscall(rel_net_buf(input));
    115115
     
    117117
    118118#ifdef TCP_CFG_NON_BLOCKING_COMPAT14
    119                         (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)(uint32_t)len);
     119                        (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)(uint32_t)para.len);
    120120#else
    121                         (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&len);
     121                        (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&para.len);
    122122#endif
    123123                else
     
    134134
    135135#ifdef TCP_CFG_NON_BLOCKING_COMPAT14
    136                 (*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)(uint32_t)len);
     136                (*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)(uint32_t)para.len);
    137137#else
    138                 (*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)&len);
     138                para.input = input;
     139                para.off = off;
     140#if API_PROTO == API_PROTO_IPV4
     141                para.rep4.portno = ntohs(udph->sport);
     142                IN_COPY_TO_HOST(&para.rep4.ipaddr, input);
     143#else
     144                para.rep6.portno = ntohs(udph->sport);
     145                IN_COPY_TO_HOST(&para.rep6.ipaddr, input);
     146#endif
     147                (*cep->callback)(GET_UDP_CEPID(cep), TEV_UDP_RCV_DAT, (void*)&para.len);
    139148#endif
    140149                /*
     
    143152                 *  データを読み出さなかったことになるので、捨てる。
    144153                 */
    145                 if (cep->cb_netbuf != NULL)
    146                         syscall(rel_net_buf(cep->cb_netbuf));
     154                if (cep->cb_netbuf != NULL) {
     155                        if ((input->flags & NB_FLG_NOREL_IFOUT) == 0)
     156                                syscall(rel_net_buf(cep->cb_netbuf));
     157                        cep->cb_netbuf = NULL;
     158                        }
    147159                }
    148160        else {
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/udpn_usrreq.c

    r331 r429  
    322322                else
    323323                        error = UDP_ALLOC_PORT(cep, pk_ccep->myaddr.portno);
    324                
    325                 if (error == E_OK) {
    326 
    327                         /* UDP 通信端点生成æƒ
     324
     325                        if (error == E_OK) {
     326                                /* UDP 通信端点生成æƒ
    328327報をコピーする。*/
    329                         cep->cepatr        = pk_ccep->cepatr;                   /* 通信端点属性           */
    330                         cep->myaddr.ipaddr = pk_ccep->myaddr.ipaddr;            /* 自分のアドレス        */
    331                         cep->callback      = (void*)pk_ccep->callback;          /* コールバック           */
    332 
    333                         /* UDP 通信端点を生成済みにする。*/
    334                         cep->flags |= UDP_CEP_FLG_VALID;
    335                         }
    336                 }
     328                                cep->cepatr        = pk_ccep->cepatr;                   /* 通信端点属性           */
     329                                cep->myaddr.ipaddr = pk_ccep->myaddr.ipaddr;            /* 自分のアドレス        */
     330                                cep->callback      = (void*)pk_ccep->callback;          /* コールバック           */
     331
     332                                /* UDP 通信端点を生成済みにする。*/
     333                                cep->flags |= UDP_CEP_FLG_VALID;
     334                                }
     335                        }
    337336
    338337        /* 通信端点のロックを解除する。*/
     
    426425                return E_NOEXS;
    427426#if defined(SUPPORT_INET6)
    428 #endif
    429 #if defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
     427#elif defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
    430428        switch (optname) {
    431429        case IP_MULTICAST_LOOP:
     
    503501                return E_NOEXS;
    504502#if defined(SUPPORT_INET6)
    505 #endif
    506 #if defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
     503#elif defined(SUPPORT_INET4) && defined(SUPPORT_IGMP) && TNUM_UDP4_CEPID > 0
    507504        switch (optname) {
    508505        case IP_MULTICAST_LOOP:
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/udpn_usrreq_nblk.c

    r331 r429  
    136136
    137137#ifdef TCP_CFG_NON_BLOCKING_COMPAT14
    138                         (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)error);
     138                        (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_CAN_CEP, (void*)error);
    139139#else
    140                         (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_RCV_DAT, (void*)&error);
     140                        (*cep->callback)(GET_UDP_CEPID(cep), TFN_UDP_CAN_CEP, (void*)&error);
    141141#endif
    142142                else
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/in6_subr.c

    r331 r429  
    369369
    370370        /* IPv6 ヘッダを設定する。*/
    371         if ((error = in6_set_header(*nbuf, len, dstaddr, srcaddr, next, hlim)) != E_OK)
     371        if ((error = in6_set_header(*nbuf, len, dstaddr, srcaddr, next, hlim)) != E_OK) {
     372                syscall(rel_net_buf(*nbuf));
     373                *nbuf = NULL;
    372374                return error;
     375                }
    373376
    374377        /* 4 オクテット境界までパディングで埋める。*/
     
    662665 *  in6_rtredirect -- ルーティング表にエントリを登録する。
    663666 *
    664  *    注意: 引数 tmo の単位は [ms]。
     667 *    注意: 引数 tmo の単位は [us]。
    665668 */
    666669
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/in6_var.h

    r331 r429  
    184184         * vltime と pltime は、追加/変更してからの相対時間
    185185         */
    186         uint32_t        vltime;         /* 有効時間 [ms]                    */
    187         uint32_t        pltime;         /* 推奨有効時間 [ms]          */
     186        uint32_t        vltime;         /* 有効時間 [us]                    */
     187        uint32_t        pltime;         /* 推奨有効時間 [us]          */
    188188        } __attribute__((packed, aligned(2)))T_IN6_ADDR_LIFETIME;
    189189
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/ip6_var.h

    r331 r429  
    152152        uint8_t         idix;   /* mpfid のインデックス        */
    153153        uint8_t         unit;   /* インタフェース番号    */
     154#ifdef IF_ETHER_MULTI_NIC
     155        uint8_t         conn_pos;
     156#endif
    154157#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    155158        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    172175        uint8_t         idix;   /* mpfid のインデックス        */
    173176        uint8_t         flags;  /* フラグ          */
     177#ifdef IF_ETHER_MULTI_NIC
     178        uint8_t         conn_pos;
     179#endif
    174180#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    175181        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
     
    224230        uint8_t         idix;   /* mpfid のインデックス        */
    225231        uint8_t         flags;  /* フラグ          */
     232#ifdef IF_ETHER_MULTI_NIC
     233        uint8_t         conn_pos;
     234#endif
    226235#ifdef IF_ETHER_NIC_NET_BUF_ALIGN
    227236        uint8_t         nalign[IF_ETHER_NIC_NET_BUF_ALIGN];
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/nd6.c

    r331 r429  
    353353                        if (nd6_cache[mix].hold != NULL) {
    354354                                syscall(rel_net_buf(nd6_cache[mix].hold));
     355                                nd6_cache[mix].hold = NULL;
    355356                                }
    356357                        fix = mix;
     
    562563                        if (ln->hold != NULL) {
    563564                                syscall(rel_net_buf(ln->hold));
     565                                ln->hold = NULL;
    564566                                }
    565567
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/nd6.h

    r331 r429  
    8181        T_NET_BUF       *hold;
    8282        TMO             tmout;
    83         SYSTIM          expire;         /* [ms] 有効時間が切れる時刻      */
     83        SYSTIM          expire;         /* [us] 有効時間が切れる時刻      */
    8484        T_IF_ADDR       ifaddr;
    8585        uint8_t         state;
     
    183183typedef struct t_def_router {
    184184        T_IN6_ADDR      addr;
    185         SYSTIM          expire;         /* [ms] 有効時間が切れる時刻      */
    186         uint32_t        lifetime;       /* [ms] 有効時間                    */
     185        SYSTIM          expire;         /* [us] 有効時間が切れる時刻      */
     186        uint32_t        lifetime;       /* [us] 有効時間                    */
    187187        uint16_t        plistmap;       /* プレフィックスマップ           */
    188188        uint8_t         flags;          /* ルータ通知のフラグ            */
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/nd6_rtr.c

    r331 r429  
    999999                return;
    10001000
    1001         /* ルータ要請ヘッダを設定する。*/
    1002         rsh = GET_ROUTER_SOLICIT_HDR(output, IF_IP6_ROUTER_SOLICIT_HDR_OFFSET);
    1003         rsh->hdr.type       = ND_ROUTER_SOLICIT;
    1004         rsh->hdr.code       = 0;
    1005         rsh->nd_rs_reserved = 0;
     1001        /* ルータ要請ヘッダを設定する。*/
     1002        rsh = GET_ROUTER_SOLICIT_HDR(output, IF_IP6_ROUTER_SOLICIT_HDR_OFFSET);
     1003        rsh->hdr.type       = ND_ROUTER_SOLICIT;
     1004        rsh->hdr.code       = 0;
     1005        rsh->nd_rs_reserved = 0;
    10061006
    10071007        /* チェックサムを計算する。*/
  • EcnlProtoTool/trunk/asp3_dcre/tinet/tcpip_sym.def

    r331 r429  
    1515TMO_UDP_OUTPUT
    1616TMO_ICMP_OUTPUT
     17TMO_IGMP_OUTPUT
    1718TMO_ND6_NS_OUTPUT
    1819TMO_ND6_NA_OUTPUT
  • EcnlProtoTool/trunk/asp3_dcre/tinet/tinet.trb

    r331 r429  
    124124#include <net/ethernet.h>
    125125#include <net/net.h>
     126#include <net/net_endian.h>
    126127#include <net/net_buf.h>
    127128#include <netinet/in.h>
     
    142143$tinetCfgC.add(" */")
    143144$tinetCfgC.add()
    144 $includeFiles.each do |file|
    145   $tinetCfgC.add("#include #{file}")
    146 end
     145GenerateIncludes($tinetCfgC)
    147146
    148147$tinetCfgC.add()
  • EcnlProtoTool/trunk/asp3_dcre/tinet/tinet_asp.cfg

    r331 r429  
    7373INCLUDE("netinet/if_ether.cfg");
    7474INCLUDE("netinet/ip.cfg");
     75INCLUDE("netinet/ip_igmp.cfg");
    7576INCLUDE("netinet/tcp.cfg");
    7677INCLUDE("netinet/udp.cfg");
  • EcnlProtoTool/trunk/asp3_dcre/utils/applyrename.rb

    r321 r429  
    77#  Copyright (C) 2003 by Embedded and Real-Time Systems Laboratory
    88#                              Toyohashi Univ. of Technology, JAPAN
    9 #  Copyright (C) 2004-2016 by Embedded and Real-Time Systems Laboratory
     9#  Copyright (C) 2004-2017 by Embedded and Real-Time Systems Laboratory
    1010#              Graduate School of Information Science, Nagoya Univ., JAPAN
    1111#
     
    3939#  の責任を負わない.
    4040#
    41 #  $Id$
     41#  $Id: applyrename.rb 852 2017-11-04 16:19:49Z ertl-hiro $
    4242#
    4343
     44Encoding.default_external = 'utf-8'
    4445require "fileutils"
    4546
  • EcnlProtoTool/trunk/asp3_dcre/utils/genrename.rb

    r321 r429  
    77#  Copyright (C) 2003 by Embedded and Real-Time Systems Laboratory
    88#                              Toyohashi Univ. of Technology, JAPAN
    9 #  Copyright (C) 2005-2016 by Embedded and Real-Time Systems Laboratory
     9#  Copyright (C) 2005-2017 by Embedded and Real-Time Systems Laboratory
    1010#              Graduate School of Information Science, Nagoya Univ., JAPAN
    1111#
     
    3939#  の責任を負わない.
    4040#
    41 #  $Id$
     41#  $Id: genrename.rb 852 2017-11-04 16:19:49Z ertl-hiro $
    4242#
     43
     44Encoding.default_external = 'utf-8'
    4345
    4446#
     
    132134    fileName = $1.sub(/([>"])$/, "_rename.h\\1")
    133135    includes += "#include #{fileName}\n"
     136  elsif /^(_+)(.*)$/ =~ sym
     137    generateDefine(outFile, $2, $1)
    134138  elsif sym != ""
    135139    generateDefine(outFile, sym, "")
  • EcnlProtoTool/trunk/asp3_dcre/utils/gentest.rb

    r331 r429  
    55#      Toyohashi Open Platform for Embedded Real-Time Systems
    66#
    7 #  Copyright (C) 2007-2016 by Embedded and Real-Time Systems Laboratory
     7#  Copyright (C) 2007-2019 by Embedded and Real-Time Systems Laboratory
    88#              Graduate School of Information Science, Nagoya Univ., JAPAN
    99#
     
    4444#
    4545       
     46Encoding.default_external = 'utf-8'
     47require "pp"
     48require "fileutils"
     49
    4650#
    4751#  生成動作を決めるための設定
     
    6771  "ref_mtx" => { 2 => "T_RMTX" },
    6872  "ref_mbf" => { 2 => "T_RMBF" },
     73  "ref_spn" => { 2 => "T_RSPN" },
    6974  "get_mpf" => { 2 => "void *" },
    7075  "pget_mpf" => { 2 => "void *" },
     
    7782  "get_tid" => { 1 => "ID" },
    7883  "get_did" => { 1 => "ID" },
     84  "get_pid" => { 1 => "ID" },
    7985  "get_lod" => { 2 => "uint_t" },
    8086  "mget_lod" => { 3 => "uint_t" },
    8187  "get_nth" => { 3 => "ID" },
    8288  "mget_nth" => { 4 => "ID" },
     89  "ref_mem" => { 2 => "T_RMEM" },
    8390  "get_ipm" => { 1 => "PRI" },
    8491  "get_som" => { 1 => "ID" }
     
    8693
    8794$functionParameters = {
    88   "target_hrt_set_event" => "HRTCNT hrtcnt"
     95  "target_hrt_set_event" => "HRTCNT hrtcnt",
     96  "hook_hrt_set_event" => "HRTCNT hrtcnt"
    8997}
    9098 
     
    98106 
    99107$functionCheckParameter = {
    100   "target_hrt_set_event" => "hrtcnt"
     108  "target_hrt_set_event" => "hrtcnt",
     109  "hook_hrt_set_event" => "hrtcnt"
    101110}
    102111
     
    154163    lines.each do |line|
    155164      @code[@currentCount].push(line)
    156         end
     165    end
    157166  end
    158167
     
    174183    # 処理カウント変数の生成
    175184    if @countFlag
    176       print("\nstatic uint_t\t#{@count_var} = 0;\n")
     185      $outFile.print("\nstatic uint_t\t#{@count_var} = 0;\n")
    177186    end
    178187
     
    180189    case @puName
    181190    when /^TASK([0-9]*)$/
    182       print("\nvoid\n")
    183       print("task#{$1}(intptr_t exinf)\n")
     191      $outFile.print("\nvoid\n")
     192      $outFile.print("task#{$1}(intptr_t exinf)\n")
    184193    when /^CYC([0-9]*)$/
    185       print("\nvoid\n")
    186       print("cyclic#{$1}_handler(intptr_t exinf)\n")
     194      $outFile.print("\nvoid\n")
     195      $outFile.print("cyclic#{$1}_handler(intptr_t exinf)\n")
    187196    when /^ALM([0-9]*)$/
    188       print("\nvoid\n")
    189       print("alarm#{$1}_handler(intptr_t exinf)\n")
     197      $outFile.print("\nvoid\n")
     198      $outFile.print("alarm#{$1}_handler(intptr_t exinf)\n")
    190199    when /^OVR$/
    191       print("\nvoid\n")
    192       print("overrun_handler(ID tskid, intptr_t exinf)\n")
     200      $outFile.print("\nvoid\n")
     201      $outFile.print("overrun_handler(ID tskid, intptr_t exinf)\n")
    193202    when /^ISR([0-9]*)$/
    194       print("\nvoid\n")
    195       print("isr#{$1}(intptr_t exinf)\n")
     203      $outFile.print("\nvoid\n")
     204      $outFile.print("isr#{$1}(intptr_t exinf)\n")
    196205    when /^INTHDR([0-9]*)$/
    197       print("\nvoid\n")
    198       print("inthdr#{$1}_handler(void)\n")
     206      $outFile.print("\nvoid\n")
     207      $outFile.print("inthdr#{$1}_handler(void)\n")
    199208    when /^CPUEXC([0-9]*)$/
    200       print("\nvoid\n")
    201       print("cpuexc#{$1}_handler(void *p_excinf)\n")
     209      $outFile.print("\nvoid\n")
     210      $outFile.print("cpuexc#{$1}_handler(void *p_excinf)\n")
    202211    when /^EXTSVC([0-9]*)$/
    203       print("\nER_UINT\n")
    204       print("extsvc#{$1}_routine")
    205       print("(intptr_t par1, intptr_t par2, intptr_t par3,\n")
    206       print("\t\t\t\t\t\t\t\tintptr_t par4, intptr_t par5, ID cdmid)\n")
     212      $outFile.print("\nER_UINT\n")
     213      $outFile.print("extsvc#{$1}_routine")
     214      $outFile.print("(intptr_t par1, intptr_t par2, intptr_t par3,\n")
     215      $outFile.print("\t\t\t\t\t\t\t\tintptr_t par4, intptr_t par5, ID cdmid)\n")
    207216    else
    208217      if $functionValue[@puName]
    209         print("\n#{$functionValue[@puName]}\n")
     218        $outFile.print("\n#{$functionValue[@puName]}\n")
    210219      else
    211         print("\nvoid\n")
    212       end
    213       print(@puName)
     220        $outFile.print("\nvoid\n")
     221      end
     222      $outFile.print(@puName)
    214223      if $functionParameters[@puName]
    215         print("(#{$functionParameters[@puName]})\n")
     224        $outFile.print("(#{$functionParameters[@puName]})\n")
    216225      else
    217         print("(void)\n")
    218       end
    219     end
    220 
    221     print("{\n")
     226        $outFile.print("(void)\n")
     227      end
     228    end
     229
     230    $outFile.print("{\n")
    222231
    223232    @variableList.each do |varName, varType|
    224233      if /^(.+)\w*\*$/ =~ varType
    225234        varBaseType = $1
    226         print("\t#{varBaseType}")
    227         print(varBaseType.length < 4 ? "\t\t*" : "\t*")
     235        $outFile.print("\t#{varBaseType}")
     236        $outFile.print(varBaseType.length < 4 ? "\t\t*" : "\t*")
    228237      else
    229         print("\t#{varType}")
    230         print(varType.length < 4 ? "\t\t" : "\t")
    231       end
    232       print("#{varName};\n")
     238        $outFile.print("\t#{varType}")
     239        $outFile.print(varType.length < 4 ? "\t\t" : "\t")
     240      end
     241      $outFile.print("#{varName};\n")
    233242    end
    234243    if @silFlag
    235       print("\tSIL_PRE_LOC;\n")
    236     end
    237     print("\n")
     244      $outFile.print("\tSIL_PRE_LOC;\n")
     245    end
     246    $outFile.print("\n")
    238247
    239248    if @countFlag
    240       print("\tswitch (++#{@count_var}) {\n")
     249      $outFile.print("\tswitch (++#{@count_var}) {\n")
    241250      @code.keys.sort_by { |c| c.to_i }.each do |count|
    242         print("\tcase #{count}:\n")
     251        $outFile.print("\tcase #{count}:\n")
    243252        @code[count].each do |line|
    244           print("\t",line) if line != ""
    245           print("\n")
     253          $outFile.print("\t",line) if line != ""
     254          $outFile.print("\n")
    246255        end
    247         print("\t\tcheck_point(0);\n\n")
    248       end
    249       print("\tdefault:\n")
    250       print("\t\tcheck_point(0);\n")
    251       print("\t}\n")
     256        $outFile.print("\t\tcheck_assert(false);\n\n")
     257      end
     258      $outFile.print("\tdefault:\n")
     259      $outFile.print("\t\tcheck_assert(false);\n")
     260      $outFile.print("\t}\n")
    252261    else
    253262      @code[""].each do |line|
    254         print(line,"\n")
    255       end
    256     end
    257 
    258     print("\tcheck_point(0);\n")
     263        $outFile.print(line,"\n")
     264      end
     265    end
     266
     267    $outFile.print("\tcheck_assert(false);\n")
    259268    if /^EXTSVC([0-9]*)$/ =~ @puName
    260       print("\treturn(E_SYS);\n")
     269      $outFile.print("\treturn(E_SYS);\n")
    261270    elsif $functionReturn[@pu_nama]
    262       print("\treturn(#{$functionReturn[@puName]});\n")
    263     end
    264     print("}\n")
     271      $outFile.print("\treturn(#{$functionReturn[@puName]});\n")
     272    end
     273    $outFile.print("}\n")
    265274  end
    266275end
     
    303312def testStartCode(pu)
    304313  # テスト開始コードは一度のみ出力する
    305   if $startFlag == 0
     314  if !$startFlag
    306315    pu.append("\ttest_start(__FILE__);", "")
    307     $startFlag = 1
     316    $startFlag = true
    308317  end
    309318end
     
    312321#  ターゲット依存部関数の振る舞いの読み込み
    313322#
    314 def targetFunction(line, checkNum)
     323def targetFunction(line, checkNum, prcid)
    315324  if /^([a-zA-Z_]+)\s*(.*)$/ =~ line
    316325    functionName = $1
     
    333342  end
    334343
    335   pu.append("\tcheck_point(#{checkNum});");
     344  pu.append("\tcheck_point#{$cpSuffix[prcid]}(#{checkNum});");
    336345  if param && $functionCheckParameter[functionName]
    337346    pu.append(sprintf("\tcheck_assert(%s == %s);",
     
    347356
    348357#
     358#  チェックポイント番号の処理
     359#
     360def procCheckPoint(prcid, originalCheckNum, oline_list)
     361  checkNum = ($lastCheckPoint[prcid] += 1).to_s
     362  oline_list.each do |oline|
     363    oline.sub!(/#{originalCheckNum}/, "#{checkNum}:")
     364  end
     365  return(checkNum)
     366end
     367
     368#
    349369#  テストスクリプトの読み込み
    350370#
    351 def parseLine(line)
    352   if /^==\s*(([a-zA-Z_]+)[0-9]*)(.*)$/ =~ line
     371def parseLine(line, prcid, oline_list)
     372  if /^==\s*START(_[a-zA-Z0-9]+)?(.*)$/ =~ line
     373    $procFlag = true unless $procFlagEnd
     374    $cpSuffix[prcid] = $1
     375  elsif /^==\s*(([a-zA-Z_]+)[0-9]*)(.*)$/ =~ line
    353376    # 処理単位の開始
    354     $procFlag = 1
     377    $procFlag = true unless $procFlagEnd
    355378    puName = $1
    356379    line2 = $3
     
    359382      pu = $puList[puName] = PUCode.new(puName)
    360383    end
    361     $currentPu = pu
     384    $currentPu[prcid] = pu
    362385
    363386    case line2
     
    369392      pu.setCount("")
    370393    end
    371     testStartCode(pu) if /^START/ !~ puName
    372   elsif $procFlag != 0
    373     pu = $currentPu
     394    testStartCode(pu)
     395  elsif $procFlag
     396    pu = $currentPu[prcid]
    374397    if /^([0-9]+\:)\s*(.*)$/ =~ line
    375398      # チェックポイント番号の処理
    376       originalCheckNum = $1
    377399      line = $2
    378       checkNum = ($lastCheckPoint += 1).to_s
    379       $outputLine.sub!(/#{originalCheckNum}/, "#{checkNum}:")
     400      checkNum = procCheckPoint(prcid, $1, oline_list)
    380401
    381402      case line
    382403      when /^END$/
    383         pu.append("\tcheck_finish(#{checkNum});")
    384         $procFlag = 0
     404        pu.append("\tcheck_finish#{$cpSuffix[prcid]}(#{checkNum});")
     405        $procFlagEnd = true
    385406        return
    386407      when /^HOOK\((.*)\)$/
     
    388409        return
    389410      when /^\[(.*)\]$/
    390         targetFunction($1, checkNum)
     411        targetFunction($1, checkNum, prcid)
    391412        return
    392413      else
    393         pu.append("\tcheck_point(#{checkNum});")
     414        pu.append("\tcheck_point#{$cpSuffix[prcid]}(#{checkNum});")
    394415      end
    395416    end
     
    402423      pu.append("\t#{call_string};", "")
    403424      pu.useSil() if /^SIL_..._INT\(\)$/ =~ call_string
     425    when /^VAR\(\s*(.*)\s+(.*)\s*\)$/
     426      pu.addVariable($2, $1)
    404427    when /^RETURN((\(.*\))?)$/
    405428      pu.append("\treturn#{$1};", "")
     
    409432    when /^LABEL\((.*)\)$/
    410433      pu.append("#{$1}:", "")
     434    when /^BARRIER\((.*)\)$/
     435      pu.append("\ttest_barrier(#{$1});", "")
     436    when /^((SET|RESET|WAIT|WAIT_WO_RESET|WAIT_RESET)\(.*\))$/
     437      pu.append("\t#{$1};", "")
    411438    when /^([a-z_]+\(.*\))\s*(\-\>\s*([A-Za-z0-9_]*))?\s*$/
    412439      genServiceCall(pu, $1, $3)
     
    428455#
    429456inFileName = ARGV.shift
     457outFileName = inFileName + ".new"
    430458
    431459#
    432460#  スクリプトファイル読み込み処理
    433461#
    434 $lastCheckPoint = 0             # 最後のチェックポイント番号
    435 $procFlag = 0                           # スクリプト処理中フラグ
    436 $startFlag = 0                  # テスト開始コードの出力フラグ
    437 $currentPu = nil                        # 読み込み中の処理単位
    438 $puList = {}                            # 処理単位のリスト
     462$procFlag = false                                       # スクリプト処理中フラグ
     463$procFlagEnd = false                            # スクリプト処理終了フラグ
     464$startFlag = false                                      # テスト開始コードの出力フラグ
     465$currentPu = {}                                         # 読み込み中の処理単位
     466$puList = {}                                            # 処理単位のリスト
     467$outputLines = []                                       # 出力すべき行のリストのリスト
     468$cpSuffix = Hash.new("")                        # チェックポイント関数のサフィックス
     469$lastCheckPoint = Hash.new(0)           # 最後のチェックポイント番号
    439470
    440471begin
    441472  inFile = File.open(inFileName)
     473  $outFile = File.open(outFileName, "w")
    442474rescue Errno::ENOENT, Errno::EACCES => ex
    443475  abort(ex.message)
    444476end
    445477
     478statements = Hash.new("")
     479oline_lists = Hash.new([])
    446480while line = inFile.gets do
    447   $outputLine = line.dup
    448   line.chomp!
    449   line.sub!(/^\s*\*\s*/, "")
    450   line.sub!(/\s*\/\/.*$/, "")
    451   line.sub!(/\s*\.\.\..*$/, "")
    452 
    453   while line.sub!(/\\$/, "") do
    454     line1 = inFile.gets
    455     $outputLine += line1.dup
    456     line1.chomp!
    457     line1.sub!(/^\s*\*\s*/, "")
    458     line1.sub!(/\s*\/\/.*$/, "")
    459     line1.sub!(/\s*\.\.\..*$/, "")
    460     line += line1
    461   end
    462   parseLine(line) if line != ""
    463   print($outputLine)
    464   break if /DO NOT DELETE THIS LINE/ =~ $outputLine
     481  line.chomp!                                                                   # 末尾の改行の削除
     482  if /DO NOT DELETE THIS LINE/ =~ line
     483    $outputLines.push([ line ])
     484    break
     485  elsif line =~ /^(\s*\*)(.*)$/                                 # 行頭のスペースと "*" の削除
     486    outputLine = [ $1.dup ]
     487    $2.split(/|/, -1).each_with_index do |sline, index|
     488      outLine = sline.dup
     489      outputLine.push(outLine)
     490      sline.sub!(/^\s*/, "")                                    # 先頭のスペースの削除
     491      sline.sub!(/\/\/.*$/, "")                                 # // コメントの削除
     492      sline.sub!(/\.\.\..*$/, "")                               # ... コメントの削除
     493
     494      prcid = index + 1
     495      statements[prcid] += sline
     496      oline_lists[prcid].push(outLine)
     497      next if statements[prcid].sub!(/\\\s*$/, "")              # 継続行の場合
     498
     499      statements[prcid].sub!(/\s*$/, "")                # 末尾のスペースの削除
     500      if sline !~ /^\s*$/
     501        parseLine(statements[prcid], prcid, oline_lists[prcid])
     502      end
     503      statements[prcid] = ""
     504      oline_lists[prcid] = []
     505    end
     506    $outputLines.push(outputLine)
     507    $procFlag = false if $procFlagEnd
     508  else
     509    $outputLines.push([ line ])
     510  end
     511end
     512$outputLines.each do |outputLine|
     513  outputLine.each_with_index do |sline, index|
     514    $outFile.print("|") if index > 1
     515    $outFile.print(sline);
     516  end
     517  $outFile.print("\n");
    465518end
    466519
     
    471524  $puList[puName].generateCode()
    472525end
     526
     527#
     528#  ファイルの置き換え
     529#
     530FileUtils.move(inFileName, inFileName + ".bak")
     531FileUtils.move(outFileName, inFileName)
  • EcnlProtoTool/trunk/asp3_dcre/utils/makerelease.rb

    r321 r429  
    55#      Toyohashi Open Platform for Embedded Real-Time Systems
    66#
    7 #  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     7#  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    88#              Graduate School of Information Science, Nagoya Univ., JAPAN
    99#
     
    4040#
    4141
     42require "optparse"
     43require "fileutils"
    4244require "shell"
     45
     46#
     47#  オプションの定義
     48#
     49#  -e <dirname>                 アーカイブファイルを展開して削除する.dirname
     50#                                               は展開するディレクトリ名(省略可能).
     51
     52#
     53#  オプションの処理
     54#
     55OptionParser.new("Usage: makerelease.rb [options] MANIFEST-FILE") do |opt|
     56  opt.on("-e [dirname]",        "expand archive file and delete") do |val|
     57    $expandDirname = val
     58  end
     59  opt.parse!(ARGV)
     60end
    4361
    4462#
     
    108126    else
    109127      fileName = $prefix + "/" + canonicalPath(baseDirectory + line)
    110       if !File.file?("../" + fileName)
    111         abort("#{fileName} is not a file.")
     128      if !File.file?("../" + fileName) && !File.directory?("../" + fileName)
     129        abort("#{fileName} is not a file or a directory.")
    112130      elsif $fileList.index(fileName)
    113131        abort("#{fileName} is duplicated.")
     
    167185archiveName = $package + "-" + $version + ".tar.gz"
    168186fileListStr = $fileList.join(" ")
    169 command = "tar cvfz RELEASE/#{archiveName} -C .. #{fileListStr}\n";
     187command = "tar cvfz RELEASE/#{archiveName} -C .. #{fileListStr}";
    170188system(command)
    171 puts("== RELEASE/#{archiveName} is generated. ==\n")
     189puts("== RELEASE/#{archiveName} is generated. ==")
     190
     191#
     192#  アーカイブファイルの展開と削除
     193#
     194if defined?($expandDirname)
     195  command = "tar xf RELEASE/#{archiveName}; rm RELEASE/#{archiveName}";
     196  system(command)
     197
     198  dirname = $expandDirname || $prefix
     199  if File.exist?(dirname)
     200    File.rename(dirname, dirname + ".bak")
     201    puts("== '#{dirname}' is renamed to '#{dirname}.bak'. ==")
     202  end
     203  if !$expandDirname.nil?
     204    File.rename($prefix, $expandDirname)
     205  end
     206  puts("== RELEASE/#{archiveName} is expanded to '#{dirname}'. ==")
     207  puts("== RELEASE/#{archiveName} is deleted. ==")
     208end
  • EcnlProtoTool/trunk/mbed_api/.cproject

    r426 r429  
    2222                                <option id="toolchain.id" value="gcc-arm-embedded"/>
    2323                                <option id="toolchain.version" value="6.3.1.20170620"/>
     24                                <option id="toolchain.enable" value="false"/>
    2425                        </storageModule>
    2526                        <storageModule moduleId="cdtBuildSystem" version="4.0.0">
     
    6869                                                                        <listOptionValue builtIn="false" value="&quot;${ProjDirPath}/src&quot;"/>
    6970                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/musl-1.1.18/include}&quot;"/>
     71                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/asp3_dcre/mbed}&quot;"/>
    7072                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/asp3_dcre/mbed/common}&quot;"/>
    71                                                                         <listOptionValue builtIn="false" value="&quot;${workspace_loc:/asp3_dcre/mbed/api}&quot;"/>
     73                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/asp3_dcre/mbed/platform}&quot;"/>
    7274                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/asp3_dcre/mbed/hal}&quot;"/>
    7375                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/include}&quot;"/>
     
    142144                </configuration>
    143145        </storageModule>
     146        <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
    144147</cproject>
  • EcnlProtoTool/trunk/mbed_api/src/mbed_api.c

    r331 r429  
    310310}
    311311
    312 #include "assert.c"
    313 #include "board.c"
    314 #include "error.c"
    315 #include "gpio.c"
    316 #include "lp_ticker_api.c"
     312void hal_critical_section_enter(void)
     313{
     314}
     315
     316void hal_critical_section_exit(void)
     317{
     318}
     319
     320void us_ticker_fire_interrupt(void)
     321{
     322}
     323
     324void us_ticker_free(void)
     325{
     326}
     327
     328//#include <pinmap.h>
     329#define LED1 109
     330#include "mbed_assert.c"
     331#include "mbed_board.c"
     332#include "mbed_critical.c"
     333#include "mbed_error.c"
     334#include "mbed_gpio.c"
     335#include "mbed_lp_ticker_api.c"
    317336#include "mbed_interface.c"
    318 #include "pinmap_common.c"
    319 //#include "rtc_time.c"
    320 #include "semihost_api.c"
    321 #include "ticker_api.c"
    322 #include "us_ticker_api.c"
    323 #include "wait_api.c"
     337#include "mbed_pinmap_common.c"
     338//#include "mbed_rtc_time.c"
     339#include "mbed_semihost_api.c"
     340#include "mbed_ticker_api.c"
     341#include "mbed_us_ticker_api.c"
     342#include "mbed_wait_api_no_rtos.c"
     343
     344const ticker_info_t *us_ticker_get_info(void)
     345{
     346        return NULL;
     347}
  • EcnlProtoTool/trunk/ntshell/Debug/Makefile

    r427 r429  
    66#  Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
    77#                              Toyohashi Univ. of Technology, JAPAN
    8 #  Copyright (C) 2006-2016 by Embedded and Real-Time Systems Laboratory
     8#  Copyright (C) 2006-2019 by Embedded and Real-Time Systems Laboratory
    99#              Graduate School of Information Science, Nagoya Univ., JAPAN
    1010#
     
    9696
    9797#
     98#  システムサービスコールライブラリ(libsyssvc.a)のディレクトリ名
     99#  (システムサービスコールライブラリもmake対象にする時は,空に定義する)
     100#
     101SYSSVC_LIB = ../../asp3_dcre/Debug
     102
     103#
    98104#  カーネルを関数単位でコンパイルするかどうかの定義
    99105#
     
    104110#
    105111OMIT_TECS =
     112
     113#
     114#  TECS関係ファイルのディレクトリの定義
     115#
     116TECSDIR =
    106117
    107118#
     
    134145
    135146#
    136 #  依存関係ファイルを置くディレクトリの定義
    137 #
    138 DEPDIR = deps
     147#  中間オブジェクトファイルと依存関係ファイルを置くディレクトリの定義
     148#
     149OBJDIR = obj
     150DEPDIR = obj
    139151
    140152#
     
    165177endif
    166178
     179TINETDIR = tinet
     180
    167181#
    168182#  mbedサービスの定義
     
    175189±é€šã‚³ãƒ³ãƒ‘イルオプションの定義
    176190#
    177 COPTS := -g -std=gnu99 $(COPTS)
     191COPTS := -g -std=gnu99 -ffunction-sections -fdata-sections $(COPTS)
    178192ifndef OMIT_WARNING_ALL
    179193        COPTS := -Wall $(COPTS)
     
    207221        APPL_COBJS := main.o fdtable.o io_stub.o socket_stub.o ffarch.o fftime.o tlsf.o diskio.o ff.o sdfs.o ccsbcs.o base64.o http-strings.o http_parser.o httpd.o httpd-fs.o sha1.o websocket.o websocket_fbs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o mbedcall.o
    208222endif
    209 APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o
     223APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o mbed_stub.o
    210224APPL_BINOBJS := httpd_fs.o
    211225APPL_CFLAGS := $(APPL_CFLAGS)
     
    214228endif
    215229
    216 TINETDIR = tinet
    217230ifdef TINETDIR
    218231        #
     
    250263#  システムサービスに関する定義
    251264#
     265ifdef TCINSTALL
     266GCC_PATH = $(TCINSTALL)
     267else
     268GCC_PATH = $(shell which $(CC))/../../
     269endif
     270MALLOC_LIB = "${GCC_PATH}arm-none-eabi/lib/thumb/v7-ar/fpv3/hard/libc.a"
     271MALLOC_OBJS = lib_a-reent.o lib_a-impure.o lib_a-malloc.o lib_a-mallocr.o lib_a-calloc.o lib_a-callocr.o lib_a-realloc.o lib_a-reallocr.o lib_a-sbrkr.o lib_a-freer.o
     272
    252273SYSSVC_DIRS := $(TECSGENDIR) $(SRCDIR)/tecs_kernel \
    253274                                $(SYSSVC_DIRS) $(SRCDIR)/syssvc
    254275SYSSVC_ASMOBJS := $(SYSSVC_ASMOBJS)
    255 SYSSVC_COBJS := $(INIT_TECS_COBJ) $(TECS_COBJS) $(SYSSVC_COBJS) \
    256                                 $(CXXRTS)
     276SYSSVC_COBJS := $(SYSSVC_COBJS) $(TECS_COBJS) \
     277                                $(INIT_TECS_COBJ) $(CXXRTS)
    257278SYSSVC_CFLAGS := $(SYSSVC_CFLAGS)
    258 INCLUDES := $(INCLUDES) -I$(TECSGENDIR) -I$(SRCDIR)/tecs_kernel
     279INCLUDES := $(INCLUDES) -I$(TECSGENDIR) -I$(SRCDIR)/tecs_kernel -I../../musl-1.1.18/include
     280
     281#
     282#  トレースログ記録のサンプルコードに関する定義
     283#
     284ifdef ENABLE_TRACE
     285        COPTS := $(COPTS) -DTOPPERS_ENABLE_TRACE
     286        SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/arch/tracelog
     287endif
    259288
    260289#
     
    263292.PHONY: all
    264293ifndef OMIT_TECS
    265 all: tecs
     294all: tecs | $(DEPDIR)
    266295#       @$(MAKE) check
    267296        @$(MAKE) check $(OBJNAME).bin
     
    279308#  コンフィギュレータに関する定義
    280309#
     310CFG_KERNEL := --kernel asp
    281311ifndef TINETDIR
    282312  CFG_TRB := -T $(TARGETDIR)/target_kernel.trb
     
    287317  CFG_TABS := --api-table $(TINET_ROOT)/tcpip_api.def:tcpip \
    288318                        --api-table $(SRCDIR)/kernel/kernel_api.def:kernel \
    289                         --symval-table $(SRCDIR)/tinet/tcpip_sym.def \
     319                        --symval-table $(TINET_ROOT)/tcpip_sym.def \
    290320                        --symval-table $(SRCDIR)/kernel/kernel_sym.def $(CFG_TABS)
    291321endif
    292322CFG_ASMOBJS := $(CFG_ASMOBJS)
    293323CFG_COBJS := kernel_cfg.o $(CFG_COBJS)
    294 CFG_OBJS := $(CFG_ASMOBJS) $(CFG_COBJS)
     324CFG_CFLAGS := -DTOPPERS_CB_TYPE_ONLY $(CFG_CFLAGS)
     325
    295326CFG2_OUT_SRCS := kernel_cfg.h kernel_cfg.c $(CFG2_OUT_SRCS)
    296 CFG_CFLAGS := -DTOPPERS_CB_TYPE_ONLY $(CFG_CFLAGS)
    297327
    298328#
     
    325355                                        $(foreach file,$(KERNEL_FCSRCS),$(file:.c=.o))
    326356endif
    327 ifdef OMIT_OFFSET_H
    328         OFFSET_H =
    329 else
     357ifdef TARGET_OFFSET_TRB
    330358        OFFSET_H = offset.h
    331359endif
     
    343371endif
    344372ifndef TARGET_TCPIP_TRB
    345         TARGET_TCPIP_TRB := $(SRCDIR)/tinet/tinet.trb
     373        TARGET_TCPIP_TRB := $(SRCDIR)/$(TINETDIR)/tinet.trb
    346374endif
    347375
     
    356384
    357385#
     386#  中間オブジェクトファイルを置くディレクトリの処理
     387#
     388APPL_ASMOBJS   := $(addprefix $(OBJDIR)/, $(APPL_ASMOBJS))
     389APPL_CXXOBJS   := $(addprefix $(OBJDIR)/, $(APPL_CXXOBJS))
     390APPL_COBJS     := $(addprefix $(OBJDIR)/, $(APPL_COBJS))
     391APPL_BINOBJS   := $(addprefix $(OBJDIR)/, $(APPL_BINOBJS))
     392SYSSVC_ASMOBJS := $(addprefix $(OBJDIR)/, $(SYSSVC_ASMOBJS))
     393SYSSVC_COBJS   := $(addprefix $(OBJDIR)/, $(SYSSVC_COBJS))
     394KERNEL_ASMOBJS := $(addprefix $(OBJDIR)/, $(KERNEL_ASMOBJS))
     395KERNEL_COBJS   := $(addprefix $(OBJDIR)/, $(KERNEL_COBJS))
     396KERNEL_LCOBJS  := $(addprefix $(OBJDIR)/, $(KERNEL_LCOBJS))
     397CFG_ASMOBJS    := $(addprefix $(OBJDIR)/, $(CFG_ASMOBJS))
     398CFG_COBJS      := $(addprefix $(OBJDIR)/, $(CFG_COBJS))
     399CFG_DMY        := $(addprefix $(OBJDIR)/, $(CFG_DMY))
     400MALLOC_OBJS    := $(addprefix $(OBJDIR)/, $(MALLOC_OBJS))
     401
     402#
    358403#  コンパイルのための変数の定義
    359404#
    360 KERNEL_LIB_OBJS = $(KERNEL_ASMOBJS) $(KERNEL_COBJS) $(KERNEL_LCOBJS)
     405APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS) $(APPL_BINOBJS)
    361406SYSSVC_OBJS = $(SYSSVC_ASMOBJS) $(SYSSVC_COBJS) $(HIDDEN_OBJS)
    362 APPL_OBJS = $(APPL_ASMOBJS) $(APPL_COBJS) $(APPL_CXXOBJS) $(APPL_BINOBJS)
     407KERNEL_LIB_OBJS = $(KERNEL_ASMOBJS) $(KERNEL_COBJS) $(KERNEL_LCOBJS) $(MALLOC_OBJS)
     408CFG_OBJS = $(CFG_ASMOBJS) $(CFG_COBJS)
    363409ALL_OBJS = $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    364410                                                                                        $(END_OBJS) $(HIDDEN_OBJS)
     
    372418        OBJ_LDFLAGS := $(OBJ_LDFLAGS) -L.
    373419endif
     420ifdef SYSSVC_LIB
     421        LIBS_DEP := $(LIBS_DEP) $(SYSSVC_LIB)/libsyssvc.a
     422        OBJ_LDFLAGS := $(OBJ_LDFLAGS) -L$(SYSSVC_LIB)
     423        REALCLEAN_FILES := $(REALCLEAN_FILES) libsyssvc.a
     424else
     425        LIBS_DEP := $(LIBS_DEP) libsyssvc.a
     426        OBJ_LDFLAGS := $(OBJ_LDFLAGS) -L.
     427endif
    374428
    375429ifdef TEXT_START_ADDRESS
     
    394448tecs $(TECSGEN_SRCS) $(TECS_HEADERS): $(TECSGEN_TIMESTAMP) ;
    395449$(TECSGEN_TIMESTAMP): $(APPL_CDL) $(TECS_IMPORTS)
    396         $(TECSGEN) $< -R $(INCLUDES) --cpp "$(TECS_CPP)" -g $(TECSGENDIR)
     450        $(TECSGEN) $< -R $(INCLUDES) --cpp "$(subst ", \", $(TECS_CPP))" -g $(TECSGENDIR)
    397451
    398452#
     
    401455cfg1_out.c cfg1_out.db: cfg1_out.timestamp ;
    402456cfg1_out.timestamp: $(APPL_CFG) $(TECSGEN_TIMESTAMP)
    403         echo $(CFG_TABS)
    404         $(CFG) --pass 1 --kernel asp $(INCLUDES) $(CFG_TABS) \
     457        $(CFG) --pass 1 $(CFG_KERNEL) $(INCLUDES) $(CFG_TABS) \
    405458                                                -M $(DEPDIR)/cfg1_out_c.d $(TARGET_KERNEL_CFG) $<
    406459
    407 $(CFG1_OUT): $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
     460$(CFG1_OUT): $(START_OBJS) $(OBJDIR)/cfg1_out.o $(CFG_DMY) $(END_OBJS) $(HIDDEN_OBJS)
    408461        $(LINK) $(CFLAGS) $(LDFLAGS) $(CFG1_OUT_LDFLAGS) -o $(CFG1_OUT) \
    409                                                 $(START_OBJS) cfg1_out.o $(CFG_DMY) $(END_OBJS)
     462                                                $(START_OBJS) $(OBJDIR)/cfg1_out.o $(CFG_DMY) $(LIBS) $(END_OBJS) $(HIDDEN_OBJS)
    410463
    411464cfg1_out.syms: $(CFG1_OUT)
     
    417470$(CFG2_OUT_SRCS) cfg2_out.db: kernel_cfg.timestamp ;
    418471kernel_cfg.timestamp: cfg1_out.db cfg1_out.syms cfg1_out.srec
    419         $(CFG) --pass 2 --kernel asp $(INCLUDES) $(CFG_TRB)
     472        $(CFG) --pass 2 $(CFG_KERNEL) $(INCLUDES) $(CFG_TRB)
    420473
    421474#
     
    424477$(OFFSET_H): offset.timestamp ;
    425478offset.timestamp: cfg1_out.db cfg1_out.syms cfg1_out.srec
    426         $(CFG) --pass 2 -O --kernel asp $(INCLUDES) -T $(TARGET_OFFSET_TRB) \
     479        $(CFG) --pass 2 -O $(CFG_KERNEL) $(INCLUDES) -T $(TARGET_OFFSET_TRB) \
    427480                                --rom-symbol cfg1_out.syms --rom-image cfg1_out.srec
    428481
     
    436489
    437490#
     491#  システムサービスコールライブラリファイルの生成
     492#
     493libsyssvc.a: $(filter-out $(OBJDIR)/tBannerMain.o, $(SYSSVC_OBJS))
     494        rm -f libsyssvc.a
     495        $(AR) -rcs libsyssvc.a $(filter-out $(OBJDIR)/tBannerMain.o, $(SYSSVC_OBJS))
     496        $(RANLIB) libsyssvc.a
     497
     498#
     499#  並列makeのための依存関係の定義
     500#
     501$(APPL_OBJS) $(filter-out $(CFG_DMY), $(SYSSVC_OBJS)): | kernel_cfg.timestamp
     502$(APPL_ASMOBJS) $(filter-out $(CFG_DMY), $(SYSSVC_ASMOBJS)) $(KERNEL_ASMOBJS) $(CFG_ASMOBJS): \
     503                                                                                                                | offset.timestamp
     504
     505#
    438506#  特別な依存関係の定義
    439507#
    440 tBannerMain.o: $(filter-out tBannerMain.o,$(ALL_OBJS)) $(LIBS_DEP)
     508$(OBJDIR)/tBannerMain.o: $(filter-out $(OBJDIR)/tBannerMain.o,$(ALL_OBJS)) \
     509                                                                                                                                $(LIBS_DEP)
    441510
    442511#
     
    448517                        -Wl,-Map=$(OBJNAME).map,--cref -Wl,--gc-sections -Wl,-e_kernel__start,--gc-keep-exported=_kernel_istk \
    449518                        $(START_OBJS) $(APPL_OBJS) $(SYSSVC_OBJS) $(CFG_OBJS) \
    450                         $(ALL_LIBS) $(END_OBJS)
     519                        -Wl,--start-group $(ALL_LIBS) -Wl,--end-group $(END_OBJS)
     520
     521#
     522#  依存関係フォルダの作成
     523#
     524$(DEPDIR):
     525        mkdir $@
    451526
    452527#
     
    476551check: check.timestamp ;
    477552check.timestamp: cfg2_out.db $(OBJNAME).syms $(OBJNAME).srec
    478         $(CFG) --pass 3 --kernel asp -O $(INCLUDES) -T $(TARGET_CHECK_TRB) \
     553        $(CFG) --pass 3 $(CFG_KERNEL) -O $(INCLUDES) -T $(TARGET_CHECK_TRB) \
    479554                                --rom-symbol $(OBJNAME).syms --rom-image $(OBJNAME).srec
    480555        @echo "configuration check passed"
     
    485560.PHONY: clean
    486561clean:
    487         rm -f \#* *~ *.o $(DEPDIR)/*.d $(CLEAN_FILES) check.timestamp
     562        rm -f \#* *~ $(OBJDIR)/*.o $(DEPDIR)/*.d $(CLEAN_FILES) check.timestamp
    488563        rm -f $(OBJFILE) $(OBJNAME).syms $(OBJNAME).srec $(OBJNAME).bin
    489564        rm -f kernel_cfg.timestamp $(CFG2_OUT_SRCS) cfg2_out.db
     
    495570        rm -f libkernel.a
    496571endif
     572ifndef SYSSVC_LIB
     573        rm -f libsyssvc.a
     574endif
     575        rm -f $(MALLOC_OBJS)
    497576
    498577.PHONY: cleankernel
    499578cleankernel:
    500579        rm -f $(OFFSET_H) $(KERNEL_LIB_OBJS)
    501         rm -f $(KERNEL_LIB_OBJS:%.o=$(DEPDIR)/%.d)
     580        rm -f $(KERNEL_LIB_OBJS:$(OBJDIR)/%.o=$(DEPDIR)/%.d)
     581
     582.PHONY: cleansyssvc
     583cleansyssvc:
     584        rm -f $(SYSSVC_OBJS)
     585        rm -f $(SYSSVC_OBJS:$(OBJDIR)/%.o=$(DEPDIR)/%.d)
    502586
    503587.PHONY: realclean
     
    512596#  のみを付けてコンパイルする.
    513597#
    514 ALL_CFG_COBJS = $(CFG_COBJS) cfg1_out.o
     598ALL_CFG_COBJS = $(CFG_COBJS) $(OBJDIR)/cfg1_out.o
    515599ALL_CFG_ASMOBJS = $(CFG_ASMOBJS)
    516600
    517 $(ALL_CFG_COBJS): %.o: %.c
    518         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
    519 
    520 $(ALL_CFG_COBJS:.o=.s): %.s: %.c
    521         $(CC) -S $(CFLAGS) $(CFG_CFLAGS) $<
    522 
    523 $(ALL_CFG_ASMOBJS): %.o: %.S
    524         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
     601$(ALL_CFG_COBJS): $(OBJDIR)/%.o: %.c
     602        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
     603
     604$(ALL_CFG_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     605        $(CC) -S -o $@ $(CFLAGS) $(CFG_CFLAGS) $<
     606
     607$(ALL_CFG_ASMOBJS): $(OBJDIR)/%.o: %.S
     608        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(CFG_CFLAGS) $<
    525609
    526610#
     
    574658#  コンパイルルールの定義
    575659#
    576 $(KERNEL_COBJS): %.o: %.c
    577         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
    578 
    579 $(KERNEL_COBJS:.o=.s): %.s: %.c
    580         $(CC) -S $(CFLAGS) $(KERNEL_CFLAGS) $<
    581 
    582 $(KERNEL_LCOBJS): %.o:
    583         $(CC) -DTOPPERS_$(*F) -o $@ -c -MD -MP -MF $(DEPDIR)/$*.d \
     660$(KERNEL_COBJS): $(OBJDIR)/%.o: %.c
     661        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
     662
     663$(KERNEL_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     664        $(CC) -S -o $@ $(CFLAGS) $(KERNEL_CFLAGS) $<
     665
     666$(KERNEL_LCOBJS): $(OBJDIR)/%.o:
     667        $(CC) -c -o $@ -DTOPPERS_$(*F) -MD -MP -MF $(DEPDIR)/$*.d \
    584668                                                                        $(CFLAGS) $(KERNEL_CFLAGS) $<
    585669
    586 $(KERNEL_LCOBJS:.o=.s): %.s:
    587         $(CC) -DTOPPERS_$(*F) -o $@ -S $(CFLAGS) $(KERNEL_CFLAGS) $<
    588 
    589 $(KERNEL_ASMOBJS): %.o: %.S
    590         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
    591 
    592 $(SYSSVC_COBJS): %.o: %.c
    593         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
    594 
    595 $(SYSSVC_COBJS:.o=.s): %.s: %.c
    596         $(CC) -S $(CFLAGS) $(SYSSVC_CFLAGS) $<
    597 
    598 $(SYSSVC_ASMOBJS): %.o: %.S
    599         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
    600 
    601 $(APPL_COBJS): %.o: %.c
    602         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    603 
    604 $(APPL_COBJS:.o=.s): %.s: %.c
    605         $(CC) -S $(CFLAGS) $(APPL_CFLAGS) $<
    606 
    607 $(APPL_CXXOBJS): %.o: %.cpp
    608         $(CXX) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    609 
    610 $(APPL_CXXOBJS:.o=.s): %.s: %.cpp
    611         $(CXX) -S $(CFLAGS) $(APPL_CFLAGS) $<
    612 
    613 $(APPL_ASMOBJS): %.o: %.S
    614         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
    615 
    616 $(APPL_BINOBJS): %.o: %.bin
    617         $(OBJCOPY) -B arm -I binary -O elf32-littlearm --rename-section .data=.rodata $< $*.o
     670$(KERNEL_LCOBJS:$(OBJDIR)/%.o=%.s): %.s:
     671        $(CC) -S -o $@ -DTOPPERS_$(*F) $(CFLAGS) $(KERNEL_CFLAGS) $<
     672
     673$(KERNEL_ASMOBJS): $(OBJDIR)/%.o: %.S
     674        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(KERNEL_CFLAGS) $<
     675
     676$(SYSSVC_COBJS): $(OBJDIR)/%.o: %.c
     677        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
     678
     679$(SYSSVC_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     680        $(CC) -S -o $@ $(CFLAGS) $(SYSSVC_CFLAGS) $<
     681
     682$(SYSSVC_ASMOBJS): $(OBJDIR)/%.o: %.S
     683        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(SYSSVC_CFLAGS) $<
     684
     685$(APPL_COBJS): $(OBJDIR)/%.o: %.c
     686        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     687
     688$(APPL_COBJS:$(OBJDIR)/%.o=%.s): %.s: %.c
     689        $(CC) -S -o $@ $(CFLAGS) $(APPL_CFLAGS) $<
     690
     691$(APPL_CXXOBJS): $(OBJDIR)/%.o: %.cpp
     692        $(CXX) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     693
     694$(APPL_CXXOBJS:$(OBJDIR)/%.o=%.s): %.s: %.cpp
     695        $(CXX) -S -o $@ $(CFLAGS) $(APPL_CFLAGS) $<
     696
     697$(APPL_ASMOBJS): $(OBJDIR)/%.o: %.S
     698        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $(APPL_CFLAGS) $<
     699
     700$(APPL_BINOBJS): $(OBJDIR)/%.o: %.bin
     701        $(OBJCOPY) -B arm -I binary -O elf32-littlearm --rename-section .data=.rodata $< $(OBJDIR)/$*.o
     702
     703$(MALLOC_OBJS): $(OBJDIR)/%.o:
     704        $(AR) x $(MALLOC_LIB) $(notdir $@)
     705        mv $(notdir $@) $@
    618706
    619707#
    620708#  デフォルトコンパイルルールを上書き
    621709#
    622 %.o: %.c
     710$(OBJDIR)/%.o: %.c
    623711        @echo "*** Default compile rules should not be used."
    624         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     712        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
    625713
    626714%.s: %.c
    627715        @echo "*** Default compile rules should not be used."
    628         $(CC) -S $(CFLAGS) $<
    629 
    630 %.o: %.cpp
     716        $(CC) -S -o $@ $(CFLAGS) $<
     717
     718$(OBJDIR)/%.o: %.cpp
    631719        @echo "*** Default compile rules should not be used."
    632         $(CXX) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     720        $(CXX) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
    633721
    634722%.s: %.cpp
    635723        @echo "*** Default compile rules should not be used."
    636         $(CXX) -S $(CFLAGS) $<
    637 
    638 %.o: %.S
     724        $(CXX) -S -o $@ $(CFLAGS) $<
     725
     726$(OBJDIR)/%.o: %.S
    639727        @echo "*** Default compile rules should not be used."
    640         $(CC) -c -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
     728        $(CC) -c -o $@ -MD -MP -MF $(DEPDIR)/$*.d $(CFLAGS) $<
  • EcnlProtoTool/trunk/ntshell/fatfs/sdfs.c

    r321 r429  
    116116#include "sdfs.h"
    117117//#include "mbed_debug.h"
    118 #include "wait_api.h"
     118#include "mbed_wait_api.h"
    119119
    120120#define debug(str, ...)
  • EcnlProtoTool/trunk/ntshell/src/mbedcall.c

    r331 r429  
    5959#include "serial_api.h"
    6060#include "us_ticker_api.h"
    61 #include "wait_api.h"
     61#include "mbed_wait_api.h"
    6262#include "../../mbed_api/src/mbedcall.h"
    6363
  • EcnlProtoTool/trunk/ntshell/src/syscall.c

    r331 r429  
    6161// https://os.mbed.com/users/dkato/code/FlashAccess/#652a093cf264
    6262void flash_access_cache_control(void) {
    63     unsigned int assoc;
    64 
    65     /* ==== Cleaning and invalidation of the L1 data cache ==== */
    66     __v7_all_cache(2);
    67     __DSB();
    68 
    69     /* ==== Cleaning and invalidation of the L2 cache ==== */
    70     if (PL310->AUX_CNT & (1<<16)) {
    71         assoc = 16;
    72     } else {
    73         assoc =  8;
    74     }
    75     PL310->INV_WAY = (1 << assoc) - 1;
    76     while(PL310->INV_WAY & ((1 << assoc) - 1)); // poll invalidate
    77     PL310->CACHE_SYNC = 0x0;
    78 
    79     /* ==== Invalidate all TLB entries ==== */
    80     __ca9u_inv_tlb_all();
    81 
    82     /* ==== Invalidate the L1 instruction cache ==== */
    83     __v7_inv_icache_all();
    84     __DSB();
    85     __ISB();
     63        unsigned int assoc;
     64
     65        /* ==== Cleaning and invalidation of the L1 data cache ==== */
     66        L1C_CleanInvalidateDCacheAll();
     67        __DSB();
     68
     69        /* ==== Cleaning and invalidation of the L2 cache ==== */
     70        if (L2C_310->AUX_CNT & (1 << 16)) {
     71                assoc = 16;
     72        }
     73        else {
     74                assoc = 8;
     75        }
     76        L2C_310->INV_WAY = (1 << assoc) - 1;
     77        while (L2C_310->INV_WAY & ((1 << assoc) - 1)); // poll invalidate
     78        L2C_310->CACHE_SYNC = 0x0;
     79
     80        /* ==== Invalidate all TLB entries ==== */
     81        MMU_InvalidateTLB();
     82
     83        /* ==== Invalidate the L1 instruction cache ==== */
     84        L1C_InvalidateICacheAll();
     85        __DSB();
     86        __ISB();
    8687}
    8788
  • EcnlProtoTool/trunk/ntshell/src/tinet_main.cfg

    r331 r429  
    4343#include "main.h"
    4444
    45 INCLUDE("netinet/ip_igmp.cfg");
    46 
    4745/* DHCP クライアント */
    4846/*INCLUDE("netapp/tinet_dhcp4_cli.cfg");*/
Note: See TracChangeset for help on using the changeset viewer.