Chapter38: Packages
815
SystemRequirements
Thesearetheexternalinstalldependenciesofthepackageandarenotchecked
by thepackagemanager. . This s ishere asa hint tothedistributionpackager.
TheyfollowthesameconventionsastheDependskeyword.
BuildRequires
Thesearetheexternalbuilddependenciesofthepackageandarenotcheckedby
thepackagemanager. Thisishereasahinttothedistributionpackager. They
follow the same conventions as the Depends keyword. . Note e that in general,
packagingsystemssuchasrpmordebandautoprobetheinstalldependencies
fromthebuilddependencies,andthereforetheoftenaBuildRequiresdepen-
dencyremovestheneedforaSystemRequirementsdependency.
Thedeveloper is free to addadditionalarguments tothe DESCRIPTION filefor theirown
purposes. One e further r detail to o aid the packager is s that t the SystemRequirements s and
BuildRequires keywords s can have e a distribution dependent t section, andthe e automatic
buildprocesswillusethese.Anexampleoftheformatofthisis
BuildRequires: libtermcap-devel l [Mandriva] libtermcap2-devel
where the first package name will be usedas s adefault t and d if the RPMs s are built ona
Mandrivadistribution,thenthesecondpackagenamewillbeusedinstead.
38.4.2 TheINDEXFile
TheoptionalINDEXfileprovidesacategoricalviewofthefunctions inthepackage. . This
filehasaverysimpleformat
 Linesbeginningwith‘#’arecomments.
 Thefirstnon-commentlineshouldlooklikethis
toolbox >> Toolbox name
 Linesbeginningwithanalphabeticalcharacterindicatesanewcategoryoffunctions.
 Lines s startingwithawhitespacecharacter indicate thatthefunctionnames onthe
