60
ofit.Inaddition,youmustdothesethingsintheModifiedVersion:
A.UseintheTitlePage(andonthecovers,ifany)atitledistinct
fromthatoftheDocument,andfromthoseofpreviousversions
(whichshould,iftherewereany,belistedintheHistorysection
oftheDocument).Youmayusethesametitleasapreviousversion
iftheoriginalpublisherofthatversiongivespermission.
B.ListontheTitlePage,asauthors,oneormorepersonsorentities
responsibleforauthorshipofthemodificationsintheModified
Version,togetherwithatleastfiveoftheprincipalauthorsofthe
Document(allofitsprincipalauthors,ifithasfewerthanfive),
unlesstheyreleaseyoufromthisrequirement.
C.StateontheTitlepagethenameofthepublisherofthe
ModifiedVersion,asthepublisher.
D.PreserveallthecopyrightnoticesoftheDocument.
E.Addanappropriatecopyrightnoticeforyourmodifications
adjacenttotheothercopyrightnotices.
F.Include,immediatelyafterthecopyrightnotices,alicensenotice
givingthepublicpermissiontousetheModifiedVersionunderthe
termsofthisLicense,intheformshownintheAddendumbelow.
G.PreserveinthatlicensenoticethefulllistsofInvariantSections
andrequiredCoverTextsgivenintheDocument'slicensenotice.
H.IncludeanunalteredcopyofthisLicense.
I.PreservethesectionEntitled"History",PreserveitsTitle,andadd
toitanitemstatingatleastthetitle,year,newauthors,and
publisheroftheModifiedVersionasgivenontheTitlePage.If
thereisnosectionEntitled"History"intheDocument,createone
statingthetitle,year,authors,andpublisheroftheDocumentas
givenonitsTitlePage,thenaddanitemdescribingtheModified
Versionasstatedintheprevioussentence.
J.Preservethenetworklocation,ifany,givenintheDocumentfor
publicaccesstoaTransparentcopyoftheDocument,andlikewise
thenetworklocationsgivenintheDocumentforpreviousversions
itwasbasedon.Thesemaybeplacedinthe"History"section.
Youmayomitanetworklocationforaworkthatwaspublishedat
leastfouryearsbeforetheDocumentitself,oriftheoriginal
publisheroftheversionitreferstogivespermission.
K.ForanysectionEntitled"Acknowledgements"or"Dedications",
PreservetheTitleofthesection,andpreserveinthesectionall
thesubstanceandtoneofeachofthecontributoracknowledgements
and/ordedicationsgiventherein.
L.PreservealltheInvariantSectionsoftheDocument,
unalteredintheirtextandintheirtitles.Sectionnumbers
ortheequivalentarenotconsideredpartofthesectiontitles.
M.DeleteanysectionEntitled"Endorsements".Suchasection
maynotbeincludedintheModifiedVersion.
N.DonotretitleanyexistingsectiontobeEntitled"Endorsements"
ortoconflictintitlewithanyInvariantSection.
O.PreserveanyWarrantyDisclaimers.
IftheModifiedVersionincludesnewfrontmattersectionsor
appendicesthatqualifyasSecondarySectionsandcontainnomaterial
copiedfromtheDocument,youmayatyouroptiondesignatesomeorall
ofthesesectionsasinvariant.Todothis,addtheirtitlestothe
listofInvariantSectionsintheModifiedVersion'slicensenotice.
Thesetitlesmustbedistinctfromanyothersectiontitles.
YoumayaddasectionEntitled"Endorsements",provideditcontains
nothingbutendorsementsofyourModifiedVersionbyvarious
partiesforexample,statementsofpeerrevieworthatthetexthas
beenapprovedbyanorganizationastheauthoritativedefinitionofa
standard.
233
49
YoumayaddapassageofuptofivewordsasaFrontCoverText,anda
passageofupto25wordsasaBackCoverText,totheendofthelist
ofCoverTextsintheModifiedVersion.Onlyonepassageof
FrontCoverTextandoneofBackCoverTextmaybeaddedby(or
througharrangementsmadeby)anyoneentity.IftheDocumentalready
includesacovertextforthesamecover,previouslyaddedbyyouor
byarrangementmadebythesameentityyouareactingonbehalfof,
youmaynotaddanother;butyoumayreplacetheoldone,onexplicit
permissionfromthepreviouspublisherthataddedtheoldone.
Theauthor(s)andpublisher(s)oftheDocumentdonotbythisLicense
givepermissiontousetheirnamesforpublicityforortoassertor
implyendorsementofanyModifiedVersion.
5.COMBININGDOCUMENTS
YoumaycombinetheDocumentwithotherdocumentsreleasedunderthis
License,underthetermsdefinedinsection4aboveformodified
versions,providedthatyouincludeinthecombinationallofthe
InvariantSectionsofalloftheoriginaldocuments,unmodified,and
listthemallasInvariantSectionsofyourcombinedworkinits
licensenotice,andthatyoupreservealltheirWarrantyDisclaimers.
ThecombinedworkneedonlycontainonecopyofthisLicense,and
multipleidenticalInvariantSectionsmaybereplacedwithasingle
copy.IftherearemultipleInvariantSectionswiththesamenamebut
differentcontents,makethetitleofeachsuchsectionuniqueby
addingattheendofit,inparentheses,thenameoftheoriginal
authororpublisherofthatsectionifknown,orelseauniquenumber.
Makethesameadjustmenttothesectiontitlesinthelistof
InvariantSectionsinthelicensenoticeofthecombinedwork.
Inthecombination,youmustcombineanysectionsEntitled"History"
inthevariousoriginaldocuments,formingonesectionEntitled
"History";likewisecombineanysectionsEntitled"Acknowledgements",
andanysectionsEntitled"Dedications".Youmustdeleteallsections
Entitled"Endorsements".
6.COLLECTIONSOFDOCUMENTS
YoumaymakeacollectionconsistingoftheDocumentandotherdocuments
releasedunderthisLicense,andreplacetheindividualcopiesofthis
Licenseinthevariousdocumentswithasinglecopythatisincludedin
thecollection,providedthatyoufollowtherulesofthisLicensefor
verbatimcopyingofeachofthedocumentsinallotherrespects.
Youmayextractasingledocumentfromsuchacollection,anddistribute
itindividuallyunderthisLicense,providedyouinsertacopyofthis
Licenseintotheextracteddocument,andfollowthisLicenseinall
otherrespectsregardingverbatimcopyingofthatdocument.
7.AGGREGATIONWITHINDEPENDENTWORKS
AcompilationoftheDocumentoritsderivativeswithotherseparate
andindependentdocumentsorworks,inoronavolumeofastorageor
distributionmedium,iscalledan"aggregate"ifthecopyright
resultingfromthecompilationisnotusedtolimitthelegalrights
ofthecompilation'susersbeyondwhattheindividualworkspermit.
234
50
WhentheDocumentisincludedinanaggregate,thisLicensedoesnot
applytotheotherworksintheaggregatewhicharenotthemselves
derivativeworksoftheDocument.
IftheCoverTextrequirementofsection3isapplicabletothese
copiesoftheDocument,theniftheDocumentislessthanonehalfof
theentireaggregate,theDocument'sCoverTextsmaybeplacedon
coversthatbrackettheDocumentwithintheaggregate,orthe
electronicequivalentofcoversiftheDocumentisinelectronicform.
Otherwisetheymustappearonprintedcoversthatbracketthewhole
aggregate.
8.TRANSLATION
Translationisconsideredakindofmodification,soyoumay
distributetranslationsoftheDocumentunderthetermsofsection4.
ReplacingInvariantSectionswithtranslationsrequiresspecial
permissionfromtheircopyrightholders,butyoumayinclude
translationsofsomeorallInvariantSectionsinadditiontothe
originalversionsoftheseInvariantSections.Youmayincludea
translationofthisLicense,andallthelicensenoticesinthe
Document,andanyWarrantyDisclaimers,providedthatyoualsoinclude
theoriginalEnglishversionofthisLicenseandtheoriginalversions
ofthosenoticesanddisclaimers.Incaseofadisagreementbetween
thetranslationandtheoriginalversionofthisLicenseoranotice
ordisclaimer,theoriginalversionwillprevail.
IfasectionintheDocumentisEntitled"Acknowledgements",
"Dedications",or"History",therequirement(section4)toPreserve
itsTitle(section1)willtypicallyrequirechangingtheactual
title.
9.TERMINATION
Youmaynotcopy,modify,sublicense,ordistributetheDocumentexcept
asexpresslyprovidedforunderthisLicense.Anyotherattemptto
copy,modify,sublicenseordistributetheDocumentisvoid,andwill
automaticallyterminateyourrightsunderthisLicense.However,
partieswhohavereceivedcopies,orrights,fromyouunderthis
Licensewillnothavetheirlicensesterminatedsolongassuch
partiesremaininfullcompliance.
10.FUTUREREVISIONSOFTHISLICENSE
TheFreeSoftwareFoundationmaypublishnew,revisedversions
oftheGNUFreeDocumentationLicensefromtimetotime.Suchnew
versionswillbesimilarinspirittothepresentversion,butmay
differindetailtoaddressnewproblemsorconcerns.See
http://www.gnu.org/copyleft/.
EachversionoftheLicenseisgivenadistinguishingversionnumber.
IftheDocumentspecifiesthataparticularnumberedversionofthis
License"oranylaterversion"appliestoit,youhavetheoptionof
followingthetermsandconditionseitherofthatspecifiedversionor
ofanylaterversionthathasbeenpublished(notasadraft)bythe
FreeSoftwareFoundation.IftheDocumentdoesnotspecifyaversion
numberofthisLicense,youmaychooseanyversioneverpublished(not
asadraft)bytheFreeSoftwareFoundation.
235
23
ADDENDUM:HowtousethisLicenseforyourdocuments
TousethisLicenseinadocumentyouhavewritten,includeacopyof
theLicenseinthedocumentandputthefollowingcopyrightand
licensenoticesjustafterthetitlepage:
Copyright(c)YEARYOURNAME.
Permissionisgrantedtocopy,distributeand/ormodifythisdocument
underthetermsoftheGNUFreeDocumentationLicense,Version1.2
oranylaterversionpublishedbytheFreeSoftwareFoundation;
withnoInvariantSections,noFrontCoverTexts,andnoBackCoverTexts.
Acopyofthelicenseisincludedinthesectionentitled"GNU
FreeDocumentationLicense".
IfyouhaveInvariantSections,FrontCoverTextsandBackCoverTexts,
replacethe"with...Texts."linewiththis:
withtheInvariantSectionsbeingLISTTHEIRTITLES,withthe
FrontCoverTextsbeingLIST,andwiththeBackCoverTextsbeingLIST.
IfyouhaveInvariantSectionswithoutCoverTexts,orsomeother
combinationofthethree,mergethosetwoalternativestosuitthe
situation.
Ifyourdocumentcontainsnontrivialexamplesofprogramcode,we
recommendreleasingtheseexamplesinparallelunderyourchoiceof
freesoftwarelicense,suchastheGNUGeneralPublicLicense,
topermittheiruseinfreesoftware.
236
27
18
Appendix B: Setting Up FreeBasic Under Microsoft
Windows
The first step in programming in FreeBasic is to download the compiler package
and install it. You can skip this section if you already have FreeBasic installed on your
system.
You can find the current version at http://www.freebasic.net/
. At the time of this
writing, the current stable version of FreeBasic is .17b. The instructions presented here
are for the current version. Later versions may have a different installation method so be
sure to read the included documentation before installing the package. Click on the
download link on the main page of the FreeBasic website and select the Windows stable
version. You will be presented with a list of download mirrors. Select the site closest to
you (which will download faster) and save the file to a known location of your hard drive.
The filename should be FreeBASIC-v0.17b-win32.exe, or something similar. Double
click this file to run the setup program. Click Next on the first screen, read through the
license on the second screen and click the Accept button. FreeBasic is licensed under
version 2 of the Gnu General Public License
5
. The third screen allows you select the files
that will be installed. For the purposes of the book, be sure to install all libraries by
clicking on the Libraries check box until you see a green check mark, as illustrated in
Figure 1.1.
5
See the Free Software Foundation’s GNU website http://www.gnu.org/copyleft/gpl.html for details of the GPL
license.
237
10
You also want to make sure the examples are installed as well as the libraries,
since there is a wealth of information to be gleaned from the provided examples. Click
Next to select the location where you want to install the package and then click Next
again to select where you want to place the shortcuts on your system menu and then
click Install.
The setup program will install the files. This may take some time depending on the
speed of your computer. Once all the files have been installed click finish. If the Run
FreeBasic checkbox is checked, then a command window will open in the FreeBasic folder.
238
Figure 18.1: Library Installation
30
Installing FBIde
Unlike QuickBasic, FreeBasic does not have a built-in editor, so a third party editor
must be used to create programs. Any text-based editor can be used and there are many
free programmers’ editors available on the Internet. FBIde is an editor specifically
designed to be used with FreeBasic and is the editor used for all the programs in this
book. If you do not have FBIde already installed, then you must download the editor from
the FBIde website located at http://www.fbide.freebasic.net.
Click on the download link and select the FBIde installer download link. Select the
download mirror nearest to your location, for a faster download, and save the file to a
known location on your hard drive. At the time of this writing, the current version of FBIde
is 0.4.6 and the filename should FBIde_0.4.6.exe or something similar.
Double click the file to install the editor. Click Next on the first screen and make
sure the “I accept the agreement” radio button is checked and click Next. Select the
folder to install the editor. To make things easier, install FBIde in the folder where you
installed FreeBasic. Click the Next button. Select the menu shortcut location, and again
you should group the FBIde shortcut with the FreeBasic shortcut created earlier and click
Next. The next screen allows you to install desktop shortcuts and associate *.bas and *.bi
files with FBIde. If FreeBasic is the only basic compiler you are using, then it is convenient
to associate these files with FBIde. If FreeBasic isn’t the only basic compiler you have,
then you might not want to associate the files. Click the Next button and the final screen
will be displayed. Click the install button.
Once the files have been installed click the Finish button. If the Launch Application
check box is checked, FBIde will be started. The ide executable is called fbide.exe and
should be in the main install folder.
Setting Up FBIde
In order to create FreeBasic programs with FBIde, the ide will need to know the
location of the compiler. Start FBIde and select View->Settings from the main menu.
Select the FreeBasic tab and make sure the Compiler Path textbox is pointing to the
FreeBasic compiler, fbc.exe as illustrated in Figure 1.2.
239
29
Figure 18.2: Setting the path to the FB compiler
Your setup will be different depending on where you installed FreeBasic, but should
look similar to the above example. Once the path is setup, you are ready to compile your
first program.
Compiling Your First Program
This is a good time to test the installation to make sure everything is set up
correctly. Start FBIde, if it isn’t already running, enter the following code into the editor
and save the code as helloworld.bas.
1
2
3
4
5
OptionExplicit
Cls
Print"HelloWorldFromFreeBasic!"
Sleep
End
Listing 18.1: helloworld.bas
Analysis:
Line 1 is a compiler directive that tells the compiler each variable should
be declared with the Dim statement. This program doesn't contain any variables, but it is
a good habit to always use Option Explicit in your programs. The Cls statement in line 2
clears the console screen. The Print statement in line will print the string “Hello World
From FreeBasic” at the current cursor position. The Sleep statement in line 4 pauses the
program and waits for a key press. The End statement in line 5 ends the program.
FreeBasic is a true compiler, which means that the code must be converted to an
executable before you can run the program. Using FBIde however, the process is quite
240
Documents you may be interested
Documents you may be interested