GNU Pascalの入手とインストール |
---|
GNU PascalのPATHの設定 |
---|
@ECHO OFF REM REM GNU Pascal 環境変数設定(Dev+GNU Pascal版)。 REM CALL resetpath.cmd SET LANG=ja_JP.SJIS SET C_INCLUDE_PATH=c:\dev_gpc\include SET GCC_BASE=3.4.5 SET GPC_EXEC_PREFIX=c:\dev_gpc\libexec\gcc\mingw32 SET LIBRARY_PATH=c:\dev_gpc\lib;c:\dev_gpc\lib\gcc\mingw32\%GCC_BASE% SET GPC_UNIT_PATH=c:\dev_gpc\lib\gcc\mingw32\%GCC_BASE%\units SET GPC_UNIT_PATH=%GPC_UNIT_PATH%;c:\dev_gpc\units SET GPC_UNIT_PATH=%GPC_UNIT_PATH%;c:\dev_gpc\units\winapi SET GPC_UNIT_PATH=%GPC_UNIT_PATH%;c:\dev_gpc\units\objects SET GPC_UNIT_PATH=%GPC_UNIT_PATH%;c:\dev_gpc\units\sysutils SET GPC_UNIT_PATH=%GPC_UNIT_PATH%;c:\dev_gpc\units\objmingw PATH C:\dev_gpc\bin;C:\MinGW32\msys\1.0\bin;%PATH%
C:\PG\GNUPascal>gnupas2
C:\PG\GNUPascal>gpc
GNU Pascal version 20070904, based on gcc-3.4.5 (mingw special).
Copyright (C) 1987-2006 Free Software Foundation, Inc.
GNU Pascal is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Pascal is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
For more version information on components of the GNU Pascal compiler,
especially useful when reporting bugs, type the command
`gpc --verbose'.
Most used command line options:
-c Compile or assemble the source files, but do not link.
-o FILE Place output in file FILE.
--automake Automatically (re)compile modules/units.
-v Be verbose.
The command line options are described in the online documentation.
`info -f gpc invoking' describes them in detail.
Report bugs to <gpc@gnu.de>.
C:\PG\GNUPascal>
ISO 標準 PascalのHollo, world. |
---|
{ ISO PascalのHello, world.(日本語版) } program Hello(Output); begin WriteLn(Output, '世界よ、こんにちは。') end.
C:\PG>CD GNUPascal\Hello
C:\PG\GNUPascal\Hello>gpc --standard-pascal --executable-file-name Hello.p
C:\PG\GNUPascal\Hello>Hello
世界よ、こんにちは。
C:\PG\GNUPascal\Hello>
ISO 拡張 PascalのHollo, world. |
---|
{=============================================================================} {= プログラム:Hello2 =} {=============================================================================} program Hello2(Output); { SayHelloMod から HelloProcs をインポート。ただし SayHelloEng と SayHelloJpn のみ } import HelloProcs only (SayHelloEng, SayHelloJpn); begin SayHelloEng(Output); { SayHelloMod の SayHelloEng の呼び出し } SayHelloJpn(Output); { SayHelloMod の SayHelloJpn の呼び出し } end.
{=============================================================================} {= モジュール:SayHelloMod 【インターフェース部】 =} {=============================================================================} module SayHelloMod interface; export HelloProcs = (SayHelloEng, SayHelloGmn, SayHelloJpn); procedure SayHelloEng(var F : Text); procedure SayHelloGmn(var F : Text); procedure SayHelloJpn(var F : Text); end. {=============================================================================} {= モジュール:SeyHelloMod 【実現部】 =} {=============================================================================} module SayHelloMod implementation; { 英語 } procedure SayHelloEng; begin WriteLn(F, 'Hello, World.'); end; { ドイツ語 } procedure SayHelloGmn; begin WriteLn(F, 'Hallo, Welt.'); end; { 日本語 } procedure SayHelloJpn; begin WriteLn(F, '世界よ、こんにちは。'); end; end.
# # Hello2 の メイクファイル # MAIN = Hello2 MOD1 = SayHelloMod INT1 = HelloProcs # ISO 10206 Extended Pascal GPCFLAGS = --extended-pascal --executable-file-name # ISO 7185 Pascal #GPCFLAGS = --standard-pascal --executable-file-name $(MAIN).exe : $(MAIN).p $(MOD1).o gpc $(GPCFLAGS) $(MAIN).p $(MOD1).o : $(MOD1).p @rm -f $(MOD1)-all.gpi $(INT1).gpi gpc $(GPCFLAGS) -c $(MOD1).p clean : rm -f $(MAIN).exe $(MOD1).o $(MOD1)-all.gpi $(INT1).gpi
C:\PG>CD GNUPascal\Hello2
C:\PG\GNUPascal\Hello2>make
gpc --extended-pascal --executable-file-name -c SayHelloMod.p
gpc --extended-pascal --executable-file-name Hello2.p
C:\PG\GNUPascal\Hello2>Hello2
Hello, World.
世界よ、こんにちは。
C:\PG\GNUPascal\Hello2>
C:\PG\GNUPascal\Hello2>make clean
rm -f Hello2.exe SayHelloMod.o SayHelloMod-all.gpi HelloProcs.gpi
C:\PG\GNUPascal\Hello2>
Dev+GNU PascalでHollo, world. |
---|
C:\PG>CD GNUPascal\HelloDev
C:\PG\GNUPascal\HelloDev>hellodev
世界よ、こんにちは。
C:\PG\GNUPascal\HelloDev>