GNU Pascalの入手とインストール |
---|
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\PG>CD GNUPascal
C:\PG\GNUPascal>C:\GPC\msys\1.0\bin\tar zxvfgpc-20070904.i386-pc-mingw32.tar.gz
mingw/
mingw/bin/
mingw/bin/gpc.exe
mingw/bin/gpc-run
mingw/bin/binobj.exe
mingw/bin/gpidump.exe
・
・(中略)
・
mingw/man/
mingw/man/man1/
mingw/man/man1/binobj.1
mingw/man/man1/gpidump.1
mingw/man/man1/gpc.1
mingw/man/man1/gpc-run.1
C:\PG\GNUPascal>
C:\PG\GNUPascal>XCOPY /S/Y mingw\. C:\GPC\.
mingw\.\bin\binobj.exe
mingw\.\bin\gpc-run
mingw\.\bin\gpc.exe
mingw\.\bin\gpidump.exe
mingw\.\doc\gpc\AUTHORS
mingw\.\doc\gpc\BUGS
・
・(中略)
・
mingw\.\libexec\gcc\mingw32\3.4.5\collect2.exe
mingw\.\libexec\gcc\mingw32\3.4.5\gpc1.exe
mingw\.\man\man1\binobj.1
mingw\.\man\man1\gpc-run.1
mingw\.\man\man1\gpc.1
mingw\.\man\man1\gpidump.1
348 個のファイルをコピーしました
C:\PG\GNUPascal>
GNU PascalのPATHの設定 |
---|
@ECHO OFF REM REM GNU Pascal 環境変数設定(MinGW版)。 REM CALL resetpath.cmd SET LANG=ja_JP.SJIS SET C_INCLUDE_PATH= SET GCC_BASE= SET GCC_BASE_MINGW=4.8.1 SET GCC_BASE_GPC=3.4.5 SET GPC_EXEC_PREFIX=C:\GPC\libexec\gcc\mingw32;%GCC_BASE_GPC% SET LIBRARY_PATH=C:\MinGW32\lib;C:\MinGW32\lib\gcc\mingw32\%GCC_BASE_MINGW% SET LIBRARY_PATH=%LIBRARY_PATH%;C:\GPC\lib\gcc\mingw32\%GCC_BASE_GPC% SET GPC_UNIT_PATH=C:\GPC\lib\gcc\mingw32\%GCC_BASE_GPC%\units PATH C:\MinGW32\bin\;C:\MinGW32\msys\1.0\bin;C:\GPC\bin;%PATH%
C:\PG\GNUPascal>gnupas
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 -o Hello.exe 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 # ISO 7185 Pascal #GPCFLAGS = --standard-pascal $(MAIN).exe : $(MAIN).p $(MOD1).o gpc $(GPCFLAGS) -o $(MAIN).exe $(MAIN).p $(MOD1).o : $(MOD1).p @rm -f $(MOD1)-all.gpi $(INT1).gpi gpc $(GPCFLAGS) -c -o $(MOD1).o $(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 -c -o SayHelloMod.o SayHelloMod.p
gpc --extended-pascal -o Hello2.exe 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>