11월, 2016의 게시물 표시

OS/2 tricks: How to set up DBCS environment on SBCS OS/2 #2 Display DBCS characters

Displaying DBCS characters on SBCS requires at least two things. First is a font driver supporting UNICODE fonts correctly, second is fonts themselves for DBCS. Other than these, there are some other things needed. 1. Font Driver Nowadays, most of fonts are True Type Font. OS/2 also supports it. However, default true type font driver does not support unicode fonts correctly. Especially, DBCS fonts. So if you want to use DBCS fonts, you should install another font driver for a true type font. It's <FreeType/2> . FreeType/2 has several versions. 1.0.x and 1.1.x released by Michael Necasek, 1.2.x released by me, 1.3.x and 2.x released by Alex Taylor. Out of these, you should use 1.2.x or later. You can get them here. FreeType/2 1.2.x: http://www.ecomstation.co.kr/komh/os2factory/#freetype2 FreeType/2 IFI 1.3.x and 2.x: http://www.altsan.org/programming/os2/index.html#ft2 For installations, see their README. 2. Font IBM provided fonts containing CJK glyphs by

OS/2 tricks: How to set up DBCS environment on SBCS OS/2 #1 Configuration

이미지
The first step to enable DBCS environment is to configure your system. 1. CODEPAGE statement OS/2 is a system based on a code page. You can specify two code pages.  For example, you can see the line like following in config.sys CODEPAGE=850,437 First is a primary code page, which is used by processes by default. Second is a secondary code page, which is an auxiliary code page used by some processes on demand. To enable DBCS environment, you should add a DBCS code page which you want to use to CODEPAGE as a primary or a secondary. For example, CODEPAGE=850,949 949 is a Korean code page. Like this, adding a DBCS code page as a secondary code page is most safe. Because if a DBCS code page is used as a primary code page, 1. You will see an error like this on every boot. SYS1729: The code page 949 is not acceptable for the display. Press Enter to continue... 2. Some programs may conflict with DBCS code pages. For example, some resources of eWP is corrupted like this.

토렌트: NGC < 코스모스 > 우리말 더빙 전편(1편~13편) 마그넷

1980년에 제작된 칼 세이건의 <코스모스>를 2014년에 리메이크한 작품을 내셔널 지오그래픽 채널(NGC)에서방영한 우리말 더빙판 <코스모스> 입니다. 과학에, 특히 천문에 관심있는 분들이라면 필히 보아야 하는 작품입니다. DVD 나 Blu-Ray 로도 따로 하나 장만해야겠습니다. NGC <코스모스> 우리말 더빙 마그넷 주소: magnet:?xt=urn:btih:776043FDFACF88F5073D7B8FC3CEDC0B7B3F3F6B 마그넷 주소로 토렌트 다운 받기 uTorrent 다운 받기 마그넷 주소 클릭하기 uTorrent 가 자동으로 실행되면 그대로 토렌트 다운 받기 uTorrent 가 자동으로 실행되지 않으면 마그넷 링크 주소 복사 uTorrent 실행 [파일] - [주소에서 토렌트 추가] 클립보드에 저장한 주소가 입력 창에 입력 되어 있음 복사한 주소가 아니면 마그넷 링크 주소 복사 토렌트 다운 받기

OS/2 tricks: How to set up DBCS environment on SBCS OS/2 #0 Prologue

There are two versions on OS/2 according to the locale. One is SBCS version, and the other one is DBCS version. Still OS/2 does not support unicode as a base system character set. This separation is also inherited by OEM versions such as eComStation and ArcaOS. However, those OEMs lacks DBCS version. Although it was known that beta versions of DBCS eComstation was there, I know, GA version has not been released at all. So if you want to use DBCS version of OS/2, then you should use old-good OS/2 up to MCP2. Even MCP2 of DBCS OS/2 does not support some countries such as Korea. As a result, DBCS users who want to use the latest OS/2 including OEMs, should use SBCS OS/2. Then, is it possible to use DBCS features on SBCS OS/2 ? Yes, but partially. Afterwards, let's find the ways.

OS/2 codes: How to get a module name from a symbol