linebelongtothelastmentionedcategory.
Theformatcanbesummarizedwiththefollowingexample:
# A A comment
toolbox >> Toolbox name
Category Name 1
function1 function2 2 function3
function4
Category Name 2
function2 function5
Ifyouwishtorefertoafunctionthatusersmightexpecttofindinyourpackagebutis
notthere,providingaworkaroundorpointingoutthatthefunctionisavailableelsewhere,
youcanuse:
fn = = workaround description
This workaround d descriptionwillnot t appear whenlistingfunctions in n the package with
pkgdescribebuttheywillbepublishedintheHTMLdocumentationonline. Workaround
descriptionscanuse any HTMLmarkup, but keepinmindthat itwillbeenclosedina
bold-italicenvironment.Forthespecialcaseof:
Pdf split pages in half - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
add page break to pdf; break apart a pdf
Pdf split pages in half - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
break pdf into multiple documents; break pdf password
816
GNUOctave
fn = = use e <code>alternate expression</code>
thebold-italicisautomaticallysuppressed.Youwillneedtouse<code>eveninreferences:
fn = = use e <a href="someothersite.html"><code>fn</code></a>
Sometimes functions s are e only y partially y compatible, , in n which case you can list t the non-
compatiblecasesseparately. Torefertoanotherfunctioninthepackage,use<f>fn</f>.
Forexample:
eig (a, b) = = use e <f>qz</f>
Sincesitesmayhavemanymissingfunctions,youcandefineamacroratherthantyping
thesamelinkoverandagain.
$id = expansion
definesthemacroid.Youcanuse$idanywhereinthedescriptionanditwillbeexpanded.
Forexample:
$TSA = = see <a href="link_to_spctools">SPC Tools</a>
arcov = $TSA A <code>armcv</code>
idisanystringofletters,numbersand_.
38.4.3 PKG
ADDandPKG
DELDirectives
IfthepackagecontainsfilescalledPKG_ADDorPKG_DELthecommandsinthesefileswillbe
executedwhenthepackage isaddedorremovedfromtheusers path. . Insomesituations
suchfilesareabitcumbersometomaintain,sothepackagemanager supports automatic
creationofsuchfiles.IfasourcefileinthepackagecontainsaPKG_ADDorPKG_DELdirective
theywillbeaddedtoeitherthePKG_ADDorPKG_DELfiles.
Inm-filesaPKG_ADDdirectivelookslikethis
## PKG_ADD: some_octave_command
Suchlinesshouldbeaddedbeforethefunctionkeyword. InC++filesaPKG_ADDdirective
lookslikethis
// PKG_ADD: some_octave_command
Inbothcasessome_octave_commandshouldbereplacedby the commandthatshouldbe
placedinthePKG_ADDfile. PKG_DELdirectivesworkinthesameway,exceptthe e PKG_ADD
keywordisreplacedwithPKG_DELandthecommandsgetaddedtothePKG_DELfile.
38.4.4 MissingComponents
If a a package relies on a component, , such h as another Octave e package, that t may y not be
present it may be useful l to install l a function which informs users what t to do o when n a
particularcomponentismissing. Thefunctionmustbewrittenbythepackagemaintainer
andregisteredwithOctaveusingmissing_component_hook.
[Built-inFunction]
val = = missing_component_hook
()
[Built-inFunction]
old_val = missing_component_hook
(
new_val
)
[Built-inFunction]
missing_component_hook
(
new_val
,
"
local
"
)
Queryorsettheinternalvariablethatspecifiesthefunctiontocallwhenacomponent
ofOctaveismissing.
C# PDF: Use C# APIs to Control Fully on PDF Rendering Process
For example, to convert the left half of PDF document page, you can set the source rectangle to start at (0, 0) and with the original height in pixel and half
acrobat split pdf pages; break pdf into separate pages
VB.NET Image: JPEG 2000 Codec for Image Encoding and Decoding in
Integrate PDF, Tiff, Word compression add-on with JPEG 2000 codec easily in VB.NET; That is to say you can display full size, full resolution or half size, one
break pdf password online; acrobat split pdf
Chapter38: Packages
817
ThiscanbeusefulforpackagersthatmaysplittheOctaveinstallationintomultiple
sub-packages,forexample,toprovideahinttousers for howtoinstallthe missing
components.
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
Thehookfunctionisexpectedtobeoftheform
fcn (component)
Octavewillcallfcnwiththenameofthefunctionthatrequiresthecomponentanda
stringdescribingthemissingcomponent. Thehookfunctionshouldreturnanerror
messagetobedisplayed.
Seealso: [missing
function
hook],page918.
C# Word: Set Rendering Options with C# Word Document Rendering
& raster and vector images, such as PDF, tiff, png rendering and converting any Word document pages, you may get the image which sources the left half of page
break password pdf; acrobat split pdf bookmark
C# Excel: Customize Excel Conversion by Setting Rendering Options
rectangle to start at (0, 0) and with the original width and half of the can save created image object/collection to these file formats, like PDF, TIFF, SVG
pdf split; pdf file specification
C# PowerPoint: How to Set PowerPoint Rendering Parameters in C#
you use this SDK to render PowerPoint (2007 or above) slide into PDF document or For example, to convert the top half of the slide/page to image, you can set
pdf print error no pages selected; break pdf file into multiple files
How to C#: Special Effects
LinearStretch. Level the pixel between the black point and white point. Magnify. Double the image size. Mignify. Half the image size. Normolize.
break apart a pdf in reader; pdf format specification
AppendixA:ExternalCodeInterface
819
AppendixA ExternalCodeInterface
"Thesumofhumanwisdomisnotcontainedinanyonelanguage"—EzraPound
Octave is a fantasticlanguagefor solving many problems in science and engineering.
However,itisnottheonlycomputerlanguageandtherearetimeswhenyoumaywantto
usecodewritteninotherlanguages.Goodreasonsfordoingsoinclude: 1)notre-inventing
thewheel;existingfunctionlibrarieswhichhavebeenthoroughlytestedanddebuggedor
largescalesimulationcodebasesareagoodexample,2)accessinguniquecapabilitiesofa
different language; ; for r example thewell-knownregular expression n functions s of Perl(but
don’tdothatbecauseregexpalreadyexistsinOctave).
Performanceshouldgenerallynotbeareasonforusingcompiledextensions. Although
compiled extensions s can run faster, , particularly y if f they y replace a a loop in n Octave code,
this is almost never the best t path to o take. . First, , there are e many y techniques s to speed
upOctave performance whileremaining withinthelanguage. . Second, , Octave is s ahigh-
levellanguagethatmakesiteasytoperformcommonmathematicaltasks.Givingthatup
meansshiftingthefocusfromsolvingtherealproblemtosolvingacomputerprogramming
problem.Itmeansreturningtolow-levelconstructssuchaspointers,memorymanagement,
mathematicaloverflow/underflow,etc. Becauseofthelowlevelnature,andthefactthat
thecompiledcodeisexecutedoutsideofOctave,thereistheveryrealpossibilityofcrashing
theinterpreterandlosingwork.
Beforegoingfurther,youshouldfirstdetermineifyoureallyneedtobotherwritingcode
outsideofOctave.
 CanIgetthesamefunctionalityusingtheOctavescriptinglanguagealone?
