Changeset 331 for EcnlProtoTool/trunk/prototool
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- Location:
- EcnlProtoTool/trunk/prototool
- Files:
-
- 5 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/prototool/.cproject
r279 r331 41 41 </tool> 42 42 <tool id="com.renesas.cdt.rz.debug.win32.tool.compiler.Id.1599684796" name="Compiler" superClass="com.renesas.cdt.rz.debug.win32.tool.compiler.Id"> 43 <option defaultValue="true" id="com.renesas.cdt.core.Compiler.option.misc2.705849748" name="æ¨æºã·ã¹ãã ã»ãã£ã¬ã¯ããªã¼ã§ãããã¼ã»ãã¡ã¤ã«ãæ¤ç´¢ããªã (-nostdinc)" superClass="com.renesas.cdt.core.Compiler.option.misc2" value=" false" valueType="boolean"/>43 <option defaultValue="true" id="com.renesas.cdt.core.Compiler.option.misc2.705849748" name="æ¨æºã·ã¹ãã ã»ãã£ã¬ã¯ããªã¼ã§ãããã¼ã»ãã¡ã¤ã«ãæ¤ç´¢ããªã (-nostdinc)" superClass="com.renesas.cdt.core.Compiler.option.misc2" value="true" valueType="boolean"/> 44 44 <option id="com.renesas.cdt.rz.Debug.Compiler.option.architecture.1326747160" name="ã¢ã¼ããã¯ãã£ã¼" superClass="com.renesas.cdt.rz.Debug.Compiler.option.architecture" value="com.renesas.cdt.rz.Debug.Compiler.option.architecture.armv7a" valueType="enumerated"/> 45 45 <option id="com.renesas.cdt.rz.Debug.Compiler.option.cpuType.1644847738" name="CPU ã¿ã¤ã" superClass="com.renesas.cdt.rz.Debug.Compiler.option.cpuType" value="com.renesas.cdt.rz.Debug.Compiler.option.cpuType.rza" valueType="enumerated"/> … … 53 53 <option id="com.renesas.cdt.core.Compiler.option.device.443282008" name="Device" superClass="com.renesas.cdt.core.Compiler.option.device" value="R7S721001" valueType="string"/> 54 54 <option id="com.renesas.cdt.core.Compiler.option.deviceShortName.752035440" name="DeviceShortName" superClass="com.renesas.cdt.core.Compiler.option.deviceShortName" value="R7S721001" valueType="string"/> 55 <option id="com.renesas.cdt.core.Compiler.option.stackSizeInDecimal.1821950522" name="Decimal representation of '-Ws atck-usage'" superClass="com.renesas.cdt.core.Compiler.option.stackSizeInDecimal" value="256" valueType="string"/>55 <option id="com.renesas.cdt.core.Compiler.option.stackSizeInDecimal.1821950522" name="Decimal representation of '-Wstack-usage'" superClass="com.renesas.cdt.core.Compiler.option.stackSizeInDecimal" value="256" valueType="string"/> 56 56 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.core.Compiler.option.includeFileDir.461834980" name="ã¤ã³ã¯ã«ã¼ãã»ãã¡ã¤ã«ã»ãã£ã¬ã¯ããªã¼" superClass="com.renesas.cdt.core.Compiler.option.includeFileDir" valueType="includePath"> 57 <listOptionValue builtIn="false" value=""${workspace_loc:}/musl-1.1.12/include""/> 58 <listOptionValue builtIn="false" value=""${workspace_loc:}/onigmo-5.15.0/src""/> 59 <listOptionValue builtIn="false" value=""${workspace_loc:/asp3_dcre/mbed/hal}""/> 60 <listOptionValue builtIn="false" value=""${workspace_loc:/asp3_dcre/mbed/api}""/> 61 <listOptionValue builtIn="false" value=""${workspace_loc:/asp3_dcre/mbed/targets/cmsis}""/> 62 <listOptionValue builtIn="false" value=""${workspace_loc:/asp3_dcre/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H}""/> 63 <listOptionValue builtIn="false" value=""${workspace_loc:/asp3_dcre/mbed/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H}""/> 64 <listOptionValue builtIn="false" value=""${workspace_loc:/asp3_dcre/mbed/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/inc}""/> 65 <listOptionValue builtIn="false" value=""${workspace_loc:/asp3_dcre/mbed/targets/cmsis/TARGET_RENESAS/TARGET_RZ_A1H/inc/iodefines}""/> 66 <listOptionValue builtIn="false" value=""${workspace_loc:/mruby-1.2.0/include}""/> 57 <listOptionValue builtIn="false" value=""${workspace_loc:/musl-1.1.18/include}""/> 58 <listOptionValue builtIn="false" value=""${workspace_loc:}/onigmo-6.1.3/src""/> 59 <listOptionValue builtIn="false" value=""${workspace_loc:/mruby-1.3.0/include}""/> 60 <listOptionValue builtIn="false" value=""${workspace_loc:/mbed_api/src}""/> 67 61 <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> 68 <listOptionValue builtIn="false" value=""${workspace_loc:}/ntshell /ntshell""/>62 <listOptionValue builtIn="false" value=""${workspace_loc:}/ntshell""/> 69 63 <listOptionValue builtIn="false" value=""${workspace_loc:}/ntshell/gr_peach""/> 70 64 </option> … … 72 66 <listOptionValue builtIn="false" value="MRB_GC_STRESS"/> 73 67 <listOptionValue builtIn="false" value="MRB_ENABLE_DEBUG_HOOK"/> 74 <listOptionValue builtIn="false" value="FD_SETSIZE=32"/>75 68 </option> 76 69 <option id="com.renesas.cdt.core.Compiler.option.stdWarnings.1803476376" name="æ¨æºã®è¦å" superClass="com.renesas.cdt.core.Compiler.option.stdWarnings" value="com.renesas.cdt.core.Compiler.option.stdWarnings.enableAll" valueType="enumerated"/> … … 118 111 ã®å¯¾å¿ããã»ã¯ã·ã§ã³ã«é 119 112 ç½®ãã (-ffunction-sections)" superClass="com.renesas.cdt.core.Compiler.option.misc19" value="true" valueType="boolean"/> 113 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.renesas.cdt.rz.Debug.Compiler.option.userDefinedOptions.203692350" name="ã¦ã¼ã¶ã¼å®ç¾©ãªãã·ã§ã³" superClass="com.renesas.cdt.rz.Debug.Compiler.option.userDefinedOptions" valueType="stringList"/> 120 114 <inputType id="%Base.Compiler.C.InputType.Id.347710053" name="C å 121 115 ¥å" superClass="%Base.Compiler.C.InputType.Id"/> … … 138 132 <tool command="arm-none-eabi-gcc" id="com.renesas.cdt.rz.debug.win32.tool.linker.Id.68534288" name="Linker" superClass="com.renesas.cdt.rz.debug.win32.tool.linker.Id"> 139 133 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.rz.Debug.Linker.option.archiveSearchDirectories.1048191791" name="ã¢ã¼ã«ã¤ãæ¤ç´¢ãã£ã¬ã¯ããªã¼" superClass="com.renesas.cdt.rz.Debug.Linker.option.archiveSearchDirectories" valueType="stringList"> 134 <listOptionValue builtIn="false" value=""${workspace_loc:/musl-1.1.18/lib}""/> 140 135 <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/> 141 <listOptionValue builtIn="false" value=""${workspace_loc:/tcc-0.9.26/Debug}""/> 142 <listOptionValue builtIn="false" value=""${workspace_loc:/onigmo-5.15.0/Debug}""/> 143 <listOptionValue builtIn="false" value=""${workspace_loc:/mruby-1.2.0/build/arm-none-eabi/lib}""/> 136 <listOptionValue builtIn="false" value=""${workspace_loc:/openssl-1.1.0e/Debug}""/> 137 <listOptionValue builtIn="false" value=""${workspace_loc:/zlib-1.2.11/Debug}""/> 138 <listOptionValue builtIn="false" value=""${workspace_loc:/curl-7.57.0/Debug}""/> 139 <listOptionValue builtIn="false" value=""${workspace_loc:/tcc-0.9.27/Debug}""/> 140 <listOptionValue builtIn="false" value=""${workspace_loc:/onigmo-6.1.3/Debug}""/> 141 <listOptionValue builtIn="false" value=""${workspace_loc:/mbed_api/Debug}""/> 142 <listOptionValue builtIn="false" value=""${workspace_loc:/mruby-1.3.0/build/arm-none-eabi/lib}""/> 144 143 <listOptionValue builtIn="false" value=""${TCINSTALL}/lib/gcc/arm-none-eabi/${GCC_VERSION}/armv7-ar/thumb/fpu""/> 145 144 <listOptionValue builtIn="false" value=""${TCINSTALL}/arm-none-eabi/lib/armv7-ar/thumb/fpu""/> … … 164 163 <listOptionValue builtIn="false" value="".\src\xprintf.o""/> 165 164 <listOptionValue builtIn="false" value="".\src\arduino.o""/> 166 <listOptionValue builtIn="false" value="".\src\shellif.o""/>167 165 <listOptionValue builtIn="false" value=""${workspace_loc:/ntshell/Debug/ntshell_bin.o}""/> 168 <listOptionValue builtIn="false" value="".\src/musl\freeaddrinfo.o""/>169 <listOptionValue builtIn="false" value="".\src/musl\gai_strerror.o""/>170 <listOptionValue builtIn="false" value="".\src/musl\getaddrinfo.o""/>171 <listOptionValue builtIn="false" value="".\src/musl\inet_aton.o""/>172 <listOptionValue builtIn="false" value="".\src/musl\lookup_ipliteral.o""/>173 <listOptionValue builtIn="false" value="".\src/musl\lookup_name.o""/>174 <listOptionValue builtIn="false" value="".\src/musl\lookup_serv.o""/>175 166 <listOptionValue builtIn="false" value="".\src/libbb\bb_strtonum.o""/> 176 167 <listOptionValue builtIn="false" value="".\src/libbb\bb_time.o""/> … … 194 185 <listOptionValue builtIn="false" value="".\src/libbb\xfuncs.o""/> 195 186 <listOptionValue builtIn="false" value="".\src/libbb\xfuncs_printf.o""/> 187 <listOptionValue builtIn="false" value="".\src\shellif.o""/> 188 <listOptionValue builtIn="false" value=""${workspace_loc:/musl-1.1.18/lib/crt1.o}""/> 189 <listOptionValue builtIn="false" value=""${workspace_loc:/musl-1.1.18/lib/libc.a}""/> 196 190 </option> 197 191 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.core.Linker.option.additionalInputFiles.1022783886" name="追å å 198 192 ¥åãã¡ã¤ã«" superClass="com.renesas.cdt.core.Linker.option.additionalInputFiles" valueType="userObjs"> 193 <listOptionValue builtIn="false" value=""${workspace_loc:/musl-1.1.18/lib/crt1.o}""/> 194 <listOptionValue builtIn="false" value=""${workspace_loc:/musl-1.1.18/lib/libc.a}""/> 199 195 <listOptionValue builtIn="false" value=""${workspace_loc:/ntshell/Debug/ntshell_bin.o}""/> 200 196 </option> 201 197 <option id="com.renesas.cdt.core.Linker.option.linkOrderUsed.1088314581" name="ãªã³ã¯é ã®ã«ã¹ã¿ãã¤ãºä½¿ç¨" superClass="com.renesas.cdt.core.Linker.option.linkOrderUsed" value="false" valueType="boolean"/> 202 198 <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.rz.Debug.Linker.option.archiveLibraryFiles.397699621" name="ã¢ã¼ã«ã¤ã ( ã©ã¤ãã©ãªã¼ ) ãã¡ã¤ã«" superClass="com.renesas.cdt.rz.Debug.Linker.option.archiveLibraryFiles" valueType="stringList"> 203 <listOptionValue builtIn="false" value="out"/>204 <listOptionValue builtIn="false" value="m"/>205 199 <listOptionValue builtIn="false" value="gcc"/> 200 <listOptionValue builtIn="false" value="ce"/> 201 <listOptionValue builtIn="false" value="openssl"/> 202 <listOptionValue builtIn="false" value="z"/> 203 <listOptionValue builtIn="false" value="curl"/> 204 <listOptionValue builtIn="false" value="tcc"/> 206 205 <listOptionValue builtIn="false" value="onigmo"/> 207 206 <listOptionValue builtIn="false" value="mruby"/> 208 207 <listOptionValue builtIn="false" value="mrbcode"/> 209 <listOptionValue builtIn="false" value=" tcc"/>208 <listOptionValue builtIn="false" value="mbed_api"/> 210 209 </option> 211 210 <option command="-Wl,--gc-sections" id="com.renesas.cdt.core.Linker.option.misc19.807194175" name="æªä½¿ç¨ã®å … … 249 248 </buildTargets> 250 249 </storageModule> 250 <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> 251 251 </cproject> -
EcnlProtoTool/trunk/prototool/.info
r279 r331 4 4 GCC_STRING=5.2-GNUARM-NONE_v16.01 5 5 VERSION_IDE= 6 E2STUDIO_VERSION=5. 3.1.0026 E2STUDIO_VERSION=5.4.0.018 7 7 ACTIVE_CONFIGURATION=Debug -
EcnlProtoTool/trunk/prototool/.project
r279 r331 4 4 <comment></comment> 5 5 <projects> 6 <project>mruby-1.2.0</project> 6 <project>curl-7.57.0</project> 7 <project>mbed_api</project> 8 <project>mruby-1.3.0</project> 7 9 <project>ntshell</project> 8 <project>onigmo-5.15.0</project> 9 <project>tcc-0.9.26</project> 10 <project>onigmo-6.1.3</project> 11 <project>openssl-1.1.0e</project> 12 <project>tcc-0.9.27</project> 13 <project>zlib-1.2.11</project> 10 14 </projects> 11 15 <buildSpec> -
EcnlProtoTool/trunk/prototool/lib/makefile.mrbc
r279 r331 2 2 CC=arm-none-eabi-gcc 3 3 AR=arm-none-eabi-ar 4 MRBC=../../mruby-1. 2.0/bin/mrbc4 MRBC=../../mruby-1.3.0/bin/mrbc 5 5 6 CFLAGS=-mcpu=cortex-a9 -march=armv7-a -mlittle-endian -marm -mthumb-interwork -mfloat-abi=hard -mfpu=vfpv3 -I../../mruby-1. 2.0/include6 CFLAGS=-mcpu=cortex-a9 -march=armv7-a -mlittle-endian -marm -mthumb-interwork -mfloat-abi=hard -mfpu=vfpv3 -I../../mruby-1.3.0/include 7 7 COBJS=echo_server.o echo_client.o 8 8 CSRCS=$(foreach file,$(COBJS),$(file:.o=.c)) -
EcnlProtoTool/trunk/prototool/llbruby.h
r321 r331 106 106 #define RB_PIN25 25 107 107 108 #define PIN_LED0 LED1109 #define PIN_LED1 LED2110 #define PIN_LED2 LED3111 #define PIN_LED3 LED4108 #define PIN_LED0 111 109 #define PIN_LED1 112 110 #define PIN_LED2 113 111 #define PIN_LED3 114 112 112 #define RB_LED PIN_LED0 113 113 -
EcnlProtoTool/trunk/prototool/src/arduino.c
r321 r331 4 4 #include <stdio.h> 5 5 #include <fcntl.h> 6 #include <sys/stat.h> 6 7 #include "../llbruby.h" 7 8 … … 544 545 return 0; 545 546 } 547 548 unsigned int Utf8_to_Utf16(const char *src, int *code_size) 549 { 550 int i; 551 unsigned int uc = 0; 552 unsigned char len = 0; 553 554 len = 0; 555 if ((src[0] & 0x80) == 0) { uc = src[0] & 0x7F; len = 0; } 556 else if ((src[0] & 0xE0) == 0xC0) { uc = src[0] & 0x1F; len = 1; } 557 else if ((src[0] & 0xF0) == 0xE0) { uc = src[0] & 0x0F; len = 2; } 558 else if ((src[0] & 0xF8) == 0xF0) { uc = src[0] & 0x07; len = 3; } 559 else if ((src[0] & 0xFC) == 0xF8) { uc = src[0] & 0x03; len = 4; } 560 else if ((src[0] & 0xFE) == 0xFC) { uc = src[0] & 0x01; len = 5; } 561 562 i = 1; 563 while ((i <= len) && ((src[i] & 0xC0) == 0x80)) { 564 uc = (uc << 6) | (src[i] & 0x3F); 565 i++; 566 } 567 568 //消費文字数設定 569 *code_size = i; 570 571 //現状、2バイト限定 572 return uc; 573 } 574 575 int bs_char_count(char *str, int pos) 576 { 577 int num = 1, local_pos = pos; 578 char *c; 579 580 while (1) { 581 c = str + local_pos; 582 583 if ((*c & 0x80) != 0x80) 584 return num; 585 586 if (((*c & 0xE0) == 0xC0) && (num == 2)) { 587 return num; 588 } 589 else if (((*c & 0xF0) == 0xE0) && (num == 3)) { 590 return num; 591 } 592 else if (((*c & 0xF8) == 0xF0) && (num == 4)) { 593 return num; 594 } 595 else if (((*c & 0xFC) == 0xF8) && (num == 5)) { 596 return num; 597 } 598 else if (((*c & 0xFE) == 0xFC) && (num == 6)) { 599 return num; 600 } 601 else { 602 if (local_pos > 0) { 603 local_pos--; 604 num++; 605 } 606 else 607 return 0; 608 } 609 } 610 611 return 0; 612 } -
EcnlProtoTool/trunk/prototool/src/arduino.h
r321 r331 10 10 #include <string.h> 11 11 #include <time.h> 12 #include <analogin_api.h> 13 #include <analogout_api.h> 14 #include <buffer.h> 15 #include <can_api.h> 16 #include <dma_api.h> 17 #include <ethernet_api.h> 18 #include <gpio_api.h> 19 #include <gpio_irq_api.h> 20 #include <i2c_api.h> 21 #include <lp_ticker_api.h> 22 #include <pinmap.h> 23 #include <port_api.h> 24 #include <pwmout_api.h> 25 #include <rtc_api.h> 26 #include <serial_api.h> 27 #include <sleep_api.h> 28 #include <spi_api.h> 29 #include <ticker_api.h> 30 #include <us_ticker_api.h> 31 #include <wait_api.h> 12 #include <mbed_api.h> 32 13 33 14 #ifndef bool -
EcnlProtoTool/trunk/prototool/src/libbb/libbb.h
r321 r331 25 25 26 26 #include <ctype.h> 27 #include " _dirent.h"27 #include "dirent.h" 28 28 #include <errno.h> 29 29 #include <fcntl.h> … … 61 61 #endif 62 62 #include <sys/wait.h> 63 #include "_termios.h"63 #include <termios.h> 64 64 #include <time.h> 65 65 #include <sys/param.h> -
EcnlProtoTool/trunk/prototool/src/libbb/vi.c
r321 r331 210 210 # define Isprint(c) ((unsigned char)(c) >= ' ' && (c) != 0x7f && (unsigned char)(c) != 0x9b) 211 211 #else 212 #define MULTI_BYTE_MULTIPLE 3 212 213 bool Isprint(unsigned char c) 213 214 { … … 228 229 mbc_st--; 229 230 return true; 231 } 232 bool IsMultiByteChar(unsigned char c, int *bytes) 233 { 234 bool ret = false; 235 *bytes = 1; 236 if ((c & 0xE0) == 0xC0) { *bytes = 2; } 237 else if ((c & 0xF0) == 0xE0) { *bytes = 3; } 238 else if ((c & 0xF8) == 0xF0) { *bytes = 4; } 239 else if ((c & 0xFC) == 0xF8) { *bytes = 5; } 240 else if ((c & 0xFE) == 0xFC) { *bytes = 6; } 241 if (*bytes != 1) 242 ret = true; 243 return ret; 230 244 } 231 245 #endif … … 583 597 static int format_edit_status(void); // format file status on status line 584 598 static void redraw(int); // force a full screen refresh 599 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 585 600 static char* format_line(char* /*, int*/); 601 #else 602 static char* format_line(char* , int*, int*); 603 #endif 586 604 static void refresh(int); // update the terminal from screen[] 587 605 … … 1590 1608 char *tp; 1591 1609 int cnt, ro, co; 1610 #ifdef ENABLE_BASIC_MULTI_CHAR_CODE 1611 int last_code_size = 0; 1612 #endif 1592 1613 1593 1614 beg_cur = begin_line(d); // first char of cur line … … 1654 1675 co += (code_size > 1 ? 2 : code_size); 1655 1676 tp += code_size; 1677 last_code_size = code_size; 1656 1678 #endif 1657 1679 } … … 1674 1696 } 1675 1697 if (co >= columns + offset) { 1698 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 1676 1699 offset = co - columns + 1; 1700 #else 1701 offset = co - columns + (last_code_size > 1 ? 2 : 1); 1702 #endif 1677 1703 } 1678 1704 // if the first char of the line is a tab, and "dot" is sitting on it … … 1831 1857 break; 1832 1858 if (*p == '\t') { 1859 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 1833 1860 co = next_tabstop(co); 1861 #else 1862 co += tabstop; 1863 p++; 1864 #endif 1834 1865 } 1835 1866 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE … … 1933 1964 { 1934 1965 int li; 1966 int internal_co = co; 1967 #ifdef ENABLE_BASIC_MULTI_CHAR_CODE 1968 internal_co *= MULTI_BYTE_MULTIPLE; 1969 #endif 1935 1970 1936 1971 free(screen); 1937 screensize = ro * co + 8;1972 screensize = ro * internal_co + 8; 1938 1973 screen = xmalloc(screensize); 1939 1974 // initialize the new screen. assume this will be a empty file. … … 1941 1976 // non-existent text[] lines start with a tilde (~). 1942 1977 for (li = 1; li < ro - 1; li++) { 1943 screen[(li * co) + 0] = '~';1978 screen[(li * internal_co) + 0] = '~'; 1944 1979 } 1945 1980 return screen; … … 3361 3396 } 3362 3397 3398 #ifdef ENABLE_BASIC_MULTI_CHAR_CODE 3399 //----- get screen column number of string --------------------- 3400 int get_view_col_from_bytes(char *st, char bytes, int max_size) 3401 { 3402 char *buf_end = st + max_size; 3403 int tmp_bytes = 0, tmp_total_bytes = 0, view_col = 0; 3404 while (tmp_total_bytes < bytes) { 3405 Utf8_to_Utf16(st, &tmp_bytes); 3406 tmp_total_bytes += tmp_bytes; 3407 view_col += tmp_bytes > 1 ? 2 : 1; 3408 st += tmp_bytes; 3409 if (st >= buf_end) 3410 break; 3411 } 3412 return view_col; 3413 } 3414 //----- get string bytes of screen column ---------------------- 3415 int get_bytes_from_view_col(char *st, int view_col, int max_size) 3416 { 3417 char *buf_end = st + max_size; 3418 int tmp_view_col = 0, bytes = 0, tmp_bytes; 3419 while (tmp_view_col < view_col) { 3420 Utf8_to_Utf16(st, &tmp_bytes); 3421 bytes += tmp_bytes; 3422 tmp_view_col += tmp_bytes > 1 ? 2 : 1; 3423 st += tmp_bytes; 3424 if (st >= buf_end) 3425 break; 3426 } 3427 return bytes; 3428 } 3429 #endif 3430 3363 3431 //----- Format a text[] line into a buffer --------------------- 3432 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 3364 3433 static char* format_line(char *src /*, int li*/) 3434 #else 3435 static char* format_line(char *src , int *bytes, int *view_co) 3436 #endif 3365 3437 { 3366 3438 unsigned char c; … … 3368 3440 int ofs = offset; 3369 3441 char *dest = scr_out_buf; // [MAX_SCR_COLS + MAX_TABSTOP * 2] 3442 #ifdef ENABLE_BASIC_MULTI_CHAR_CODE 3443 int tmp_bytes, tmp_columns_count, total_bytes = 0, view_columns = 0; 3444 memset(scr_out_buf, 0x00, sizeof(scr_out_buf)); 3445 #endif 3370 3446 3371 3447 c = '~'; // char in col 0 in non-existent lines is '~' 3372 3448 co = 0; 3449 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 3373 3450 while (co < columns + tabstop) { 3451 #else 3452 while (view_columns < columns + ofs/* + tabstop*/) { 3453 #endif 3374 3454 // have we gone past the end? 3375 3455 if (src < end) { … … 3386 3466 while ((co % tabstop) != (tabstop - 1)) { 3387 3467 dest[co++] = c; 3468 #ifdef ENABLE_BASIC_MULTI_CHAR_CODE 3469 total_bytes++; 3470 view_columns++; 3471 #endif 3388 3472 } 3389 3473 } else { … … 3397 3481 } 3398 3482 dest[co++] = c; 3483 #ifdef ENABLE_BASIC_MULTI_CHAR_CODE 3484 total_bytes++; 3485 view_columns++; 3486 if (IsMultiByteChar(c, &tmp_bytes)) { 3487 if (view_columns + 1 > columns + ofs) { 3488 dest[--co] = ' '; 3489 } 3490 else { 3491 view_columns++; 3492 int i; 3493 for (i = 0; i < tmp_bytes - 1; i++) { 3494 dest[co++] = *src++; 3495 total_bytes++; 3496 } 3497 } 3498 } 3499 #endif 3500 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 3399 3501 // discard scrolled-off-to-the-left portion, 3400 3502 // in tabstop-sized pieces … … 3404 3506 ofs -= tabstop; 3405 3507 } 3508 #endif 3406 3509 if (src >= end) 3407 3510 break; 3408 3511 } 3512 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 3409 3513 // check "short line, gigantic offset" case 3410 3514 if (co < ofs) … … 3416 3520 if (co < columns) 3417 3521 memset(&dest[co], ' ', columns - co); 3522 #else 3523 // check "short line, gigantic offset" case 3524 if (view_columns < ofs) 3525 ofs = view_columns; 3526 // discard last scrolled off part 3527 view_columns -= ofs; 3528 tmp_columns_count = 0; 3529 while (tmp_columns_count < ofs) { 3530 IsMultiByteChar(*dest, &tmp_bytes); 3531 dest += tmp_bytes; 3532 total_bytes -= tmp_bytes; 3533 tmp_columns_count += tmp_bytes > 1 ? 2 : 1; 3534 } 3535 // fill the rest with spaces 3536 if (view_columns < columns) { 3537 int ofs_bytes = get_bytes_from_view_col(scr_out_buf, ofs, co); 3538 memset(&dest[co - ofs_bytes], ' ', columns - view_columns); 3539 total_bytes = total_bytes + (columns - view_columns); 3540 } 3541 *bytes = total_bytes; 3542 *view_co = view_columns; 3543 #endif 3418 3544 return dest; 3419 3545 } … … 3430 3556 int li, changed; 3431 3557 char *tp, *sp; // pointer into text[] and screen[] 3558 #ifdef ENABLE_BASIC_MULTI_CHAR_CODE 3559 int bytes, view_co; 3560 #endif 3432 3561 3433 3562 if (ENABLE_FEATURE_VI_WIN_RESIZE IF_FEATURE_VI_ASK_TERMINAL(&& !G.get_rowcol_error) ) { … … 3444 3573 char *out_buf; 3445 3574 // format current text line 3575 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 3446 3576 out_buf = format_line(tp /*, li*/); 3577 #else 3578 out_buf = format_line(tp , &bytes, &view_co); 3579 #endif 3447 3580 3448 3581 // skip to the end of the current text[] line … … 3456 3589 changed = FALSE; // assume no change 3457 3590 cs = 0; 3591 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 3458 3592 ce = columns - 1; 3459 3593 int cursor_column = 0; 3460 3594 sp = &screen[li * columns]; // start of screen line 3595 #else 3596 ce = bytes - 1; 3597 int cursor_column = 0; 3598 sp = &screen[li * columns * MULTI_BYTE_MULTIPLE]; // start of screen line 3599 #endif 3461 3600 if (full_screen) { 3462 3601 // force re-draw of every single column from 0 - columns-1 … … 3494 3633 #else 3495 3634 while (ce >= cs) { 3496 int code_size = bs_char_count( sp, ce);3635 int code_size = bs_char_count(out_buf, ce); 3497 3636 if (memcmp(&out_buf[ce], &sp[ce], code_size)) { 3498 3637 changed = TRUE; // mark for redraw … … 3501 3640 ce -= code_size; 3502 3641 } 3642 if (view_co < columns - 1) 3643 ce = bytes; 3503 3644 #endif 3504 3645 // now, cs is index of first diff, and ce is index of last diff … … 3511 3652 3512 3653 // make a sanity check of columns indexes 3654 #ifndef ENABLE_BASIC_MULTI_CHAR_CODE 3513 3655 if (cs < 0) { cs = 0; cursor_column = 0; } 3514 3656 if (ce > columns - 1) ce = columns - 1; 3515 3657 if (cs > ce) { cs = 0; ce = columns - 1; cursor_column = 0; } 3658 #else 3659 if (cs < 0) { cs = 0; cursor_column = 0; } 3660 if (get_view_col_from_bytes(out_buf, ce, (columns * MULTI_BYTE_MULTIPLE)) > columns - 1) 3661 ce = get_bytes_from_view_col(out_buf, columns, (columns * MULTI_BYTE_MULTIPLE)) - 1; 3662 if (cs > ce) { 3663 cs = 0; 3664 ce = get_bytes_from_view_col(out_buf, columns, (columns * MULTI_BYTE_MULTIPLE)) - 1; 3665 cursor_column = 0; 3666 } 3667 #endif 3516 3668 // is there a change between virtual screen and out_buf 3517 3669 if (changed) { -
EcnlProtoTool/trunk/prototool/src/main.c
r321 r331 49 49 #include <netdb.h> 50 50 #include <unistd.h> 51 #include <setjmp.h>52 51 #include <signal.h> 53 52 #include <time.h> 54 53 #include <sys/time.h> 55 #include < sys/unistd.h>54 #include <unistd.h> 56 55 #include <errno.h> 57 56 … … 65 64 #include <mruby/dump.h> 66 65 #include <mruby/string.h> 67 #include < usrcmd.h>66 #include <ntshell/usrcmd.h> 68 67 69 68 #define ETHER_MAX_LEN 1518 … … 89 88 extern int mruby_main(int argc, char **argv); 90 89 extern int mirb_main(int argc, char **argv); 90 extern int curl_main(int argc, char **argv); 91 91 extern int tcc_main(int argc, char **argv); 92 92 extern int vi_main(int argc, char **argv); … … 101 101 {"mruby","mruby command", mruby_main}, 102 102 {"mirb", "Embeddable Interactive Ruby Shell", mirb_main}, 103 {"curl", "Command lines or scripts to transfer data", curl_main}, 103 104 {"tcc", "Tiny C compiler", tcc_main}, 104 105 {"vi", "Text editor", vi_main}, 105 {"cd", "change directory", usrcmd_cd },106 {"ls", "list files", usrcmd_ls },107 {"cp", "copy file", usrcmd_cp },108 {"rm", "remove file", usrcmd_rm },109 {"mv", "move file", usrcmd_mv },110 {"mkdir", "Make directory", usrcmd_mkdir},111 {"hexdump", "Hex dump", usrcmd_hexdump},112 106 {"onitest", "Onigumo Test", onitest_main}, 113 107 {"tcp_echo", "TCP echo server/client", tcp_echo_main}, 114 108 {"help", "This is a description text string for help command.", usrcmd_help}, 115 {"info", "This is a description text string for info command.", usrcmd_info},116 {"exit", "Exit Natural Tyny Shell", usrcmd_exit},117 109 }; 118 110 cmd_table_info_t cmd_table_info = { &cmdlist, sizeof(cmdlist) / sizeof(cmdlist[0]) }; … … 521 513 } 522 514 523 // Provide implementation of _sbrk (low-level dynamic memory allocation 524 // routine) for GCC_ARM which compares new heap pointer with MSP instead of 525 // SP. This make it compatible with RTX RTOS thread stacks. 526 527 // Linker defined symbol used by _sbrk to indicate where heap should start. 528 int _end; 529 uint32_t _stack; 530 531 // Turn off the errno macro and use actual global variable instead. 532 #undef errno 533 int errno; 534 535 static unsigned char* heap = (unsigned char*)&_end; 536 537 // Dynamic memory allocation related syscall. 538 caddr_t _sbrk(int incr) { 539 unsigned char* prev_heap = heap; 540 unsigned char* new_heap = heap + incr; 541 542 if (new_heap >= (unsigned char*)&_stack) { /* _stack is end of heap section */ 543 errno = ENOMEM; 544 return (caddr_t)-1; 545 } 546 547 heap = new_heap; 548 return (caddr_t) prev_heap; 549 } 550 551 char *optarg; 515 void _start_c(long *p); 552 516 int _data, _mdata, _edata; 553 517 int _bss, _ebss; 554 518 555 int _PowerON_Reset(int argc, char **argv)519 void _PowerON_Reset(long *args) 556 520 { 557 521 memcpy(&_data, &_mdata, (size_t)&_edata - (size_t)&_data); 558 522 memset(&_bss, 0, (size_t)&_ebss - (size_t)&_bss); 559 523 560 optarg = *argv; 561 return main(argc, argv); 524 _start_c(args); 562 525 } 563 526 -
EcnlProtoTool/trunk/prototool/src/onitest.c
r321 r331 9 9 10 10 #ifdef POSIX_TEST 11 #include "onig posix.h"11 #include "onigmoposix.h" 12 12 #else 13 #include "onig uruma.h"13 #include "onigmo.h" 14 14 #endif 15 15 … … 197 197 x2("\\x1f", "\x1f", 0, 1); 198 198 x2("a(?#....\\\\JJJJ)b", "ab", 0, 2); 199 x2("(?x) G (o O(?-x)oO) g ", "GoOoOgLe", 0, 7);199 x2("(?x) G (o O(?-x)oO) g L", "GoOoOgLe", 0, 7); 200 200 x2(".", "a", 0, 1); 201 201 n(".", "");
Note:
See TracChangeset
for help on using the changeset viewer.