Sometimes it's needed to know the module where a symbol is. For example, it's needed to know the location of a DLL where I am. To do this, two APIs are required. One is DosQueryModFromEIP() and the other one is DosQueryModuleName(). 1. DosQueryModFromEIP() Here is the description. Purpose DosQueryModFromEIP queries a module handle and name from a given flat address. It takes a flat 32 bit address as a parameter and returns information about the module (a protect mode application currently executing) owning the storage. Syntax #define INCL_DOSMODULEMGR #include os2.h> APIRET APIENTRY DosQueryModFromEIP (HMODULE *phMod, ULONG *pObjNum, ULONG BuffLen, PCHAR pBuff, ULONG *pOffset, ULONG Address) Parameters phMod (PHMODULE) output Address of a location in which the module handle is returned. pObjNum (PULONG) output Address of a ULONG where the module object number corresponding to the Address is returned. The object is zero based. BuffLen (ULONG) i

Bash 쉘 스크립트 가이드 1.0

kldp 에서 눈팅만 하다가, 좋은 자료가 있어 소개한다. 대부분의 리눅스에서 기본 쉘로 쓰이는 BASH 에 대한 안내서이다. gitbook 과 github 에서 진행되고 있다. 가장 큰 장점은 한글로 작성되어 있어 읽기 편하다는 것이고, BASH 를 체계적으로 설명하고있다는 것이다. 지속적으로 업데이트를 한다고 하니, 수시로 방문해 보는 것도 좋을 듯 하다. gitbook 주소 : https://mug896.gitbooks.io/shell-script/content/   github 주소 : http://mug896.github.io/bash-shell/   * 출처: https://kldp.org/node/154415

OS/2 codes: How to get a network interface name from an index and a description of struct ifmib

OS/2 socket call, os2_ioctl( SIOSTATIF42 ), provides the informations about network interfaces available on a machine through struct ifmib . However, struct ifmib does not have a member for a canonical network interface name such as 'lan0'. Instead of, it has an index and a description of a network interface. Fortunately, with those informations it's possible to get a canonical network interface name. An algorithm for this can be found in ODIN sources. See http://trac.netlabs.org/odin32/browser/trunk/src/iphlpapi/iphlpapi.cpp#L169   Based on the above codes, I've made an utility function to get a canonical network name from an index and a description of struct ifmib . See source: https://github.com/komh/os2codes/blob/master/network/getifname.c header: https://github.com/komh/os2codes/blob/master/network/getifname.h test: https://github.com/komh/os2codes/blob/master/network/getifname-test.c

OS/2 codes: How to get MAC address of network interfaces

MAC address is an 48-bits unique hardware address of a network adapter. OS/2 provides socket calls to retrive MAC address from network adapters. First way is to use os2_ioctl( SIOSTATIF42 ) . It returns the informations about all network interfaces available on a machine into struct ifmib . struct ifmib is based on an index of a network interface. That is, it does not provides canonical name of a network interface such as lan0. You should mangle a canonical name from a description field and an index field. For details, see the following ODIN sources. http://trac.netlabs.org/odin32/browser/trunk/src/iphlpapi/iphlpapi.cpp#L169 Second is ioctl( SIOCGIFCONF ) . It returns the information about all network interfaces available on a machine into struct ifconf . On TCP/IP v4.21 or later, struct ifconf may contain AF_LINK address storage. In this case, strcut ifconf contains a canonical name of a network interface, its index and its MAC address. Here is the implementation to re

Porting to OS/2: Case #26 getrusage()

getrusage() provides measure of resource used by the current process or its child processes. See for details. http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrusage.html OS/2 kLIBC has a declaration of getrusage(), but not implemented it actually. Instead, OS/2 kLIBC provides a minimal information for getrusage(). Here is the implementation using it. source: https://github.com/komh/os2compat/blob/master/process/getrusage.c test: https://github.com/komh/os2compat/blob/master/testcase/getrusage-1.c

Porting to OS/2: Case #25 POSIX semaphores

POSIX semaphores are used to control the execution of threads. There are unnamed semaphores and named semaphores. Although named semaphores are always shareable between processes, unnamed semaphores may be private or shareable between processes. Out of these, implementation of unnamed private semaphore is here. source: https://github.com/komh/os2compat/blob/master/thread/semaphore.c header: https://github.com/komh/os2compat/blob/master/thread/semaphore.h test: https://github.com/komh/os2compat/blob/master/testcase/semaphore-1.c  