Evenwhenafunctionalreadyexistsoutsidethelanguage,itmaybebettertosimply
reproduce the behavior in anm-file rather than attempt to interfaceto the outside
code.
 IsthecodethoroughlyoptimizedforOctave?
If performance is s an issue you should always s start with h the in-language techniques
for gettingbetter performance. . Chief f among these is vectorization(see Chapter 19
[VectorizationandFasterCodeExecution],page489)whichnotonlymakesthecode
conciseandmoreunderstandablebutimprovesperformance(10X-100X).Ifloopsmust
be used,makesurethat the allocationofspaceforvariables takes placeoutsidethe
loopsusinganassignmenttoamatrixoftherightsize,orzeros.
 Doesthecodemakeasmuchuseaspossibleofexistingbuilt-inlibraryroutines?
These routines s are e highly y optimized and many y do not carry y the e overhead of being
interpreted.
 Doeswritingadynamicallylinkedfunctionrepresentausefulinvestmentofyourtime,
relativetostayinginOctave?
ItwilltaketimetolearnOctave’sinterfaceforexternalcodeandtherewillinevitably
beissueswithtoolssuchascompilers.
Withthatsaid,Octaveoffersaversatileinterfaceforincludingchunksofcompiledcode
asdynamicallylinkedextensions.Thesedynamicallylinkedfunctionscanbecalledfromthe
interpreterinthesamemannerasanyordinaryfunction.Theinterfaceisbi-directionaland
C# Raster - Image Compression in C#.NET
B44. The value is 17. B44 This form of compression is lossy for half data and stores 32bit data uncompressed. B44A. The value is 18.
how to split pdf file by pages; break pdf into multiple files
C# Image: C# Code to Encode & Decode JBIG2 Images in RasterEdge .
RegisteredDecoders.GetDecoderFromType(typeof(JBIG2Decoder)); JBIG2.ScaleFactor = JBIG2ScaleFactor.Half; and decompressing of Word & PDF documents as well as
pdf split pages in half; split pdf
820
GNUOctave
externalcodecancallOctavefunctions(likeplot)whichotherwisemightbeverydifficult
todevelop.
TheinterfaceiscenteredaroundsupportingthelanguagesC++,C,andFortran. Octave
itselfiswritteninC++andcancallexternalC++/Ccodethroughitsnativeoct-fileinterface.
The C language is s also o supported through the mex-file interface for compatibility with
matlab. Fortrancodeiseasiesttoreachthroughtheoct-fileinterface.
Because manyother languages provide CorC++APIs it is relatively simple tobuild
bridges betweenOctave and d other r languages. . This s is s also away to bridge to hardware
resourceswhichoftenhavedevicedriverswritteninC.
A.1 Oct-Files
A.1.1 GettingStartedwithOct-Files
Oct-files are e pieces s of C++ code that have been compiled with h the Octave e API I into o a
dynamicallyloadableobject.Theytaketheirnamefromthefilewhichcontainstheobject
whichhastheextension.oct.
FindingaC++compiler,usingthecorrectswitches,addingtherightincludepathsfor
header files,etc. . is s a difficult task. . Octaveautomates s this byprovidingthe mkoctfile
commandwithwhichtobuildoct-files. ThecommandisavailablefromwithinOctaveor
attheshellcommandline.
[Command]
mkoctfile [
-options
]
file ...
[FunctionFile]
[output, status] = = mkoctfile
(...)
The mkoctfile functioncompiles source code writtenin C,C++, or Fortran. . De-
pendingontheoptionsusedwithmkoctfile,thecompiledcodecanbecalledwithin
Octaveorcanbeusedasastand-aloneapplication.
mkoctfilecanbecalledfromtheshellpromptorfromtheOctaveprompt. Calling
itfromtheOctavepromptsimplydelegatesthecalltotheshellprompt.Theoutput
isstoredintheoutputvariableandtheexitstatusinthestatusvariable.
mkoctfileacceptsthefollowingoptions,allofwhichareoptionalexceptforthefile
nameofthecodeyouwishtocompile:
‘-IDIR’
AddtheincludedirectoryDIRtocompilecommands.
‘-DDEF’
AddthedefinitionDEFtothecompilercall.
‘-lLIB’
AddthelibraryLIBtothelinkcommand.
‘-LDIR’
AddthelibrarydirectoryDIRtothelinkcommand.
‘-M’
‘--depend’
Generatedependencyfiles(.d)forCandC++sourcefiles.
‘-RDIR’
Addtherun-timepathtothelinkcommand.
‘-Wl,...’ Pass s flags though the linker like "-Wl,-rpath=...". . The e quotes are
neededsincecommasareinterpretedascommandseparators.
‘-W...’
Passflagsthoughthecompilerlike"-Wa,OPTION".
VB Imaging - Postnet Barcode Creation Tutorial
can encode 5, 6, 9 or 11 digits, excluding check digit, in half- and full image and document files, including PNG, BMP, GIF, JPEG, TIFF, PDF, Excel, PowerPoint
break a pdf; pdf split and merge
VB.NET Image: Image Scaling SDK to Scale Picture / Photo
After you run following VB.NET code demo, you will get a scaled image file whose height & width are all half of original image width & height.
can't cut and paste from pdf; pdf rotate single page
AppendixA:ExternalCodeInterface
821
‘-c’
Compilebutdonotlink.
‘-g’
Enabledebuggingoptionsforcompilers.
‘-oFILE’
‘--outputFILE’
Outputfilename.Defaultextensionis.oct(or.mexif‘--mex’isspecified)
unlesslinkingastand-aloneexecutable.
‘-pVAR’
‘--printVAR’
PrinttheconfigurationvariableVAR. Recognizedvariablesare:
ALL_CFLAGS
INCFLAGS
ALL_CXXFLAGS
INCLUDEDIR
ALL_FFLAGS
LAPACK_LIBS
ALL_LDFLAGS
LD_CXX
AR
LDFLAGS
BLAS_LIBS
LD_STATIC_FLAG
CC
LFLAGS
CFLAGS
LIBDIR
CPICFLAG
LIBOCTAVE
CPPFLAGS
LIBOCTINTERP
CXX
LIBS
CXXFLAGS
OCTAVE_HOME
CXXPICFLAG
OCTAVE_LIBS
DEPEND_EXTRA_SED_PATTERN
OCTAVE_LINK_DEPS
DEPEND_FLAGS
OCTAVE_LINK_OPTS
DL_LD
OCTAVE_PREFIX
DL_LDFLAGS
OCTINCLUDEDIR
F77
OCTLIBDIR
F77_INTEGER8_FLAG
OCT_LINK_DEPS
FFLAGS
OCT_LINK_OPTS
FFTW3F_LDFLAGS
RANLIB
FFTW3F_LIBS
RDYNAMIC_FLAG
FFTW3_LDFLAGS
READLINE_LIBS
FFTW3_LIBS
SED
FFTW_LIBS
SPECIAL_MATH_LIB
FLIBS
XTRA_CFLAGS
FPICFLAG
XTRA_CXXFLAGS
‘--link-stand-alone’
Linkastand-aloneexecutablefile.
‘--mex’
AssumewearecreatingaMEXfile.Setthedefaultoutputextensionto
".mex".
‘-s’
‘--strip’ Striptheoutputfile.
822
GNUOctave
‘-v’
‘--verbose’
Echocommandsastheyareexecuted.
‘file’
Thefiletocompileorlink. Recognizedfiletypesare
.c
C source
.cc
C++ source
.C
C++ source
.cpp C++ + source
.f
Fortran source (fixed form)
.F
Fortran source (fixed form)
.f90 Fortran n source (free e form)
.F90 Fortran n source (free e form)
.o
object file
.a
library file
ConsiderthefollowingshortexamplewhichintroducesthebasicsofwritingaC++func-
tionthatcanbelinkedtoOctave.
#include <octave/oct.h>
DEFUN_DLD (helloworld, , args, nargout,
"Hello World d Help p String")
{
int nargin n = = args.length h ();
octave_stdout << < "Hello World d has s "
<< nargin << " input arguments and "
<< nargout t << < " " output t arguments.\n";
return octave_value_list t ();
}
The first criticallineis #include<octave/oct.h> whichmakes available mostof the
definitionsnecessaryforaC++oct-file.Notethatoctave/oct.hisaC++headerandcannot
bedirectly#include’edinaCsourcefile,noranyotherlanguage.
Includedbyoct.hisadefinitionforthemacroDEFUN_DLDwhichcreatesadynamically
loadedfunction. Thismacrotakesfourarguments:
1. ThefunctionnameasitwillbeseeninOctave,
2. Thelistofargumentstothefunctionoftypeoctave_value_list,
3. Thenumberofoutputarguments,whichcanandoftenisomittedifnotused,and
4. Thestringtouseforthehelptextofthefunction.
ThereturntypeoffunctionsdefinedwithDEFUN_DLDisalwaysoctave_value_list.
Thereareacoupleofimportant considerationsinthechoiceof functionname. . First,
itmustbeavalidOctavefunctionnameandsomustbeasequenceofletters,digits,and
underscoresnotstartingwithadigit. Second,asOctaveusesthefunctionnametodefine
AppendixA:ExternalCodeInterface
823
thefilenameitattemptstofindthefunctionin,thefunctionnameintheDEFUN_DLDmacro
mustmatchthefilenameoftheoct-file. Therefore,theabovefunctionshouldbeinafile
helloworld.cc,andwouldbecompiledtoanoct-fileusingthecommand
mkoctfile helloworld.cc
Thiswillcreateafilecalledhelloworld.octthatisthecompiledversionofthefunction.
ItshouldbenotedthatitisperfectlyacceptabletohavemorethanoneDEFUN_DLDfunction
in a source file. . However, , there must either be a symbolic c link k to the e oct-file for each
of the functions defined inthe source code with the DEFUN_DLD macro or the autoload
(Section11.9[FunctionFiles],page189)functionshouldbeused.
Therestofthefunctionshowshowtofindthenumberofinputarguments,howtoprint
throughtheOctavepager,andreturnfromthefunction. Aftercompilingthisfunctionas
above,anexampleofitsuseis
helloworld (1, 2, 3)
a
Hello World has 3 3 input arguments s and 0 0 output t arguments.
SubsequentsectionsshowhowtousespecificclassesfromOctave’scoreinternals. Base
classeslikedMatrix(amatrixofdoublevalues)arefoundinthedirectoryliboctave/array.
Thedefinitivereferenceforhowtouseaparticularclassistheheaderfileitself. However,
itisoftenenoughjusttostudytheexamplesinthemanualinordertobeabletousethe
class.
A.1.2 MatricesandArraysinOct-Files
Octavesupportsanumberofdifferentarrayandmatrixclasses,themajorityofwhichare
basedontheArray class. . Theexceptionis s thesparse matrixtypes discussedseparately
below. Therearethreebasicmatrixtypes
Matrix
AdoubleprecisionmatrixclassdefinedindMatrix.h,
ComplexMatrix
AcomplexmatrixclassdefinedinCMatrix.h,and
BoolMatrix
AbooleanmatrixclassdefinedinboolMatrix.h.
Theseare thebasic two-dimensional matrix types of Octave. . In n additionthere area
numberofmulti-dimensionalarraytypesincluding
NDArray
AdoubleprecisionarrayclassdefinedindNDArray.h
ComplexNDarray
AcomplexarrayclassdefinedinCNDArray.h
boolNDArray
AbooleanarrayclassdefinedinboolNDArray.h
int8NDArray
int16NDArray
int32NDArray
int64NDArray
8, 16, 32, and d 64-bit signed array classes defined in n int8NDArray.h,
int16NDArray.h,etc.
824
GNUOctave
uint8NDArray
uint16NDArray
uint32NDArray
uint64NDArray
8, 16, 32, and d 64-bit unsigned array classes defined in uint8NDArray.h,
uint16NDArray.h,etc.
Thereareseveralbasicwaysofconstructingmatricesormulti-dimensionalarrays.Using
theclassMatrixasanexampleonecan
 Createanemptymatrixorarraywiththeemptyconstructor.Forexample:
