他の言語をある程度知っている人はこれを読めばD言語の基礎をマスターでき,D言語の氷山の一角くらいは知ることができると思います.対象バージョンはdmd 2.059です.
ASCIIかUTFしか受け付けません.それ以外の文字コードで書くとコンパイルエラーになります.
D言語のmainはCとは違い以下のようなシグネチャです.
| SRC_BASE = f'{BASE}/misc' | |
| SRC_BITMAP_8x8 = f'{SRC_BASE}/bmp_hex_136x8.png' | |
| SRC_BITMAP_16x16 = f'{SRC_BASE}/bmp_hex_256x256_16x16.png' | |
| PPM_BASE = f'{BASE}/textures' | |
| PPM_TEXTURE_8x8 = f'{PPM_BASE}/custom_%c.ppm' | |
| PPM_TEXTURE_16x16 = f'{PPM_BASE}/ascii_%02X.ppm' | |
| cols = [ | |
| (0xff, 0x00, 0xff), | |
| (0xff, 0x00, 0x00), |
| // gcc -o try-catch-ex try-catch.c try-catch-ex.c | |
| #include <stdio.h> | |
| #include "try-catch.h" | |
| // Example of use for try-catch.h | |
| int main(int argc, char *argv[]) | |
| { | |
| int i = 101; | |
| printf("before try block...\n"); |
| # PCD8544 (Nokia 5110) LCD sample for Raspberry Pi Pico | |
| # Required library: | |
| # https://github.com/mcauser/micropython-pcd8544 | |
| # And this sample script is based on above repository. | |
| # Connections: | |
| # [pcd8544:pico(physical pin)] | |
| # Gnd: Pico GND (38) | |
| # BL : Pico GP28(34) | |
| # Vcc: Pico 3V3 (36) |
| import win32serviceutil | |
| import win32service | |
| import win32event | |
| import servicemanager | |
| import socket | |
| import time | |
| import logging | |
| logging.basicConfig( | |
| filename = 'c:\\Temp\\hello-service.log', |
| // ヘッダファイルのインクルード | |
| #include <windows.h> // 標準WindowsAPI | |
| #include <tchar.h> // TCHAR型 | |
| #include <stdio.h> // 標準入出力 | |
| // 関数プロトタイプ宣言 | |
| VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR * lpszArgv); // サービスの中核処理. | |
| VOID WINAPI Handler(DWORD fdwControl); // サービス制御要求に対するハンドラ処理. | |
| // グローバル変数の初期化. |
| /*The win32 service runs with its current working directory set to C:\Windows\System32 | |
| *You might need to place anyrun-time configuration scripts there. | |
| *If you run into any confusion with the above detail, it is worthwhile to | |
| *set the current working directory to your application installation directory like I did | |
| */ | |
| MyApp::OnInit() | |
| { | |
| // | |
| // |