내 맘대로 비교하기: <자바스크립트 완벽 가이드> 와 <프론트엔드 개발자를 위한 자바스크립트 프로그래밍>

이미지
예전에 Qt 로 <환율 계산기>( http://lvzuufx.blogspot.com/2015/08/qt_11.html ) 를 만들면서 느낀 것이지만, 웹 관련 프로그래밍을 하려면 결국 자바스크립트를 해야만 한다. 떡본 김에 제사 지낸다고 했던가 ? 자바스크립트를 공부하기로 마음 먹고, 많은 분들이 추천하고 있는 책이 무엇인지 살펴보니, 대략 두 권 정도가 공통적으로 나왔다. 하나는 소위 코뿔소 책으로 유명한 <자바스크립트 완벽 가이드> 였고, 다른 하나는 <프론트엔드 개발자를 위한 자바스크립트 프로그래밍> 이었다. 1. <프론트엔드 개발자를 위한 자바스크립트 프로그래밍> 니콜라스 자카스 지음, 한선용 옮김, 인사이트 출판사 출처: http://www.yes24.com/ 전체 분량이 1100 쪽을 넘어간다. 게다가 아주 꼼꼼하게 자바스크립트 설명으로 채워져 있다. 한꺼번에 다 읽을 생각보다는 쉬엄 쉬엄 읽어가야지 하는 마음으로 천천히 다 읽었다. 이 책의 특징이라면 자바스크립트를 엄격하게 사용할 것을 요구한다는 것이다. 예를 들어, 배열과 객체의 차이점을 강조하고 있다. 배열은 숫자를 인덱스로 받아들이고, 객체는 문자열을 인덱스로 받아들이니, 이 둘을 혼용하지 말라고 말한다. 아울러 HTML 요소의 id, name 속성을 자바스크립트에서 변수로 사용하지 말라고도 한다. 과거의 유산(legacy) 이기에 지금도 허용되고 있지만 언제라도 바뀔 수 있기 때문이다. 대신에 document.getElementById() 같은 메쏘드를 꼭 이용하라고 한다. 엄격 모드(strict mode) 와 비엄격 모드(non-strict mode) 의 차이점에 대해서도 꾸준히 언급하는데, 같은 이유인 듯하다. 이 책을 읽으면서 꽤 인상깊었던 부분이 있었는데, 객체의 생성과 상속에 관한 부분이었다. 그 당시 알려진 여러 방법을 소개하고 장단점을 살피는데, 그 연구의 깊이가 느껴진다고 할까 ? 자바스크립트의 객체

Porting to OS/2: Case #24 scandir() and alphsort()

scandir() scans a directory, and alphsort() is provided to scandir() as a comparison function to sort directory entries into alphabetical order. OS/2 kLIBC has a declaration for scandir(), but has not implemented it. In case of alphsort(), OS/2 kLIBC has no even the declaration for it. Here is the implementation and a test for them. source: https://github.com/komh/os2compat/blob/master/io/scandir.c header: https://github.com/komh/os2compat/blob/master/io/scandir.h test: https://github.com/komh/os2compat/blob/master/testcase/scandir-1.c This implementation follows OS/2 kLIBC declaration. However, notice that OS/2 kLIBC declaration is slightly different from POSIX specs. See the comments for details.

Porting to OS/2: Case #23 if_nameindex() family

if_nameindex() is used to retrive all network interface names and indexes. if_freenameindex() is used to free internal storages allocated by if_nameindex(). And there is a family which maps a network inteface name to its corresponding index, and vice versa. They are if_nametoindex() and if_indextoname() . OS/2 has no them. Fortunately, however, OS/2 provides socket calls to implement them. First, you can use os2_ioctl( SIOSTATIF42 ) . This call provides interface statistics for all interfaces up to 42 via struct ifmib which includes a index and a description of a network interface. A index is 0-based. However, if_nameindex() family accepts 0-index as the last entry of network interfaces or an invalid index. So it's needed to increase the index by 1. A description is a long description not a short description. For example, Ethernet-Csmacd not lan0. So you should generate a canonical name from a description and an index. For details, see the following ODIN source. htt

Porting to OS/2: Case #22 _response()

OS/2 kLIBC provides _response() to expand arguments from a response file. And this enables to pass a very long command line. Because OS/2 itself has the limit of a command line length up to 32K. By the way, _response() has a problem. It limits characters per line up to 8192 characters. So if a line has characters more than 8192, then the line is splitted into two or more lines. This is not an expected behavior. To overcome this, I've reimplemented _response() without a line length limit. Here it is. _response(): https://github.com/komh/os2compat/blob/master/process/_response.c   test: https://github.com/komh/os2compat/blob/master/testcase/_response-1.c

Porting to OS/2: Case #21 setmode()

setmode() is used to change the text/binary mode of a file handle. By the way, these modes exists on DOS-like OSes such as OS/2, Windows and DOS. Whereas, UNIX-like OSes such as Linux don't distinguish these modes. They treats all the file handles as a binary mode. In addition, they uses pipes actively via standard handles such as stdin, stdout and stderr. By the way, on OS/2, they are opened in a text mode by default. So it is general to call setmode() in order to change standard handles to a binary mode at the beginning. Because -Zbin-files does not affect on standard handles. This is a good strategy. However, standard handles are used to input from keyboard and to output to a screen, too. As a result, if you change standard handles to binary mode when they are not connected to pipes, then you would encounter unexpected behaviors. For example, if you output two lines, "Hello," and "World", then you expect like this. Hello, World Instead, howver, yo

Porting to OS/2: Case #20 CMSG_ALIGN, CMSG_SPACE and CMSG_LEN macros

OS/2 kLIBC has been missing some control message such as CMSG_ALIGN , CMSG_SPACE and CMSG_LEN macros until 0.6.6. They should be like this, Colored By Color Scripter ™ 1 2 3 4 #define  CMSG_ALIGN( len ) _ALIGN( len ) #define  CMSG_SPACE( len ) ( CMSG_ALIGN(  sizeof (  struct  cmsghdr )) + \                             CMSG_ALIGN( len )) #define  CMSG_LEN( len ) ( CMSG_ALIGN(  sizeof (  struct  cmsghdr )) + ( len )) Here, struct msghdr is in sys/socket.h . See the following link for a detail. https://github.com/komh/os2compat/blob/master/network/cmsg.h

OS/2 codes: How to make 'char' type of gcc + kLIBC compatible with IBM Visual Age C/C++ and Open Watcom C/C++

When you compile sources for IBM Visual Age C/C++(later VAC) or Open Watcom C/C++(later OW) with gcc/g++ + kLIBC(later gcc), there is a thing you should notice. It is char type. char type is a primitivie type to hold a character on C/C++. And it is usually 1-byte size. If it holds an integer, it can be singned char or unsigned char according to implementaiton. VAC and OW define char to unsigned char by default. Its range is 0 to 255. On the other hands, gcc define char to signed char by default. Its range is -128 to 127. This difference has no problem usually. However, if bit-wise operation is used or DBCS characters manipulations are performed, potential problems may occur. For example, if you did right-bit-shift by 1 on a char varaible holding 128(10000000 in binary), you would expect 64(01000000b). But you may get 64(01000000, VAC and OW) or -64(11000000b, gcc). This is because right-bit-shift conserve MSB(sign-bit) if signed-type. Try to build and run the follo

OS/2 announce: GnuTLS v3.4.16/Nettle v3.3/GMP v6.1.1 for OS/2 released

GnuTLS v3.4.16/Nettle v3.3/GMP v6.1.1 for OS/2 have been released. OS/2 용 GnuTLS v3.4.16/Nettle v3.3/GMP v6.1.1 이 공개되었습니다. They can be downloaded from : 다음 링크를 클릭하면 받을 수 있습니다 : GnuTLS v3.4.16 Nettle v3.3 GMP v6.1.1 Enjoy Warping !!! Korean OS/2 User Community : http://www.ecomstation.co.kr

OS/2 announce: mksh R54 for OS/2 released

mksh R54 for OS/2 has been released. OS/2 용 mksh R54 를 발표하였습니다. It can be downloaded from : 다음 링크를 클릭하면 받으실 수 있습니다 : http://hobbes.nmsu.edu/h-search.php?key=mksh-R54.zip&pushbutton=Search Enjoy Warping !!! Korean OS/2 User Community : http://www.ecomstation.co.kr