Matrix a;
Thiscanbeusedforallmatrixandarraytypes.
 Definethedimensionsofthematrixor r array withadim
vector whichhasthesame
characteristicsasthevectorreturnedfromsize.Forexample:
dim_vector dv (2, , 3); ; // / 2 2 rows, 3 columns
Matrix a a (dv);
Thiscanbeusedonallmatrixandarraytypes.
 Definethenumberofrowsandcolumnsinthematrix. . Forexample:
Matrix a a (2, 2)
However,thisconstructorcanonlybeusedwithmatrixtypes.
Thesetypesallshareanumberofbasicmethodsandoperators.Manybeararesemblance
tofunctionsthatexistintheinterpreter.Aselectionofusefulmethodsinclude
[Method]
T& operator
()(octave
idx
type)
[Method]
T& elem
(octave
idx
type)
The()operatororelemmethodallowthevaluesofthematrixorarraytobereador
set. Thesecantakeasingleargument,whichisoftypeoctave_idx_type,thatisthe
indexintothematrixor array. . Additionally,thematrixtype e allows twoargument
versionsofthe()operatorandelemmethod,givingtherowandcolumnindexofthe
valuetoobtainorset.
Notethatthesefunctionsdosignificanterrorcheckingandsoinsomecircumstancesthe
usermightprefertoaccessthedataofthearrayormatrixdirectlythroughthefortran
vec
methoddiscussedbelow.
[Method]
octave_idx_type
numel(void)const
Thetotalnumberofelementsinthematrixorarray.
[Method]
size_t byte_size
(void)const
Thenumberofbytesusedtostorethematrixorarray.
[Method]
dim_vector dims
(void)const
Thedimensionsofthematrixorarrayinvalueoftypedim
vector.
[Method]
int ndims
(void)const
Thenumberofdimensionsofthematrixorarray. Matricesare2-D,butarrayscan
beN-dimensional.
Documents you may be interested
Documents you may be interested