initial import of BeepFp (http://wiki.lazarus.freepascal.org/BeepFp) from Wimpie Nortje

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@933 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
vsnijders
2009-08-14 11:07:00 +00:00
parent 72d201621f
commit 522d4d9dc1
139 changed files with 52323 additions and 0 deletions

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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 of the License, or
(at your option) any later version.
This program 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -0,0 +1,26 @@
This is the file COPYING.modifiedLGPL, it applies to several units in the
Lazarus sources distributed by members of the Lazarus Development Team.
All files contains headers showing the appropriate license. See there if this
modification can be applied.
These files are distributed under the Lesser GNU General Public License
(see the file COPYING.LGPL) with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,
and to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify this
library, you may extend this exception to your version of the library, but
you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
If you didn't receive a copy of the file COPYING.LGPL, contact:
Free Software Foundation, Inc.,
675 Mass Ave
Cambridge, MA 02139
USA

View File

@ -0,0 +1,9 @@
This is the file COPYING, it gives an overview of the licenses used in the BeepFp sources.
The Pascal translations of the C header files of both libaxl and libvortex are under LGPL v2.1, the same as the libraries. This includes all the files in the axl and vortex directories, as well as some of the programs in directory test as indicated at the beginning of the program files.
The BeepFp package is under LGPL v3 with the same exception as the Lazarus LCL. This includes all the files in beepfp and example directories, as well as some programs in the test directory as indicated at the beginning of the program files.

View File

@ -0,0 +1,97 @@
BeepFp: BEEP network protocol framework component for Free Pascal
Version 1
1 September 2009
Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
Introduction
------------
BEEP is a network application framework protocol. BEEP is not a complete protocol, it only provides the building blocks common to most network protocols to ease custom protocol design and speed up implementation. To understand exactly what BEEP is, see www.beepcore.org and RFC3080.
BeepFp is a Free Pascal componentset to allow development of custom protocols using BEEP in native Object Pascal.
BeepFp consists of a number of parts:
* libaxl - shared library providing XML processing
* libvortex - shared library providing the BEEP implementation
* axl.pas - Pascal translation of the libaxl .h files
* vortex.pas - Pascal translation of the libvortex .h files
* beepXXXXXX.pas- Object Pascal BEEP implementation built on top of libvortex and libaxl.
* tests - To test the basic functionality of the shared libraries
* examples - Usage examples of the Object Pascal classes.
LibAXL (another XML library) is an XML library implemented in C. To learn more about LibAXL see www.aspl.es/axl
LibVortex is a BEEP (RFC3080/RFC3081) implementation in C. To learn more about LibVortex see www.aspl.es/vortex
Features
--------
* Event driven communication
* Blocking and non-blocking modes
* Requires only a few event handlers to implement full-blown network protocol
Installing
----------
BeepFp depends on a working libaxl and libvortex installation. Installation instructions are included in both downloads. The included test programs must be run to confirm a proper installation.
BeepFp does not need any installation. Simply add the beepfp package to the project and include the necessary units.
Obtaining the libraries
-----------------------
LibAxl can be downloaded from www.aspl.es/axl.
LibVortex can be downloaded from www.aspl.es/vortex. NB SEE NOTE
NOTE: BeepFp requires at least vortex svn r4012, ie LibVortex release 1.1.1 from 2009/04/27 is too old. Release 1.1.2 is not yet available at the time of writing.
Using BeepFp
------------
Vortex is a multithreaded library. In unix this requires that the cthread unit be the first thread in the main program, even if the pascal program doesn't use any thread.
The events fired by the BeepFp classes are triggered by events from the C library. These all happen in different threads, which implies that the pascal event handlers also run in these secondary threads. This means that the event handlers cannot access the GUI for the same reason that TThread objects must use Synchronize to acces the GUI. The difference here is that there is not Synchronize function available to these threads. Get data from the event handlers onto the GUI remains a problem to be solved.
There are a number of options available to use BEEP in an application.
1. The easiest is to use TBeepServer and TBeepClient components like in the example programs BEEP_Listener and BEEP_Client.
2. If these two classes do not provide the required functionality, one can use the lower set of classes TBeepConnection, TBeepChannel etc to build a client and server.
3. The lowest level (and hardest work) is to use the C library directy via Vortex.pas. This provides all the functionality as the C library.
Documentation
-------------
At the moment BeepFp doesn't include its own documentation.
Vortex is thoroughly documented. This should be sufficient to answer most questions.
Work completed
--------------
All basic functionality have been completed.
This includes:
* a server that can accept multiple connections, initiate channels and channel pools.
* a client that can make a single connection with multiple channels and multiple channel pools.
* easy creation of required event handlers for implementing the profiles (protocol specifics)
To do
-----
* SASL (authentication)
* TLS (encryption)
* Advanced profile features, ie 2nd layer handling or profile events
* XML-RPC profile support
* Tunneling profile support
* HTTP CONNECT profile support
Portability
-----------
Axl and Vortex are supported on at least Windows and Linux. Probably some other OSes too.
The Axl and Vortex translations have only been tested on Linux. There may be a few small changes required to get it to work on windows and the other platforms supported by Vortex.
Getting the library's threads (created in C) to work reliably with Free Pascal was quite complex. Porting Vortex.pas to other platforms would most likely require at least a review of this part.
BeepFp uses only plain, system independant object pascal. That said, it is only tested on Linux so far. With all portability issues solved for Axl and Vortex, BeepFp may or may not work out of the box on other platforms.
Credits and license
-------------------
Thanks to Advanced Software Production Line (ASPL) for making Vortex and Axl libraries available, and for their support.
Axl library, Vortex library, Axl unit and Vortex unit are all covered by the LGPL license.
BeepFp is covered by a modified LGPL license.

View File

@ -0,0 +1,458 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS

View File

@ -0,0 +1,47 @@
LibAxl library for Free Pascal
Version 0.5.7
Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
Introduction
------------
This package is a Free Pascal translation of the libaxl header files.
AXL (another XML library) is an XML library implemented in C. The reason for this translation is because it is used by LibVortex (a BEEP implementation).
Installing
----------
The Pascal axl units do not need to be installed, only included in the uses statement.
LibAxl shared library must be installed. See the library for instructions.
Obtaining libaxl
----------------
LibAxl can be downloaded from www.aspl.es/axl
Main differences with C headers
-------------------------------
The pascal units were kept as close as possible to the original source. The biggest changes are macros that are implemented as functions or skipped altogether.
Most of the C source are still in the files for future reference as well as all the doxygen documentation.
Work completed
--------------
This translation of the libaxl headers is for libaxl v0.5.7
Only the base library was translated. This is the part required by LibVortex to operate.
To do
-----
1. There remain some untranslated #define's in the base library
2. The following axl parts are not yet translated:
- babel
- knife
- namespace
- tests
Credits and license
-------------------
Thanks to Advanced Software Production Line (ASPL) for making this library available.
This translation uses the same LGPL license as the libaxl library.

View File

@ -0,0 +1,99 @@
unit axl;
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez Nº 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
interface
uses
unixtype;
const
External_library='libaxl'; {Setup as you need}
{$IFDEF FPC}
{$PACKRECORDS C}
{$ENDIF}
{$include axl_decl.inc}
{$include axl_list.inc}
{$include axl_stack.inc}
{$include axl_hash.inc}
{$include axl_stream.inc}
{$include axl_doc.inc}
{$include axl_node.inc}
{$include axl_dtd.inc}
{$include axl_error.inc}
{$include axl_log.inc}
{$include axl_factory.inc}
(**
* \addtogroup axl_module
* @{
*)
//axl_bool axl_init ();
function axl_init :Taxl_bool;cdecl;external External_library name 'axl_init';
//void axl_end ();
procedure axl_end;cdecl;external External_library name 'axl_end';
implementation
{$include axl_decl_imp.inc}
//{$include axl_list_imp.inc}
//{$include axl_stack_imp.inc}
//{$include axl_hash_imp.inc}
{$include axl_stream_imp.inc}
{$include axl_doc_imp.inc}
{$include axl_node_imp.inc}
//{$include axl_dtd_imp.inc}
//{$include axl_error_imp.inc}
//{$include axl_log_imp.inc}
//{$include axl_factory_imp.inc}
end.
(* @} *)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
//#define axl_return_if_fail(expr) \
//if (!(expr)) {__axl_log ("", AXL_LEVEL_CRITICAL, "Expresion '%s' have failed at %s (%s:%d)", #expr, __AXL_PRETTY_FUNCTION__, __AXL_FILE__, __AXL_LINE__); return;}
{
function axl_return_if_fail(expr):???;
begin
if (!(expr)) then
begin
__axl_log ("", AXL_LEVEL_CRITICAL, "Expresion '%s' have failed at %s (%s:%d)", #expr, __AXL_PRETTY_FUNCTION__, __AXL_FILE__, __AXL_LINE__);
return;
end;
end;
}

View File

@ -0,0 +1,301 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
(**
* \addtogroup axl_doc_module
* @{
*)
//axlDoc * axl_doc_create (const char * version,
// const char * encoding,
// axl_bool standalone);
function axl_doc_create (const version:Pchar;
const encoding:Pchar;
standalone:Taxl_bool):PaxlDoc;
cdecl;external External_library name 'axl_doc_create';
//axlDoc * axl_doc_parse (const char * entity,
// int entity_size,
// axlError ** error);
function axl_doc_parse (const entity:Pchar;
entity_size:longint;
error:PPaxlError):PaxlDoc;
cdecl;external External_library name 'axl_doc_parse';
//axlDoc * axl_doc_parse_strings (axlError ** error,
// ...);
function axl_doc_parse_strings (error:PPaxlError;
args:array of const):PaxlDoc;
cdecl;external External_library name 'axl_doc_parse_strings';
function axl_doc_parse_strings (error:PPaxlError):PaxlDoc;
cdecl;external External_library name 'axl_doc_parse_strings';
//axlDoc * axl_doc_parse_from_file (const char * file_path,
// axlError ** error);
function axl_doc_parse_from_file (const file_path:Pchar;
error:PPaxlError):PaxlDoc;
cdecl;external External_library name 'axl_doc_parse_from_file';
//axl_bool axl_doc_dump (axlDoc * doc,
// char ** content,
// int * size);
function axl_doc_dump (doc:PaxlDoc;
content:PPchar;
var size:longint):Taxl_bool;
cdecl;external External_library name 'axl_doc_dump';
//axl_bool axl_doc_dump_pretty (axlDoc * doc,
// char ** content,
// int * size,
// int tabular);
function axl_doc_dump_pretty (doc:PaxlDoc;
content:PPchar;
var size:longint;
tabular:longint):Taxl_bool;
cdecl;external External_library name 'axl_doc_dump_pretty';
//axl_bool axl_doc_dump_to_file (axlDoc * doc,
// const char * file_path);
function axl_doc_dump_to_file (doc:PaxlDoc;
const file_path:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_doc_dump_to_file';
//axl_bool axl_doc_dump_pretty_to_file (axlDoc * doc,
// const char * file_path,
// int tabular);
function axl_doc_dump_pretty_to_file (doc:PaxlDoc;
const file_path:Pchar;
tabular:longint):Taxl_bool;
cdecl;external External_library name 'axl_doc_dump_pretty_to_file';
//int axl_doc_get_flat_size (axlDoc * doc);
function axl_doc_get_flat_size (doc:PaxlDoc):longint;
cdecl;external External_library name 'axl_doc_get_flat_size';
//axl_bool axl_doc_are_equal (axlDoc * doc,
// axlDoc * doc2);
function axl_doc_are_equal (doc:PaxlDoc;
doc2:PaxlDoc):Taxl_bool;
cdecl;external External_library name 'axl_doc_are_equal';
//axl_bool axl_doc_are_equal_trimmed (axlDoc * doc,
// axlDoc * doc2);
function axl_doc_are_equal_trimmed (doc:PaxlDoc;
doc2:PaxlDoc):Taxl_bool;
cdecl;external External_library name 'axl_doc_are_equal_trimmed';
//axl_bool axl_doc_are_equal_full (axlDoc * doc,
// axlDoc * doc2,
// axl_bool trimmed,
// axlError ** error);
function axl_doc_are_equal_full (doc:PaxlDoc;
doc2:PaxlDoc;
trimmed:Taxl_bool;
error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_doc_are_equal_full';
//axlNode * axl_doc_get_root (axlDoc * doc);
function axl_doc_get_root (doc:PaxlDoc):PaxlNode;
cdecl;external External_library name 'axl_doc_get_root';
//void axl_doc_set_root (axlDoc * doc,
// axlNode * root);
procedure axl_doc_set_root (doc:PaxlDoc;
root:PaxlNode);
cdecl;external External_library name 'axl_doc_set_root';
//axlList * axl_doc_get_list (axlDoc * doc,
// const char * path_to);
function axl_doc_get_list (doc:PaxlDoc;
const path_to:Pchar):PaxlList;
cdecl;external External_library name 'axl_doc_get_list';
//axlNode * axl_doc_get (axlDoc * doc,
// const char * path_to);
function axl_doc_get (doc:PaxlDoc;
const path_to:Pchar):PaxlNode;
cdecl;external External_library name 'axl_doc_get';
(**
* @brief Convenience macro that allows to call \ref
* axl_node_find_called, providing a document, making the parent
* reference to use the root document node.
*
* See \ref axl_node_find_called for more information.
*
* @param doc The document where the node lookup will be produced.
* @param name The child node name that is looked up.
*
* @return A reference to the node found or NULL if it fails to find
* the node requested.
*)
//#define axl_doc_find_called(doc,name) (axl_node_find_called(axl_doc_get_root(doc),name))
function axl_doc_find_called(doc:PaxlDoc; name:Pchar):PaxlNode;
//const char * axl_doc_get_content_at (axlDoc * doc,
// const char * path_to,
// int * content_size);
function axl_doc_get_content_at (doc:PaxlDoc;
const path_to:Pchar;
var content_size:longint):Pchar;
cdecl;external External_library name 'axl_doc_get_content_at';
//const char * axl_doc_get_encoding (axlDoc * doc);
function axl_doc_get_encoding (doc:PaxlDoc):Pchar;
cdecl;external External_library name 'axl_doc_get_encoding';
//axl_bool axl_doc_get_standalone (axlDoc * doc);
function axl_doc_get_standalone (doc:PaxlDoc):Taxl_bool;
cdecl;external External_library name 'axl_doc_get_standalone';
//void axl_doc_free (axlDoc * doc);
procedure axl_doc_free (doc:PaxlDoc);
cdecl;external External_library name 'axl_doc_free';
//void axl_doc_set_child_current_parent (axlDoc * doc,
// axlNode * node);
procedure axl_doc_set_child_current_parent (doc:PaxlDoc;
node:PaxlNode);
cdecl;external External_library name 'axl_doc_set_child_current_parent';
//void axl_doc_pop_current_parent (axlDoc * doc);
procedure axl_doc_pop_current_parent (doc:PaxlDoc);
cdecl;external External_library name 'axl_doc_pop_current_parent';
//void axl_doc_add_pi_target (axlDoc * doc,
// char * target,
// char * content);
procedure axl_doc_add_pi_target (doc:PaxlDoc;
target:Pchar;
content:Pchar);
cdecl;external External_library name 'axl_doc_add_pi_target';
//axl_bool axl_doc_has_pi_target (axlDoc * doc,
// char * pi_target);
function axl_doc_has_pi_target (doc:PaxlDoc;
pi_target:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_doc_has_pi_target';
//char * axl_doc_get_pi_target_content (axlDoc * doc,
// char * pi_target);
function axl_doc_get_pi_target_content (doc:PaxlDoc;
pi_target:Pchar):Pchar;
cdecl;external External_library name 'axl_doc_get_pi_target_content';
//axlList * axl_doc_get_pi_target_list (axlDoc * doc);
function axl_doc_get_pi_target_list (doc:PaxlDoc):PaxlList;
cdecl;external External_library name 'axl_doc_get_pi_target_list';
//axlPI * axl_pi_create (char * name,
// char * content);
function axl_pi_create (name:Pchar;
content:Pchar):PaxlPI;
cdecl;external External_library name 'axl_pi_create';
//axlPI * axl_pi_copy (axlPI * pi);
function axl_pi_copy (pi:PaxlPI):PaxlPI;
cdecl;external External_library name 'axl_pi_copy';
//axl_bool axl_pi_are_equal (axlPI * pi,
// axlPI * pi2);
function axl_pi_are_equal (pi:PaxlPI;
pi2:PaxlPI):Taxl_bool;
cdecl;external External_library name 'axl_pi_are_equal';
//char * axl_pi_get_name (axlPI * pi);
function axl_pi_get_name (pi:PaxlPI):Pchar;
cdecl;external External_library name 'axl_pi_get_name';
//char * axl_pi_get_content (axlPI * pi);
function axl_pi_get_content (pi:PaxlPI):Pchar;
cdecl;external External_library name 'axl_pi_get_content';
//void axl_pi_free (axlPI * pi);
procedure axl_pi_free (pi:PaxlPI);
cdecl;external External_library name 'axl_pi_free';
//int axl_pi_get_size (axlPI * pi);
function axl_pi_get_size (pi:PaxlPI):longint;
cdecl;external External_library name 'axl_pi_get_size';
//axl_bool axl_doc_iterate (axlDoc * doc,
// AxlIterationMode mode,
// axlIterationFunc func,
// axlPointer ptr);
function axl_doc_iterate (doc:PaxlDoc;
mode:TaxlIterationMode;
func:TaxlIterationFunc;
ptr:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_doc_iterate';
//axl_bool axl_doc_iterate_full (axlDoc * doc,
// AxlIterationMode mode,
// axlIterationFunc2 func,
// axlPointer ptr,
// axlPointer ptr2);
function axl_doc_iterate_full (doc:PaxlDoc;
mode:TaxlIterationMode;
func:TaxlIterationFunc2;
ptr:TaxlPointer;
ptr2:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_doc_iterate_full';
//axl_bool axl_doc_iterate_full_from (axlDoc * doc,
// axlNode * starting_from,
// AxlIterationMode mode,
// axlIterationFunc2 func,
// axlPointer ptr,
// axlPointer ptr2);
function axl_doc_iterate_full_from (doc:PaxlDoc;
starting_from:PaxlNode;
mode:TAxlIterationMode;
func:TaxlIterationFunc2;
ptr:TaxlPointer;
ptr2:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_doc_iterate_full_from';
(* @} *)

View File

@ -0,0 +1,54 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
{$inline on}
//#define axl_doc_find_called(doc,name) (axl_node_find_called(axl_doc_get_root(doc),name))
function axl_doc_find_called(doc:PaxlDoc; name:Pchar):PaxlNode; inline;
begin
Result := axl_node_find_called(axl_doc_get_root(doc),name);
end;
{$inline off}

View File

@ -0,0 +1,192 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
(**
* \addtogroup axl_dtd_module
* @{
*)
//axlDtd * axl_dtd_parse (const char * entity,
// int entity_size,
// axlError ** error);
function axl_dtd_parse (const entity:Pchar;
entity_size: longint;
error:PPaxlError):PaxlDtd;
cdecl;external External_library name 'axl_dtd_parse';
//axlDtd * axl_dtd_parse_from_file (const char * file_path,
// axlError ** error);
function axl_dtd_parse_from_file (const file_path:Pchar;
error:PPaxlError):PaxlDtd;
cdecl;external External_library name 'axl_dtd_parse_from_file';
//axl_bool axl_dtd_validate (axlDoc * doc,
// axlDtd * dtd,
// axlError ** error);
function axl_dtd_validate (doc:PaxlDoc;
dtd:PaxlDtd;
error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_dtd_validate';
//axl_bool axl_dtd_are_equal (axlDtd * dtd,
// axlDtd * dtd2);
function axl_dtd_are_equal (dtd:PaxlDtd;
dtd2:PaxlDtd):Taxl_bool;
cdecl;external External_library name 'axl_dtd_are_equal';
//axlDtdElement * axl_dtd_get_root (axlDtd * dtd);
function axl_dtd_get_root (dtd:PaxlDtd):PaxlDtdElement;
cdecl;external External_library name 'axl_dtd_get_root';
//axlDtdElement * axl_dtd_get_element (axlDtd * dtd,
// const char * name);
function axl_dtd_get_element (dtd:PaxlDtd;
const name:Pchar):PaxlDtdElement;
cdecl;external External_library name 'axl_dtd_get_element';
//char * axl_dtd_get_element_name (axlDtdElement * element);
function axl_dtd_get_element_name (element:PaxlDtdElement):Pchar;
cdecl;external External_library name 'axl_dtd_get_element_name';
//AxlDtdElementType axl_dtd_get_element_type (axlDtdElement * element);
function axl_dtd_get_element_type (element:PaxlDtdElement):TAxlDtdElementType;
cdecl;external External_library name 'axl_dtd_get_element_type';
//axlDtdElementList * axl_dtd_get_item_list (axlDtdElement * element);
function axl_dtd_get_item_list (element:PaxlDtdElement):PaxlDtdElementList;
cdecl;external External_library name 'axl_dtd_get_item_list';
//axl_bool axl_dtd_element_is_toplevel (axlDtd * dtd, axlDtdElement * element);
function axl_dtd_element_is_toplevel (dtd:PaxlDtd; element:PaxlDtdElement):Taxl_bool;
cdecl;external External_library name 'axl_dtd_element_is_toplevel';
//int axl_dtd_item_list_count (axlDtdElementList * itemList);
function axl_dtd_item_list_count (itemList:PaxlDtdElementList):longint;
cdecl;external External_library name 'axl_dtd_item_list_count';
//AxlDtdNestedType axl_dtd_item_list_type (axlDtdElementList * itemList);
function axl_dtd_item_list_type (itemList:PaxlDtdElementList):TAxlDtdNestedType;
cdecl;external External_library name 'axl_dtd_item_list_type';
//AxlDtdTimes axl_dtd_item_list_repeat (axlDtdElementList * itemList);
function axl_dtd_item_list_repeat (itemList:PaxlDtdElementList):TAxlDtdTimes;
cdecl;external External_library name 'axl_dtd_item_list_repeat';
//axlDtdElementListNode * axl_dtd_item_list_get_node (axlDtdElementList * itemList,
// int position);
function axl_dtd_item_list_get_node (itemList:PaxlDtdElementList;
position:longint):PaxlDtdElementListNode;
cdecl;external External_library name 'axl_dtd_item_list_get_node';
//NodeType axl_dtd_item_node_get_type (axlDtdElementListNode * node);
function axl_dtd_item_node_get_type (node:PaxlDtdElementListNode):TNodeType;
cdecl;external External_library name 'axl_dtd_item_node_get_type';
//axlDtdElementList * axl_dtd_item_node_get_list (axlDtdElementListNode * node);
function axl_dtd_item_node_get_list (node:PaxlDtdElementListNode):PaxlDtdElementList;
cdecl;external External_library name 'axl_dtd_item_node_get_list';
//char * axl_dtd_item_node_get_value (axlDtdElementListNode * node);
function axl_dtd_item_node_get_value (node:PaxlDtdElementListNode):Pchar;
cdecl;external External_library name 'axl_dtd_item_node_get_value';
//AxlDtdTimes axl_dtd_item_node_get_repeat (axlDtdElementListNode * node);
function axl_dtd_item_node_get_repeat (node:PaxlDtdElementListNode):TAxlDtdTimes;
cdecl;external External_library name 'axl_dtd_item_node_get_repeat';
//axl_bool axl_dtd_entity_exists (axlDtd * dtd,
// const char * name,
// axlDtdEntityType type);
function axl_dtd_entity_exists (dtd:PaxlDtd;
const name:Pchar;
atype:TaxlDtdEntityType):Taxl_bool;
cdecl;external External_library name 'axl_dtd_entity_exists';
//char * axl_dtd_entity_value (axlDtd * dtd,
// const char * name,
// axlDtdEntityType type);
function axl_dtd_entity_value (dtd:PaxlDtd;
const name:Pchar;
atype:TaxlDtdEntityType):Pchar;
cdecl;external External_library name 'axl_dtd_entity_value';
//axlDtdAttribute * axl_dtd_get_attr (axlDtd * dtd,
// const char * nodeName);
function axl_dtd_get_attr (dtd:PaxlDtd;
const nodeName:Pchar):PaxlDtdAttribute;
cdecl;external External_library name 'axl_dtd_get_attr';
//int axl_dtd_get_attr_contraints (axlDtd * dtd,
// const char * nodeName);
function axl_dtd_get_attr_contraints (dtd:PaxlDtd;
const nodeName:Pchar):longint;
cdecl;external External_library name 'axl_dtd_get_attr_contraints';
//void axl_dtd_free (axlDtd * dtd);
procedure axl_dtd_free (dtd:PaxlDtd);
cdecl;external External_library name 'axl_dtd_free';
//void axl_dtd_element_free (axlDtdElement * element);
procedure axl_dtd_element_free (element:PaxlDtdElement);
cdecl;external External_library name 'axl_dtd_element_free';
//void axl_dtd_item_list_free (axlDtdElementList * list);
procedure axl_dtd_item_list_free (list:PaxlDtdElementList);
cdecl;external External_library name 'axl_dtd_item_list_free';
//axl_bool axl_dtd_check_entity_ref_and_expand (axlDtdEntityResolver resolver,
// axlPointer data,
// axlStream * stream,
// const char * prefix,
// axlError ** error);
function axl_dtd_check_entity_ref_and_expand (resolver:TaxlDtdEntityResolver;
data:TaxlPointer;
stream:PaxlStream;
const prefix:Pchar;
error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_dtd_check_entity_ref_and_expand';
(* @} *)

View File

@ -0,0 +1,71 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
//void axl_error_new (int code, char * error, axlStream * stream, axlError ** _error);
procedure axl_error_new (code: longint; aerror: PChar; stream: PaxlStream; _error: PPaxlError);
cdecl;external External_library name 'axl_error_new';
//void axl_error_report (axlError ** _error, int code, char * format, ...);
procedure axl_error_report (_error:PPaxlError; code:longint; format:Pchar; args:array of const);
cdecl;external External_library name 'axl_error_report';
procedure axl_error_report (_error:PPaxlError; code:longint; format:Pchar);
cdecl;external External_library name 'axl_error_report';
//axl_bool axl_error_was_ok (axlError * _error);
function axl_error_was_ok (_error:PaxlError):Taxl_bool;
cdecl;external External_library name 'axl_error_was_ok';
//int axl_error_get_code (axlError * _error);
function axl_error_get_code (_error:PaxlError):longint;
cdecl;external External_library name 'axl_error_get_code';
//char * axl_error_get (axlError * _error);
function axl_error_get (_error:PaxlError):Pchar;
cdecl;external External_library name 'axl_error_get';
//void axl_error_free (axlError * _error);
procedure axl_error_free (_error:PaxlError);
cdecl;external External_library name 'axl_error_free';

View File

@ -0,0 +1,69 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
//axlFactory * axl_factory_create (int size_of_type);
function axl_factory_create (size_of_type:longint):PaxlFactory;
cdecl;external External_library name 'axl_factory_create';
//axlPointer axl_factory_get (axlFactory * factory);
function axl_factory_get (factory:PaxlFactory):TaxlPointer;
cdecl;external External_library name 'axl_factory_get';
//void axl_factory_free (axlFactory * factory);
procedure axl_factory_free (factory:PaxlFactory);
cdecl;external External_library name 'axl_factory_free';
//axlStrFactory * axl_string_factory_create ();
function axl_string_factory_create :PaxlStrFactory;
cdecl;external External_library name 'axl_string_factory_create';
//char * axl_string_factory_alloc (axlStrFactory * factory, int size);
function axl_string_factory_alloc (factory:PaxlStrFactory; size:longint):Pchar;
cdecl;external External_library name 'axl_string_factory_alloc';
//void axl_string_factory_free (axlStrFactory * factory);
procedure axl_string_factory_free (factory:PaxlStrFactory);
cdecl;external External_library name 'axl_string_factory_free';

View File

@ -0,0 +1,241 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
//axlHash * axl_hash_new (axlHashFunc hash,
// axlEqualFunc equal);
function axl_hash_new (hash : TaxlHashFunc;
equal : TaxlEqualFunc):PaxlHash;
cdecl;external External_library name 'axl_hash_new';
//axlHash * axl_hash_new_full (axlHashFunc hash,
// axlEqualFunc equal,
// int step);
function axl_hash_new_full (hash : TaxlHashFunc;
equal : TaxlEqualFunc;
step : longint):PaxlHash;
cdecl;external External_library name 'axl_hash_new_full';
//unsigned int axl_hash_string (axlPointer key);
function axl_hash_string (key:TaxlPointer):longword;
cdecl;external External_library name 'axl_hash_string';
//int axl_hash_equal_string (axlPointer keya,
// axlPointer keyb);
function axl_hash_equal_string (keya:TaxlPointer;
keyb:TaxlPointer):longint;
cdecl;external External_library name 'axl_hash_equal_string';
//unsigned int axl_hash_int (axlPointer key);
function axl_hash_int (key:TaxlPointer):longword;
cdecl;external External_library name 'axl_hash_int';
//int axl_hash_equal_int (axlPointer keya,
// axlPointer keyb);
function axl_hash_equal_int (keya:TaxlPointer;
keyb:TaxlPointer):longint;
cdecl;external External_library name 'axl_hash_equal_int';
//void axl_hash_insert (axlHash * hash,
// axlPointer key,
// axlPointer data);
procedure axl_hash_insert (hash:PaxlHash;
key:TaxlPointer;
data:TaxlPointer);
cdecl;external External_library name 'axl_hash_insert';
//void axl_hash_insert_full (axlHash * hash,
// axlPointer key,
// axlDestroyFunc destroy_key,
// axlPointer data,
// axlDestroyFunc destroy_data);
procedure axl_hash_insert_full (hash:PaxlHash;
key:TaxlPointer;
destroy_key:TaxlDestroyFunc;
data:TaxlPointer;
destroy_data:TaxlDestroyFunc);
cdecl;external External_library name 'axl_hash_insert_full';
//axl_bool axl_hash_remove (axlHash * hash,
// axlPointer key);
function axl_hash_remove (hash:PaxlHash;
key:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_hash_remove';
//axl_bool axl_hash_delete (axlHash * hash,
// axlPointer key);
function axl_hash_delete (hash:PaxlHash;
key:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_hash_delete';
//axl_bool axl_hash_exists (axlHash * hash,
// axlPointer key);
function axl_hash_exists (hash:PaxlHash; key:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_hash_exists';
//axlPointer axl_hash_get (axlHash * hash,
// axlPointer key);
function axl_hash_get (hash:PaxlHash;
key:TaxlPointer):TaxlPointer;
cdecl;external External_library name 'axl_hash_get';
//void axl_hash_foreach (axlHash * hash,
// axlHashForeachFunc func,
// axlPointer user_data);
procedure axl_hash_foreach (hash:PaxlHash;
func:TaxlHashForeachFunc;
user_data:TaxlPointer);
cdecl;external External_library name 'axl_hash_foreach';
//void axl_hash_foreach2 (axlHash * hash,
// axlHashForeachFunc2 func,
// axlPointer user_data,
// axlPointer user_data2);
procedure axl_hash_foreach2 (hash:PaxlHash;
func:TaxlHashForeachFunc2;
user_data:TaxlPointer;
user_data2:TaxlPointer);
cdecl;external External_library name 'axl_hash_foreach2';
//void axl_hash_foreach3 (axlHash * hash,
// axlHashForeachFunc3 func,
// axlPointer user_data,
// axlPointer user_data2,
// axlPointer user_data3);
procedure axl_hash_foreach3 (hash:PaxlHash;
func:TaxlHashForeachFunc3;
user_data:TaxlPointer;
user_data2:TaxlPointer;
user_data3:TaxlPointer);
cdecl;external External_library name 'axl_hash_foreach3';
//void axl_hash_foreach4 (axlHash * hash,
// axlHashForeachFunc4 func,
// axlPointer user_data,
// axlPointer user_data2,
// axlPointer user_data3,
// axlPointer user_data4);
procedure axl_hash_foreach4 (hash:PaxlHash;
func:TaxlHashForeachFunc4;
user_data:TaxlPointer;
user_data2:TaxlPointer;
user_data3:TaxlPointer;
user_data4:TaxlPointer);
cdecl;external External_library name 'axl_hash_foreach4';
//int axl_hash_items (axlHash * hash);
function axl_hash_items (hash:PaxlHash):longint;
cdecl;external External_library name 'axl_hash_items';
//axlHash * axl_hash_copy (axlHash * hash,
// axlHashItemCopy key_copy,
// axlHashItemCopy value_copy);
function axl_hash_copy (hash:PaxlHash;
key_copy:TaxlHashItemCopy;
value_copy:TaxlHashItemCopy):PaxlHash;
cdecl;external External_library name 'axl_hash_copy';
//void axl_hash_show_status (axlHash * hash);
procedure axl_hash_show_status (hash:PaxlHash);
cdecl;external External_library name 'axl_hash_show_status';
//typedef void ( *axlHashPrintKeyData) (axlPointer key, axlPointer data);
type
TaxlHashPrintKeyData = procedure (key:TaxlPointer; data:TaxlPointer);cdecl;
//void axl_hash_show_status_full (axlHash * hash,
// axlHashPrintKeyData show_item);
procedure axl_hash_show_status_full (hash:PaxlHash;
show_item:TaxlHashPrintKeyData);
cdecl;external External_library name 'axl_hash_show_status_full';
//void axl_hash_free (axlHash * hash);
procedure axl_hash_free (hash:PaxlHash);
cdecl;external External_library name 'axl_hash_free';
(* cursor interface *)
//axlHashCursor * axl_hash_cursor_new (axlHash * hash);
function axl_hash_cursor_new (hash:PaxlHash):PaxlHashCursor;
cdecl;external External_library name 'axl_hash_cursor_new';
//void axl_hash_cursor_first (axlHashCursor * cursor);
procedure axl_hash_cursor_first (cursor:PaxlHashCursor);
cdecl;external External_library name 'axl_hash_cursor_first';
//void axl_hash_cursor_last (axlHashCursor * cursor);
procedure axl_hash_cursor_last (cursor:PaxlHashCursor);
cdecl;external External_library name 'axl_hash_cursor_last';
//void axl_hash_cursor_next (axlHashCursor * cursor);
procedure axl_hash_cursor_next (cursor:PaxlHashCursor);
cdecl;external External_library name 'axl_hash_cursor_next';
//axl_bool axl_hash_cursor_has_next (axlHashCursor * cursor);
function axl_hash_cursor_has_next (cursor:PaxlHashCursor):Taxl_bool;
cdecl;external External_library name 'axl_hash_cursor_has_next';
//axl_bool axl_hash_cursor_has_item (axlHashCursor * cursor);
function axl_hash_cursor_has_item (cursor:PaxlHashCursor):Taxl_bool;
cdecl;external External_library name 'axl_hash_cursor_has_item';
//void axl_hash_cursor_remove (axlHashCursor * cursor);
procedure axl_hash_cursor_remove (cursor:PaxlHashCursor);
cdecl;external External_library name 'axl_hash_cursor_remove';
//axlPointer axl_hash_cursor_get_key (axlHashCursor * cursor);
function axl_hash_cursor_get_key (cursor:PaxlHashCursor):TaxlPointer;
cdecl;external External_library name 'axl_hash_cursor_get_key';
//axlPointer axl_hash_cursor_get_value (axlHashCursor * cursor);
function axl_hash_cursor_get_value (cursor:PaxlHashCursor):TaxlPointer;
cdecl;external External_library name 'axl_hash_cursor_get_value';
//axlHash * axl_hash_cursor_hash (axlHashCursor * cursor);
function axl_hash_cursor_hash (cursor:PaxlHashCursor):PaxlHash;
cdecl;external External_library name 'axl_hash_cursor_hash';
//void axl_hash_cursor_free (axlHashCursor * cursor);
procedure axl_hash_cursor_free (cursor:PaxlHashCursor);
cdecl;external External_library name 'axl_hash_cursor_free';

View File

@ -0,0 +1,218 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
//axlList * axl_list_new (axlEqualFunc are_equal, axlDestroyFunc destroy_data);
function axl_list_new (are_equal:TaxlEqualFunc; destroy_data:TaxlDestroyFunc):PaxlList;
cdecl;external External_library name 'axl_list_new';
//void axl_list_set_destroy_func (axlList * list, axlDestroyFunc destroy_func);
procedure axl_list_set_destroy_func (list:PaxlList; destroy_func:TaxlDestroyFunc);
cdecl;external External_library name 'axl_list_set_destroy_func';
//int axl_list_equal_string (axlPointer a, axlPointer b);
function axl_list_equal_string (a:TaxlPointer; b:TaxlPointer):longint;
cdecl;external External_library name 'axl_list_equal_string';
//int axl_list_equal_int (axlPointer a, axlPointer b);
function axl_list_equal_int (a:TaxlPointer; b:TaxlPointer):longint;
cdecl;external External_library name 'axl_list_equal_int';
//int axl_list_always_return_1 (axlPointer a, axlPointer b);
function axl_list_always_return_1 (a:TaxlPointer; b:TaxlPointer):longint;
cdecl;external External_library name 'axl_list_always_return_1';
//axlList * axl_list_copy (axlList * list, axlDuplicateFunc func);
function axl_list_copy (list:PaxlList; func:TaxlDuplicateFunc):PaxlList;
cdecl;external External_library name 'axl_list_copy';
//void axl_list_add (axlList * list, axlPointer pointer);
procedure axl_list_add (list:PaxlList; pointer:TaxlPointer);
cdecl;external External_library name 'axl_list_add';
//void axl_list_add_at (axlList * list, axlPointer pointer, int position);
procedure axl_list_add_at (list:PaxlList; pointer:TaxlPointer; position:longint);
cdecl;external External_library name 'axl_list_add_at';
//void axl_list_prepend (axlList * list, axlPointer pointer);
procedure axl_list_prepend (list:PaxlList; pointer:TaxlPointer);
cdecl;external External_library name 'axl_list_prepend';
//void axl_list_append (axlList * list, axlPointer pointer);
procedure axl_list_append (list:PaxlList; pointer:TaxlPointer);
cdecl;external External_library name 'axl_list_append';
//void axl_list_remove (axlList * list, axlPointer pointer);
procedure axl_list_remove (list:PaxlList; pointer:TaxlPointer);
cdecl;external External_library name 'axl_list_remove';
//void axl_list_remove_ptr (axlList * list, axlPointer pointer);
procedure axl_list_remove_ptr (list:PaxlList; pointer:TaxlPointer);
cdecl;external External_library name 'axl_list_remove_ptr';
//void axl_list_remove_at (axlList * list, int position);
procedure axl_list_remove_at (list:PaxlList; position:longint);
cdecl;external External_library name 'axl_list_remove_at';
//void axl_list_unlink (axlList * list, axlPointer pointer);
procedure axl_list_unlink (list:PaxlList; pointer:TaxlPointer);
cdecl;external External_library name 'axl_list_unlink';
//void axl_list_unlink_ptr (axlList * list, axlPointer pointer);
procedure axl_list_unlink_ptr (list:PaxlList; pointer:TaxlPointer);
cdecl;external External_library name 'axl_list_unlink_ptr';
//void axl_list_unlink_at (axlList * list, int position);
procedure axl_list_unlink_at (list:PaxlList; position:longint);
cdecl;external External_library name 'axl_list_unlink_at';
//void axl_list_remove_first (axlList * list);
procedure axl_list_remove_first (list:PaxlList);
cdecl;external External_library name 'axl_list_remove_first';
//void axl_list_unlink_first (axlList * list);
procedure axl_list_unlink_first (list:PaxlList);
cdecl;external External_library name 'axl_list_unlink_first';
//void axl_list_remove_last (axlList * list);
procedure axl_list_remove_last (list:PaxlList);
cdecl;external External_library name 'axl_list_remove_last';
//void axl_list_unlink_last (axlList * list);
procedure axl_list_unlink_last (list:PaxlList);
cdecl;external External_library name 'axl_list_unlink_last';
//axl_bool axl_list_exists (axlList * list, axlPointer pointer);
function axl_list_exists (list:PaxlList; pointer:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_list_exists';
//axl_bool axl_list_exists_at (axlList * list, axlPointer pointer, int position);
function axl_list_exists_at (list:PaxlList; pointer:TaxlPointer; position:longint):Taxl_bool;
cdecl;external External_library name 'axl_list_exists_at';
//axl_bool axl_list_is_empty (axlList * list);
function axl_list_is_empty (list:PaxlList):Taxl_bool;
cdecl;external External_library name 'axl_list_is_empty';
//axlPointer axl_list_get_first (axlList * list);
function axl_list_get_first (list:PaxlList):TaxlPointer;
cdecl;external External_library name 'axl_list_get_first';
//axlPointer axl_list_get_last (axlList * list);
function axl_list_get_last (list:PaxlList):TaxlPointer;
cdecl;external External_library name 'axl_list_get_last';
//axlPointer axl_list_get_nth (axlList * list, int position);
function axl_list_get_nth (list:PaxlList; position:longint):TaxlPointer;
cdecl;external External_library name 'axl_list_get_nth';
//axlPointer axl_list_lookup (axlList * list, axlLookupFunc func, axlPointer data);
function axl_list_lookup (list:PaxlList; func:TaxlLookupFunc; data:TaxlPointer):TaxlPointer;
cdecl;external External_library name 'axl_list_lookup';
//axl_bool axl_list_find_string (axlPointer element, axlPointer data);
function axl_list_find_string (element:TaxlPointer; data:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_list_find_string';
//int axl_list_length (axlList * list);
function axl_list_length (list:PaxlList):longint;
cdecl;external External_library name 'axl_list_length';
//void axl_list_free (axlList * list);
procedure axl_list_free (list:PaxlList);
cdecl;external External_library name 'axl_list_free';
(* cursor interface *)
//axlListCursor * axl_list_cursor_new (axlList * list);
function axl_list_cursor_new (list:PaxlList):PaxlListCursor;
cdecl;external External_library name 'axl_list_cursor_new';
//void axl_list_cursor_first (axlListCursor * cursor);
procedure axl_list_cursor_first (cursor:PaxlListCursor);
cdecl;external External_library name 'axl_list_cursor_first';
//void axl_list_cursor_last (axlListCursor * cursor);
procedure axl_list_cursor_last (cursor:PaxlListCursor);
cdecl;external External_library name 'axl_list_cursor_last';
//void axl_list_cursor_next (axlListCursor * cursor);
procedure axl_list_cursor_next (cursor:PaxlListCursor);
cdecl;external External_library name 'axl_list_cursor_next';
//void axl_list_cursor_previous (axlListCursor * cursor);
procedure axl_list_cursor_previous (cursor:PaxlListCursor);
cdecl;external External_library name 'axl_list_cursor_previous';
//axl_bool axl_list_cursor_has_next (axlListCursor * cursor);
function axl_list_cursor_has_next (cursor:PaxlListCursor):Taxl_bool;
cdecl;external External_library name 'axl_list_cursor_has_next';
//axl_bool axl_list_cursor_has_previous (axlListCursor * cursor);
function axl_list_cursor_has_previous (cursor:PaxlListCursor):Taxl_bool;
cdecl;external External_library name 'axl_list_cursor_has_previous';
//axl_bool axl_list_cursor_has_item (axlListCursor * cursor);
function axl_list_cursor_has_item (cursor:PaxlListCursor):Taxl_bool;
cdecl;external External_library name 'axl_list_cursor_has_item';
//void axl_list_cursor_unlink (axlListCursor * cursor);
procedure axl_list_cursor_unlink (cursor:PaxlListCursor);
cdecl;external External_library name 'axl_list_cursor_unlink';
//void axl_list_cursor_remove (axlListCursor * cursor);
procedure axl_list_cursor_remove (cursor:PaxlListCursor);
cdecl;external External_library name 'axl_list_cursor_remove';
//axlPointer axl_list_cursor_get (axlListCursor * cursor);
function axl_list_cursor_get (cursor:PaxlListCursor):TaxlPointer;
cdecl;external External_library name 'axl_list_cursor_get';
//axlList * axl_list_cursor_list (axlListCursor * cursor);
function axl_list_cursor_list (cursor:PaxlListCursor):PaxlList;
cdecl;external External_library name 'axl_list_cursor_list';
//void axl_list_cursor_free (axlListCursor * cursor);
procedure axl_list_cursor_free (cursor:PaxlListCursor);
cdecl;external External_library name 'axl_list_cursor_free';

View File

@ -0,0 +1,89 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
(**
* \addtogroup axl_log_module
* @{
*)
//axl_bool axl_log_is_enabled ();
function axl_log_is_enabled :Taxl_bool;
cdecl;external External_library name 'axl_log_is_enabled';
//axl_bool axl_log_color_is_enabled ();
function axl_log_color_is_enabled :Taxl_bool;
cdecl;external External_library name 'axl_log_color_is_enabled';
//void axl_log_enable (axl_bool value);
procedure axl_log_enable (value:Taxl_bool);
cdecl;external External_library name 'axl_log_enable';
//void axl_log_color_enable (axl_bool value);
procedure axl_log_color_enable (value:Taxl_bool);
cdecl;external External_library name 'axl_log_color_enable';
{
#if defined(SHOW_DEBUG_LOG)
# define __axl_log axl_log
#else
# if defined(AXL_OS_WIN32) && !( defined (__GNUC__) || _MSC_VER >= 1400)
/* default case where '...' is not supported but log is still
* disabled */
# define __axl_log axl_log
# else
# define __axl_log(domain, level, message, ...) /* nothing */
# endif
#endif
}
//void axl_log (char * domain, AxlDebugLevel level, char * message, ...);
procedure axl_log (domain:Pchar; level:TAxlDebugLevel; amessage:Pchar; args:array of const);
cdecl;external External_library name 'axl_log';
procedure axl_log(domain:Pchar; level:TAxlDebugLevel; amessage:Pchar);
cdecl;external External_library name 'axl_log';
(* @} *)

View File

@ -0,0 +1,915 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
(**
* \addtogroup axl_node_module
* @{
*)
//axlNode * axl_node_create (const char * name);
function axl_node_create (const name:Pchar):PaxlNode;
cdecl;external External_library name 'axl_node_create';
//axlNode * axl_node_create_ref (char * name);
function axl_node_create_ref (name:Pchar):PaxlNode;
cdecl;external External_library name 'axl_node_create_ref';
//axlNode * axl_node_parse_strings (axlError ** error, ...);
function axl_node_parse_strings (error:PPaxlError; args:array of const):PaxlNode;
cdecl;external External_library name 'axl_node_parse_strings';
function axl_node_parse_strings (error:PPaxlError):PaxlNode;
cdecl;external External_library name 'axl_node_parse_strings';
//axlNode * axl_node_parse (axlError ** error, const char * content, ...);
function axl_node_parse (error:PPaxlError; const content:Pchar; args:array of const):PaxlNode;
cdecl;external External_library name 'axl_node_parse';
function axl_node_parse (error:PPaxlError; content:Pchar):PaxlNode;
cdecl;external External_library name 'axl_node_parse';
//void axl_node_set_name (axlNode * node,
// const char * name);
procedure axl_node_set_name (node:PaxlNode;
const name:Pchar);
cdecl;external External_library name 'axl_node_set_name';
//void axl_node_set_name_ref (axlNode * node,
// char * name);
procedure axl_node_set_name_ref (node:PaxlNode;
name:Pchar);
cdecl;external External_library name 'axl_node_set_name_ref';
//void axl_node_set_name_from_factory (axlNode * node,
// char * name);
procedure axl_node_set_name_from_factory (node:PaxlNode;
name:Pchar);
cdecl;external External_library name 'axl_node_set_name_from_factory';
//axlNode * axl_node_copy (axlNode * node,
// axl_bool copy_attributes,
// axl_bool copy_childs);
function axl_node_copy (node:PaxlNode;
copy_attributes:Taxl_bool;
copy_childs:Taxl_bool):PaxlNode;
cdecl;external External_library name 'axl_node_copy';
//axlDoc * axl_node_get_doc (axlNode * node);
function axl_node_get_doc (node:PaxlNode):PaxlDoc;
cdecl;external External_library name 'axl_node_get_doc';
//void axl_node_set_doc (axlNode * node,
// axlDoc * doc);
procedure axl_node_set_doc (node:PaxlNode;
doc:PaxlDoc);
cdecl;external External_library name 'axl_node_set_doc';
//void axl_node_set_attribute (axlNode * node,
// const char * attribute,
// const char * value);
procedure axl_node_set_attribute (node:PaxlNode;
const attribute:Pchar;
const value:Pchar);
cdecl;external External_library name 'axl_node_set_attribute';
//void axl_node_set_attribute_ref (axlNode * node,
// char * attribute,
// char * value);
procedure axl_node_set_attribute_ref (node:PaxlNode;
attribute:Pchar;
value:Pchar);
cdecl;external External_library name 'axl_node_set_attribute_ref';
//void axl_node_set_attribute_from_factory (axlFactory * factory,
// axlNode * node,
// char * attribute,
// char * value);
procedure axl_node_set_attribute_from_factory (factory:PaxlFactory;
node:PaxlNode;
attribute:Pchar;
value:Pchar);
cdecl;external External_library name 'axl_node_set_attribute_from_factory';
(**
* @brief Macro definition which works as an alias for \ref
* axl_node_get_attribute_value.
*
* @param node The node being checked to have an attribute value.
* @param attr The attribute that is being check to be present in the node provided.
*
* @return \ref axl_true if the node has the provided attribute, otherwise
* \ref axl_false is returned.
*)
//#define HAS_ATTR(node,attr) axl_node_has_attribute(node,attr)
function HAS_ATTR (node:PaxlNode; const attribute:Pchar):Taxl_bool;
//axl_bool axl_node_has_attribute (axlNode * node,
// const char * attribute);
function axl_node_has_attribute (node:PaxlNode;
const attribute:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_node_has_attribute';
//void axl_node_remove_attribute (axlNode * node,
// const char * attribute);
procedure axl_node_remove_attribute (node:PaxlNode;
const attribute:Pchar);
cdecl;external External_library name 'axl_node_remove_attribute';
//int axl_node_num_attributes (axlNode * node);
function axl_node_num_attributes (node:PaxlNode):longint;
cdecl;external External_library name 'axl_node_num_attributes';
{$inline on}
(**
* @brief Macro definition, which works as an alias for \ref
* axl_node_get_attribute_value.
*
* @param node The node that is being required to return the content
* of a particular node.
*
* @param attr The attribute that is requested.
*
* @return The value assocaited to the attribute value or null if it
* fails. See \ref axl_node_get_attribute_value.
*)
//#define ATTR_VALUE(node,attr) axl_node_get_attribute_value(node, attr)
function ATTR_VALUE(node:PaxlNode; const attribute:Pchar):Pchar;
{$inline off}
//const char * axl_node_get_attribute_value (axlNode * node,
// const char * attribute);
function axl_node_get_attribute_value (node:PaxlNode;
const attribute:Pchar):Pchar;
cdecl;external External_library name 'axl_node_get_attribute_value';
//char * axl_node_get_attribute_value_copy (axlNode * node,
// const char * attribute);
function axl_node_get_attribute_value_copy (node:PaxlNode;
const attribute:Pchar):Pchar;
cdecl;external External_library name 'axl_node_get_attribute_value_copy';
{$inline on}
(**
* @brief Simple alias definition to \ref axl_node_get_attribute_value_trans function.
*
* @param node The node which contains the attribute requested.
*
* @param attr The attribute key that is being requested.
*
* @return A newly allocated string containing the attribute value,
* with known entity references translated.
*)
//#define ATTR_VALUE_TRANS(node,attr) axl_node_get_attribute_value_trans(node,attr)
function ATTR_VALUE_TRANS(node:PaxlNode; const attribute:Pchar):Pchar;
{$inline off}
//char * axl_node_get_attribute_value_trans (axlNode * node,
// const char * attribute);
function axl_node_get_attribute_value_trans (node:PaxlNode;
const attribute:Pchar):Pchar;
cdecl;external External_library name 'axl_node_get_attribute_value_trans';
{$inline on}
(**
* @brief Allows to get the value associated to the attributed
* provided, inside the node selected, removing trailing and ending
* white spaces (in the W3C sence: \\n, \\t, \\r, ' ').
*
* This is a macro alias to \ref axl_node_get_attribute_value_trimmed.
*
* @param node The node that is requested to return the associated
* value to the attributed.
*
* @param attr The attribute that is being requested.
*
* @return A reference to the attribute value or NULL if it fails.
*)
//#define ATTR_VALUE_TRIMMED(node,attr) axl_node_get_attribute_value_trimmed(node,attr)
function ATTR_VALUE_TRIMMED(node:PaxlNode; const attribute:Pchar):Pchar;
{$inline off}
//const char * axl_node_get_attribute_value_trimmed (axlNode * node,
// const char * attribute);
function axl_node_get_attribute_value_trimmed (node:PaxlNode;
const attribute:Pchar):Pchar;
cdecl;external External_library name 'axl_node_get_attribute_value_trimmed';
{$inline on}
(**
* @brief Convenience macro wrapping \ref
* axl_node_has_attribute_value.
*)
//#define HAS_ATTR_VALUE(node, attr,value) (axl_node_has_attribute_value (node, attr, value))
function HAS_ATTR_VALUE(node:PaxlNode; const attribute:Pchar; const value:Pchar):Taxl_bool;
{$inline off}
//axl_bool axl_node_has_attribute_value (axlNode * node,
// const char * attribute,
// const char * value);
function axl_node_has_attribute_value (node:PaxlNode;
const attribute:Pchar;
const value:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_node_has_attribute_value';
//axl_bool axl_node_has_attributes (axlNode * node);
function axl_node_has_attributes (node:PaxlNode):Taxl_bool;
cdecl;external External_library name 'axl_node_has_attributes';
(**
* @}
*)
(**
* \addtogroup axl_node_attribute_cursor
* @{
*)
(* XML node attribute iteration API provided to traverse all
* attributes without knowing them. *)
//axlAttrCursor * axl_node_attr_cursor_new (axlNode * node);
function axl_node_attr_cursor_new (node:PaxlNode):PaxlAttrCursor;
cdecl;external External_library name 'axl_node_attr_cursor_new';
//void axl_node_attr_cursor_first (axlAttrCursor * cursor);
procedure axl_node_attr_cursor_first (cursor:PaxlAttrCursor);
cdecl;external External_library name 'axl_node_attr_cursor_first';
//void axl_node_attr_cursor_next (axlAttrCursor * cursor);
procedure axl_node_attr_cursor_next (cursor:PaxlAttrCursor);
cdecl;external External_library name 'axl_node_attr_cursor_next';
//axl_bool axl_node_attr_cursor_has_next (axlAttrCursor * cursor);
function axl_node_attr_cursor_has_next (cursor:PaxlAttrCursor):Taxl_bool;
cdecl;external External_library name 'axl_node_attr_cursor_has_next';
//axl_bool axl_node_attr_cursor_has_item (axlAttrCursor * cursor);
function axl_node_attr_cursor_has_item (cursor:PaxlAttrCursor):Taxl_bool;
cdecl;external External_library name 'axl_node_attr_cursor_has_item';
//const char * axl_node_attr_cursor_get_key (axlAttrCursor * cursor);
function axl_node_attr_cursor_get_key (cursor:PaxlAttrCursor):Pchar;
cdecl;external External_library name 'axl_node_attr_cursor_get_key';
//const char * axl_node_attr_cursor_get_value (axlAttrCursor * cursor);
function axl_node_attr_cursor_get_value (cursor:PaxlAttrCursor):Pchar;
cdecl;external External_library name 'axl_node_attr_cursor_get_value';
//void axl_node_attr_cursor_free (axlAttrCursor * cursor);
procedure axl_node_attr_cursor_free (cursor:PaxlAttrCursor);
cdecl;external External_library name 'axl_node_attr_cursor_free';
//void axl_node_attr_foreach (axlNode * node,
// axlNodeAttrForeachFunc func,
// axlPointer data,
// axlPointer data2);
procedure axl_node_attr_foreach (node:PaxlNode;
func:TaxlNodeAttrForeachFunc;
data:TaxlPointer;
data2:TaxlPointer);
cdecl;external External_library name 'axl_node_attr_foreach';
(**
* @}
*)
(**
* \addtogroup axl_node_annotate
* @{
*)
//void axl_node_annotate_data (axlNode * node,
// const char * key,
// axlPointer data);
procedure axl_node_annotate_data (node:PaxlNode;
const key:Pchar;
data:TaxlPointer);
cdecl;external External_library name 'axl_node_annotate_data';
//void axl_node_annotate_data_full (axlNode * node,
// const char * key,
// axlDestroyFunc key_destroy,
// axlPointer data,
// axlDestroyFunc data_destroy);
procedure axl_node_annotate_data_full (node:PaxlNode;
const key:Pchar;
key_destroy:TaxlDestroyFunc;
data:TaxlPointer;
data_destroy:TaxlDestroyFunc);
cdecl;external External_library name 'axl_node_annotate_data_full';
//axlPointer axl_node_annotate_get (axlNode * node,
// const char * key,
// axl_bool lookup_in_parent);
function axl_node_annotate_get (node:PaxlNode;
const key:Pchar;
lookup_in_parent:Taxl_bool):TaxlPointer;
cdecl;external External_library name 'axl_node_annotate_get';
//void axl_node_annotate_int (axlNode * node,
// const char * key,
// int int_value);
procedure axl_node_annotate_int (node:PaxlNode;
const key:Pchar;
int_value:longint);
cdecl;external External_library name 'axl_node_annotate_int';
//void axl_node_annotate_string (axlNode * node,
// const char * key,
// const char * string_value);
procedure axl_node_annotate_string (node:PaxlNode;
const key:Pchar;
const string_value:Pchar);
cdecl;external External_library name 'axl_node_annotate_string';
//void axl_node_annotate_double (axlNode * node,
// const char * key,
// double double_value);
procedure axl_node_annotate_double (node:PaxlNode;
const key:Pchar;
double_value:double);
cdecl;external External_library name 'axl_node_annotate_double';
//int axl_node_annotate_get_int (axlNode * node,
// const char * key,
// axl_bool lookup_in_parent);
function axl_node_annotate_get_int (node:PaxlNode;
const key:Pchar;
lookup_in_parent:Taxl_bool):longint;
cdecl;external External_library name 'axl_node_annotate_get_int';
//char * axl_node_annotate_get_string (axlNode * node,
// const char * key,
// axl_bool lookup_in_parent);
function axl_node_annotate_get_string (node:PaxlNode;
const key:Pchar;
lookup_in_parent:Taxl_bool):Pchar;
cdecl;external External_library name 'axl_node_annotate_get_string';
//double axl_node_annotate_get_double (axlNode * node,
// const char * key,
// axl_bool lookup_in_parent);
function axl_node_annotate_get_double (node:PaxlNode;
const key:Pchar;
lookup_in_parent:Taxl_bool):double;
cdecl;external External_library name 'axl_node_annotate_get_double';
(**
* @}
*)
(**
* \addtogroup axl_node_module
* @{
*)
(**
* @brief Allows to easily check that the given xml node (\ref
* axlNode) have the provided name.
*
* This macro is provided as a convenience to check that a particular
* node have a particular name. Check the documentation that this
* macro is wrapping to get examples: \ref axl_node_get_name.
*
* <i><b>NOTE:</b> This function isn't XML Namespace aware. You must use \ref axl_ns_node_cmp instead. See \ref axl_ns_doc_validate. </i>
*
* @param node The \ref axlNode where the name will be compared with
* the provided value.
*
* @param name The name to compare.
*
* @return \ref axl_true if names are equal or \ref axl_false if not.
*)
//#define NODE_CMP_NAME(node,name) (axl_cmp ((node != NULL) ? axl_node_get_name(node) : "><", (name != NULL) ? name : "<>"))
{TODO: complete function^^^}
//const char * axl_node_get_name (axlNode * node);
function axl_node_get_name (node:PaxlNode):Pchar;
cdecl;external External_library name 'axl_node_get_name';
//axlNode * axl_node_get_parent (axlNode * node);
function axl_node_get_parent (node:PaxlNode):PaxlNode;
cdecl;external External_library name 'axl_node_get_parent';
//axlNode * axl_node_get_next (axlNode * node);
function axl_node_get_next (node:PaxlNode):PaxlNode;
cdecl;external External_library name 'axl_node_get_next';
//axlNode * axl_node_get_next_called (axlNode * node,
// char * name);
function axl_node_get_next_called (node:PaxlNode;
name:Pchar):PaxlNode;
cdecl;external External_library name 'axl_node_get_next_called';
//axlNode * axl_node_get_previous (axlNode * node);
function axl_node_get_previous (node:PaxlNode):PaxlNode;
cdecl;external External_library name 'axl_node_get_previous';
//axlNode * axl_node_get_previous_called (axlNode * node,
// char * name);
function axl_node_get_previous_called (node:PaxlNode;
name:Pchar):PaxlNode;
cdecl;external External_library name 'axl_node_get_previous_called';
//axlNode * axl_node_get_first_child (axlNode * node);
function axl_node_get_first_child (node:PaxlNode):PaxlNode;
cdecl;external External_library name 'axl_node_get_first_child';
//axlNode * axl_node_get_last_child (axlNode * node);
function axl_node_get_last_child (node:PaxlNode):PaxlNode;
cdecl;external External_library name 'axl_node_get_last_child';
//void axl_node_set_child (axlNode * parent,
// axlNode * child);
procedure axl_node_set_child (parent:PaxlNode;
child:PaxlNode);
cdecl;external External_library name 'axl_node_set_child';
//void axl_node_set_child_after (axlNode * reference,
// axlNode * child);
procedure axl_node_set_child_after (reference:PaxlNode;
child:PaxlNode);
cdecl;external External_library name 'axl_node_set_child_after';
//void axl_node_replace (axlNode * node,
// axlNode * new_node,
// axl_bool dealloc);
procedure axl_node_replace (node:PaxlNode;
new_node:PaxlNode;
dealloc:Taxl_bool);
cdecl;external External_library name 'axl_node_replace';
//void axl_node_remove (axlNode * node,
// axl_bool dealloc);
procedure axl_node_remove (node:PaxlNode;
dealloc:Taxl_bool);
cdecl;external External_library name 'axl_node_remove';
//void axl_node_deattach (axlNode * node);
procedure axl_node_deattach (node:PaxlNode);
cdecl;external External_library name 'axl_node_deattach';
//void axl_node_set_is_empty (axlNode * node,
// axl_bool empty);
procedure axl_node_set_is_empty (node:PaxlNode;
empty:Taxl_bool);
cdecl;external External_library name 'axl_node_set_is_empty';
//axl_bool axl_node_is_empty (axlNode * node);
function axl_node_is_empty (node:PaxlNode):Taxl_bool;
cdecl;external External_library name 'axl_node_is_empty';
//const char * axl_node_get_content (axlNode * node,
// int * content_size);
function axl_node_get_content (node:PaxlNode;
var content_size:longint):Pchar;
cdecl;external External_library name 'axl_node_get_content';
//char * axl_node_get_content_copy (axlNode * node,
// int * content_size);
function axl_node_get_content_copy (node:PaxlNode;
var content_size:longint):Pchar;
cdecl;external External_library name 'axl_node_get_content_copy';
//char * axl_node_get_content_trans (axlNode * node,
// int * content_size);
function axl_node_get_content_trans (node:PaxlNode;
var content_size:longint):Pchar;
cdecl;external External_library name 'axl_node_get_content_trans';
//char * axl_node_get_content_trim (axlNode * node,
// int * content_size);
function axl_node_get_content_trim (node:PaxlNode;
var content_size:longint):Pchar;
cdecl;external External_library name 'axl_node_get_content_trim';
//void axl_node_set_content (axlNode * node,
// const char * content,
// int content_size);
procedure axl_node_set_content (node:PaxlNode;
const content:Pchar;
content_size:longint);
cdecl;external External_library name 'axl_node_set_content';
//void axl_node_set_content_ref (axlNode * node,
// char * content,
// int content_size);
procedure axl_node_set_content_ref (node:PaxlNode;
content:Pchar;
content_size:longint);
cdecl;external External_library name 'axl_node_set_content_ref';
//void axl_node_set_content_from_factory (axlFactory * factory,
// axlNode * node,
// char * content,
// int content_size);
procedure axl_node_set_content_from_factory (factory:PaxlFactory;
node:PaxlNode;
content:Pchar;
content_size:longint);
cdecl;external External_library name 'axl_node_set_content_from_factory';
//void axl_node_set_cdata_content (axlNode * node,
// const char * content,
// int content_size);
procedure axl_node_set_cdata_content (node:PaxlNode;
const content:Pchar;
content_size:longint);
cdecl;external External_library name 'axl_node_set_cdata_content';
//void axl_node_set_cdata_content_from_factory (axlFactory * factory,
// axlNode * node,
// char * content,
// int content_size);
procedure axl_node_set_cdata_content_from_factory (factory:PaxlFactory;
node:PaxlNode;
content:Pchar;
content_size:longint);
cdecl;external External_library name 'axl_node_set_cdata_content_from_factory';
//void axl_node_set_comment (axlNode * node,
// char * comment,
// int comment_size);
procedure axl_node_set_comment (node:PaxlNode;
comment:Pchar;
comment_size:longint);
cdecl;external External_library name 'axl_node_set_comment';
//void axl_node_set_have_childs (axlNode * node, axl_bool childs);
procedure axl_node_set_have_childs (node:PaxlNode; childs:Taxl_bool);
cdecl;external External_library name 'axl_node_set_have_childs';
//axl_bool axl_node_have_childs (axlNode * node);
function axl_node_have_childs (node:PaxlNode):Taxl_bool;
cdecl;external External_library name 'axl_node_have_childs';
//axlNode * axl_node_get_child_called (axlNode * parent, char * name);
function axl_node_get_child_called (parent:PaxlNode;
name:Pchar):PaxlNode;
cdecl;external External_library name 'axl_node_get_child_called';
//axlNode * axl_node_find_called (axlNode * parent, char * name);
function axl_node_find_called (parent:PaxlNode; name:Pchar):PaxlNode;
cdecl;external External_library name 'axl_node_find_called';
//axlNode * axl_node_get_child_nth (axlNode * parent, int position);
function axl_node_get_child_nth (parent:PaxlNode;
position:longint):PaxlNode;
cdecl;external External_library name 'axl_node_get_child_nth';
//int axl_node_get_child_num (axlNode * parent);
function axl_node_get_child_num (parent:PaxlNode):longint;
cdecl;external External_library name 'axl_node_get_child_num';
//axlList * axl_node_get_childs (axlNode * node);
function axl_node_get_childs (node:PaxlNode):PaxlList;
cdecl;external External_library name 'axl_node_get_childs';
//axl_bool axl_node_are_equal (axlNode * node, axlNode * node2);
function axl_node_are_equal (node:PaxlNode; node2:PaxlNode):Taxl_bool;
cdecl;external External_library name 'axl_node_are_equal';
//axl_bool axl_node_are_equal_full (axlNode * node, axlNode * node2, axlError ** error);
function axl_node_are_equal_full (node:PaxlNode; node2:PaxlNode; error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_node_are_equal_full';
//void axl_node_add_pi_target (axlNode * node,
// char * target,
// char * content);
procedure axl_node_add_pi_target (node:PaxlNode;
target:Pchar;
content:Pchar);
cdecl;external External_library name 'axl_node_add_pi_target';
//axl_bool axl_node_has_pi_target (axlNode * node,
// char * pi_target);
function axl_node_has_pi_target (node:PaxlNode;
pi_target:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_node_has_pi_target';
//char * axl_node_get_pi_target_content (axlNode * node,
// char * pi_target);
function axl_node_get_pi_target_content (node:PaxlNode;
pi_target:Pchar):Pchar;
cdecl;external External_library name 'axl_node_get_pi_target_content';
//axlList * axl_node_get_pi_target_list (axlNode * node);
function axl_node_get_pi_target_list (node:PaxlNode):PaxlList;
cdecl;external External_library name 'axl_node_get_pi_target_list';
//void axl_node_transfer_childs (axlNode * old_parent,
// axlNode * new_parent);
procedure axl_node_transfer_childs (old_parent:PaxlNode;
new_parent:PaxlNode);
cdecl;external External_library name 'axl_node_transfer_childs';
//axl_bool axl_node_dump (axlNode * node,
// char ** content,
// int * size);
function axl_node_dump (node:PaxlNode;
content:PPchar;
var size:longint):Taxl_bool;
cdecl;external External_library name 'axl_node_dump';
//axl_bool axl_node_dump_pretty (axlNode * node,
// char ** content,
// int * size,
// int tabular);
function axl_node_dump_pretty (node:PaxlNode;
content:PPchar;
var size:longint;
tabular:longint):Taxl_bool;
cdecl;external External_library name 'axl_node_dump_pretty';
//axl_bool axl_node_dump_to_file (axlNode * node,
// char * file_path);
function axl_node_dump_to_file (node:PaxlNode;
file_path:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_node_dump_to_file';
//axl_bool axl_node_dump_pretty_to_file (axlNode * node,
// char * file_path,
// int tabular);
function axl_node_dump_pretty_to_file (node:PaxlNode;
file_path:Pchar;
tabular:longint):Taxl_bool;
cdecl;external External_library name 'axl_node_dump_pretty_to_file';
//int axl_node_get_flat_size (axlNode * node,
// axl_bool pretty_print,
// int level,
// int tabular);
function axl_node_get_flat_size (node:PaxlNode;
pretty_print:Taxl_bool;
level:longint;
tabular:longint):longint;
cdecl;external External_library name 'axl_node_get_flat_size';
//int axl_node_dump_at (axlNode * node,
// char * content,
// int desp,
// axl_bool pretty_print,
// int level,
// int tabular);
function axl_node_dump_at (node:PaxlNode;
content:Pchar;
desp:longint;
pretty_print:Taxl_bool;
level:longint;
tabular:longint):longint;
cdecl;external External_library name 'axl_node_dump_at';
//axl_bool axl_node_has_invalid_chars (const char * content,
// int content_size,
// int * added_size);
function axl_node_has_invalid_chars (const content:Pchar;
content_size:longint;
var added_size:longint):Taxl_bool;
cdecl;external External_library name 'axl_node_has_invalid_chars';
//axl_bool axl_node_has_invalid_chars_cdata (const char * content,
// int content_size,
// int * added_size);
function axl_node_has_invalid_chars_cdata (const content:Pchar;
content_size:longint;
var added_size:longint):Taxl_bool;
cdecl;external External_library name 'axl_node_has_invalid_chars_cdata';
//char * axl_node_content_translate_defaults (char * content,
// int * content_size);
function axl_node_content_translate_defaults (content:Pchar;
var content_size:longint):Pchar;
cdecl;external External_library name 'axl_node_content_translate_defaults';
//char * axl_node_content_copy_and_escape (const char * content,
// int content_size,
// int additional_size);
function axl_node_content_copy_and_escape (const content:Pchar;
content_size:longint;
additional_size:longint):Pchar;
cdecl;external External_library name 'axl_node_content_copy_and_escape';
//char * axl_node_content_copy_and_escape_cdata (const char * content,
// int content_size,
// int additional_size);
function axl_node_content_copy_and_escape_cdata (const content:Pchar;
content_size:longint;
additional_size:longint):Pchar;
cdecl;external External_library name 'axl_node_content_copy_and_escape_cdata';
//void axl_node_free (axlNode * node);
procedure axl_node_free (node:PaxlNode);
cdecl;external External_library name 'axl_node_free';
//void axl_node_free_full (axlNode * node, axl_bool also_childs);
procedure axl_node_free_full (node:PaxlNode; also_childs:Taxl_bool);
cdecl;external External_library name 'axl_node_free_full';
(* @} *)
(* item interface *)
//axlItem * axl_item_new (AxlItemType type,
// axlPointer data);
function axl_item_new (atype:TAxlItemType;
data:TaxlPointer):PaxlItem;
cdecl;external External_library name 'axl_item_new';
//axlItem * axl_item_new_ref (AxlItemType type,
// axlPointer data);
function axl_item_new_ref (atype:TAxlItemType;
data:TaxlPointer):PaxlItem;
cdecl;external External_library name 'axl_item_new_ref';
//axlDoc * axl_item_get_doc (axlItem * item);
function axl_item_get_doc (item:PaxlItem):PaxlDoc;
cdecl;external External_library name 'axl_item_get_doc';
//void axl_item_set_doc (axlItem * item, axlDoc * doc);
procedure axl_item_set_doc (item:PaxlItem; doc:PaxlDoc);
cdecl;external External_library name 'axl_item_set_doc';
//axlNode * axl_item_get_parent (axlItem * item);
function axl_item_get_parent (item:PaxlItem):PaxlNode;
cdecl;external External_library name 'axl_item_get_parent';
//axlItem * axl_item_get_next (axlItem * item);
function axl_item_get_next (item:PaxlItem):PaxlItem;
cdecl;external External_library name 'axl_item_get_next';
//axlItem * axl_item_node_next (axlNode * node);
function axl_item_node_next (node:PaxlNode):PaxlItem;
cdecl;external External_library name 'axl_item_node_next';
//axlItem * axl_item_get_previous (axlItem * item);
function axl_item_get_previous (item:PaxlItem):PaxlItem;
cdecl;external External_library name 'axl_item_get_previous';
//axlItem * axl_item_node_previous (axlNode * node);
function axl_item_node_previous (node:PaxlNode):PaxlItem;
cdecl;external External_library name 'axl_item_node_previous';
//axlItem * axl_item_node_holder (axlNode * node);
function axl_item_node_holder (node:PaxlNode):PaxlItem;
cdecl;external External_library name 'axl_item_node_holder';
//axlItem * axl_item_get_first_child (axlNode * node);
function axl_item_get_first_child (node:PaxlNode):PaxlItem;
cdecl;external External_library name 'axl_item_get_first_child';
//axlItem * axl_item_get_last_child (axlNode * node);
function axl_item_get_last_child (node:PaxlNode):PaxlItem;
cdecl;external External_library name 'axl_item_get_last_child';
//AxlItemType axl_item_get_type (axlItem * item);
function axl_item_get_type (item:PaxlItem):TAxlItemType;
cdecl;external External_library name 'axl_item_get_type';
//axlPointer axl_item_get_data (axlItem * item);
function axl_item_get_data (item:PaxlItem):TaxlPointer;
cdecl;external External_library name 'axl_item_get_data';
//char * axl_item_get_content (axlItem * item,
// int * size);
function axl_item_get_content (item:PaxlItem;
var size:longint):Pchar;
cdecl;external External_library name 'axl_item_get_content';
//void axl_item_set_child (axlNode * parent,
// AxlItemType type,
// axlPointer data);
procedure axl_item_set_child (parent:PaxlNode;
atype:TAxlItemType;
data:TaxlPointer);
cdecl;external External_library name 'axl_item_set_child';
//void axl_item_set_child_ref (axlNode * parent,
// axlItem * item);
procedure axl_item_set_child_ref (parent:PaxlNode;
item:PaxlItem);
cdecl;external External_library name 'axl_item_set_child_ref';
//void axl_item_set_after (axlItem * item,
// AxlItemType type,
// axlPointer data);
procedure axl_item_set_after (item:PaxlItem;
atype:TAxlItemType;
data:TaxlPointer);
cdecl;external External_library name 'axl_item_set_after';
//axlItem * axl_item_copy (axlItem * item,
// axlNode * set_parent);
function axl_item_copy (item:PaxlItem;
set_parent:PaxlNode):PaxlItem;
cdecl;external External_library name 'axl_item_copy';
//void axl_item_remove (axlItem * item,
// axl_bool dealloc);
procedure axl_item_remove (item:PaxlItem;
dealloc:Taxl_bool);
cdecl;external External_library name 'axl_item_remove';
//void axl_item_replace (axlItem * item,
// axlItem * new_item,
// axl_bool dealloc);
procedure axl_item_replace (item:PaxlItem;
new_item:PaxlItem;
dealloc:Taxl_bool);
cdecl;external External_library name 'axl_item_replace';
//void axl_item_transfer_childs_after (axlNode * old_parent,
// axlItem * item_ref);
procedure axl_item_transfer_childs_after (old_parent:PaxlNode;
item_ref:PaxlItem);
cdecl;external External_library name 'axl_item_transfer_childs_after';
//axl_bool axl_item_are_equal (axlItem * item,
// axlItem * item2,
// axl_bool trimmed);
function axl_item_are_equal (item:PaxlItem;
item2:PaxlItem;
trimmed:Taxl_bool):Taxl_bool;
cdecl;external External_library name 'axl_item_are_equal';
//axl_bool axl_item_are_equal_full (axlItem * item,
// axlItem * item2,
// axl_bool trimmed,
// axlError ** error);
function axl_item_are_equal_full (item:PaxlItem;
item2:PaxlItem;
trimmed:Taxl_bool;
error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_item_are_equal_full';
//void axl_item_free (axlItem * item,
// axl_bool dealloc);
procedure axl_item_free (item:PaxlItem;
dealloc:Taxl_bool);
cdecl;external External_library name 'axl_item_free';
//axlFactory * axl_item_factory_create ();
function axl_item_factory_create :PaxlFactory;
cdecl;external External_library name 'axl_item_factory_create';
//axlItem * axl_item_factory_get (axlFactory * factory);
function axl_item_factory_get (factory:PaxlFactory):PaxlItem;
cdecl;external External_library name 'axl_item_factory_get';
//axlFactory * axl_node_factory_create ();
function axl_node_factory_create :PaxlFactory;
cdecl;external External_library name 'axl_node_factory_create';
//axlNode * axl_node_factory_get (axlFactory * factory);
function axl_node_factory_get (factory:PaxlFactory):PaxlNode;
cdecl;external External_library name 'axl_node_factory_get';
//axlFactory * axl_item_content_factory_create ();
function axl_item_content_factory_create :PaxlFactory;
cdecl;external External_library name 'axl_item_content_factory_create';
//axlFactory * axl_item_attr_factory_create ();
function axl_item_attr_factory_create :PaxlFactory;
cdecl;external External_library name 'axl_item_attr_factory_create';

View File

@ -0,0 +1,82 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
{$inline on}
//#define HAS_ATTR(node,attr) axl_node_has_attribute(node,attr)
function HAS_ATTR(node:PaxlNode; const attribute:Pchar):Taxl_bool; inline;
begin
Result := axl_node_has_attribute(node,attribute);
end;
//#define ATTR_VALUE(node,attr) axl_node_get_attribute_value(node, attr)
function ATTR_VALUE(node:PaxlNode; const attribute:Pchar):Pchar; inline;
begin
Result := axl_node_get_attribute_value(node, attribute);
end;
//#define ATTR_VALUE_TRANS(node,attr) axl_node_get_attribute_value_trans(node,attr)
function ATTR_VALUE_TRANS(node:PaxlNode; const attribute:Pchar):Pchar; inline;
begin
Result := axl_node_get_attribute_value_trans(node,attribute);
end;
//#define ATTR_VALUE_TRIMMED(node,attr) axl_node_get_attribute_value_trimmed(node,attr)
function ATTR_VALUE_TRIMMED(node:PaxlNode; const attribute:Pchar):Pchar; inline;
begin
Result := axl_node_get_attribute_value_trimmed(node,attribute);
end;
//#define HAS_ATTR_VALUE(node, attr,value) (axl_node_has_attribute_value (node, attr, value))
function HAS_ATTR_VALUE(node:PaxlNode; const attribute:Pchar; const value:Pchar):Taxl_bool; inline;
begin
Result := axl_node_has_attribute_value (node, attribute, value);
end;
//#define NODE_CMP_NAME(node,name) (axl_cmp ((node != NULL) ? axl_node_get_name(node) : "><", (name != NULL) ? name : "<>"))
//function axl_node_get_name (node:PaxlNode):Pchar;
{$inline off}

View File

@ -0,0 +1,134 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
(**
* \addtogroup axl_stack_module
* @{
*)
//axlStack * axl_stack_new (axlDestroyFunc destroy_data);
function axl_stack_new (destroy_data:TaxlDestroyFunc):PaxlStack;
cdecl;external External_library name 'axl_stack_new';
//void axl_stack_push (axlStack * stack, axlPointer data);
procedure axl_stack_push (stack:PaxlStack; data:TaxlPointer);
cdecl;external External_library name 'axl_stack_push';
//axlPointer axl_stack_pop (axlStack * stack);
function axl_stack_pop (stack:PaxlStack):TaxlPointer;
cdecl;external External_library name 'axl_stack_pop';
//axlPointer axl_stack_peek (axlStack * stack);
function axl_stack_peek (stack:PaxlStack):TaxlPointer;
cdecl;external External_library name 'axl_stack_peek';
//axl_bool axl_stack_foreach (axlStack * stack,
// axlStackForeach2 func,
// axlPointer user_data,
// axlPointer user_data2);
function axl_stack_foreach (stack:PaxlStack;
func:TaxlStackForeach2;
user_data:TaxlPointer;
user_data2:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_stack_foreach';
//axl_bool axl_stack_foreach3 (axlStack * stack,
// axlStackForeach3 func,
// axlPointer user_data,
// axlPointer user_data2,
// axlPointer user_data3);
function axl_stack_foreach3 (stack:PaxlStack;
func:TaxlStackForeach3;
user_data:TaxlPointer;
user_data2:TaxlPointer;
user_data3:TaxlPointer):Taxl_bool;
cdecl;external External_library name 'axl_stack_foreach3';
//int axl_stack_size (axlStack * stack);
function axl_stack_size (stack:PaxlStack):longint;
cdecl;external External_library name 'axl_stack_size';
//axl_bool axl_stack_is_empty (axlStack * stack);
function axl_stack_is_empty (stack:PaxlStack):Taxl_bool;
cdecl;external External_library name 'axl_stack_is_empty';
//void axl_stack_free (axlStack * stack);
procedure axl_stack_free (stack:PaxlStack);
cdecl;external External_library name 'axl_stack_free';
//axlBinaryStack * axl_binary_stack_new ();
function axl_binary_stack_new :PaxlBinaryStack;
cdecl;external External_library name 'axl_binary_stack_new';
//void axl_binary_stack_push (axlBinaryStack * bstack, axl_bool status);
procedure axl_binary_stack_push (bstack:PaxlBinaryStack; status:Taxl_bool);
cdecl;external External_library name 'axl_binary_stack_push';
//void axl_binary_stack_push_the_same (axlBinaryStack * bstack);
procedure axl_binary_stack_push_the_same (bstack:PaxlBinaryStack);
cdecl;external External_library name 'axl_binary_stack_push_the_same';
//axl_bool axl_binary_stack_pop (axlBinaryStack * bstack);
function axl_binary_stack_pop (bstack:PaxlBinaryStack):Taxl_bool;
cdecl;external External_library name 'axl_binary_stack_pop';
//axl_bool axl_binary_stack_peek (axlBinaryStack * bstack);
function axl_binary_stack_peek (bstack:PaxlBinaryStack):Taxl_bool;
cdecl;external External_library name 'axl_binary_stack_peek';
//axl_bool axl_binary_stack_is_empty (axlBinaryStack * bstack);
function axl_binary_stack_is_empty (bstack:PaxlBinaryStack):Taxl_bool;
cdecl;external External_library name 'axl_binary_stack_is_empty';
//int axl_binary_stack_size (axlBinaryStack * bstack);
function axl_binary_stack_size (bstack:PaxlBinaryStack):longint;
cdecl;external External_library name 'axl_binary_stack_size';
//void axl_binary_stack_free (axlBinaryStack * bstack);
procedure axl_binary_stack_free (bstack:PaxlBinaryStack);
cdecl;external External_library name 'axl_binary_stack_free';
(* @} *)

View File

@ -0,0 +1,544 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
(**
* \addtogroup axl_stream_module
* @{
*)
//axlStream * axl_stream_new (const char * stream_source,
// int stream_size,
// const char * file_path,
// int fd_handler,
// axlError ** error);
function axl_stream_new (const stream_source:Pchar;
stream_size: longint;
const file_path: Pchar;
fd_handler: longint;
error: PPaxlError):PaxlStream;
cdecl;external External_library name 'axl_stream_new';
//int axl_stream_inspect (axlStream * stream, const char * chunk, int inspected_size);
function axl_stream_inspect (stream:PaxlStream; const chunk:Pchar; inspected_size:longint):longint;
cdecl;external External_library name 'axl_stream_inspect';
//int axl_stream_inspect_code (axlStream * stream, char value, int index_desp);
function axl_stream_inspect_code (stream:PaxlStream; value:char; index_desp:longint):longint;
cdecl;external External_library name 'axl_stream_inspect_code';
//int axl_stream_peek (axlStream * stream, const char * chunk, int inspected_size);
function axl_stream_peek (stream:PaxlStream; const chunk:Pchar; inspected_size:longint):longint;
cdecl;external External_library name 'axl_stream_peek';
//int axl_stream_inspect_several (axlStream * stream, int chunk_num, ...);
function axl_stream_inspect_several (stream:PaxlStream; chunk_num:longint; args:array of const):longint;
cdecl;external External_library name 'axl_stream_inspect_several';
function axl_stream_inspect_several (stream:PaxlStream; chunk_num:longint):longint;
cdecl;external External_library name 'axl_stream_inspect_several';
//void axl_stream_accept (axlStream * stream);
procedure axl_stream_accept (stream:PaxlStream);
cdecl;external External_library name 'axl_stream_accept';
//void axl_stream_move (axlStream * stream, int index);
procedure axl_stream_move (stream:PaxlStream; index:longint);
cdecl;external External_library name 'axl_stream_move';
//void axl_stream_step (axlStream * stream, int bytes);
procedure axl_stream_step (stream:PaxlStream; bytes:longint);
cdecl;external External_library name 'axl_stream_step';
//void axl_stream_push (axlStream * stream, const char * content, int size);
procedure axl_stream_push (stream:PaxlStream; const content:Pchar; size:longint);
cdecl;external External_library name 'axl_stream_push';
//axl_bool axl_stream_fall_outside (axlStream * stream, int inspected_size);
function axl_stream_fall_outside (stream:PaxlStream; inspected_size:longint):Taxl_bool;
cdecl;external External_library name 'axl_stream_fall_outside';
//axl_bool axl_stream_check (axlStream * stream, char * chunk, int inspected_size);
function axl_stream_check (stream:PaxlStream; chunk:Pchar; inspected_size:longint):Taxl_bool;
cdecl;external External_library name 'axl_stream_check';
//char * axl_stream_get_until (axlStream * stream,
// char * valid_chars,
// int * chunk_matched,
// axl_bool accept_terminator,
// int chunk_num, ...);
function axl_stream_get_until (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
chunk_num:longint;
args:array of const):Pchar;
cdecl;external External_library name 'axl_stream_get_until';
function axl_stream_get_until (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
chunk_num:longint):Pchar;
cdecl;external External_library name 'axl_stream_get_until';
//char * axl_stream_get_until_ref (axlStream * stream,
// char * valid_chars,
// int * chunk_matched,
// axl_bool accept_terminator,
// int * result_size,
// int chunk_num, ...);
function axl_stream_get_until_ref (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
var result_size:longint;
chunk_num:longint;
args:array of const):Pchar;
cdecl;external External_library name 'axl_stream_get_until_ref';
function axl_stream_get_until_ref (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
var result_size:longint;
chunk_num:longint):Pchar;
cdecl;external External_library name 'axl_stream_get_until_ref';
//char * axl_stream_get_until_zero (axlStream * stream,
// char * valid_chars,
// int * chunk_matched,
// axl_bool accept_terminator,
// int chunk_num, ...);
function axl_stream_get_until_zero (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
chunk_num:longint;
args:array of const):Pchar;
cdecl;external External_library name 'axl_stream_get_until_zero';
function axl_stream_get_until_zero (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
chunk_num:longint):Pchar;
cdecl;external External_library name 'axl_stream_get_until_zero';
//char * axl_stream_get_until_ref_zero (axlStream * stream,
// char * valid_chars,
// int * chunk_matched,
// axl_bool accept_terminator,
// int * result_size,
// int chunk_num, ...);
function axl_stream_get_until_ref_zero (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
var result_size:longint;
chunk_num:longint;
args:array of const):Pchar;
cdecl;external External_library name 'axl_stream_get_until_ref_zero';
function axl_stream_get_until_ref_zero (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
var result_size:longint;
chunk_num:longint):Pchar;
cdecl;external External_library name 'axl_stream_get_until_ref_zero';
//void axl_stream_set_buffer_alloc (axlStream * stream,
// axlStreamAlloc handler,
// axlPointer data);
procedure axl_stream_set_buffer_alloc (stream:PaxlStream;
handler:TaxlStreamAlloc;
data:TaxlPointer);
cdecl;external External_library name 'axl_stream_set_buffer_alloc';
(**
* @brief Enum value that allows to configure which item to nullify
* inside the provided \ref axlStream reference.
*
*)
type TNullifyItem = (
(**
* @brief Nullify the last chunk returned due to call from \ref axl_stream_get_until.
*)
LAST_CHUNK,
(**
* @brief Nullify the last chunk returned by \ref axl_stream_get_near_to function.
*)
LAST_NEAR_TO,
(**
* @brief Nullify the last chunk returned by \ref axl_stream_get_following function.
*)
LAST_GET_FOLLOWING
);
//void axl_stream_nullify (axlStream * stream,
// NullifyItem item);
procedure axl_stream_nullify (stream:PaxlStream;
item:TNullifyItem);
cdecl;external External_library name 'axl_stream_nullify';
//char * axl_stream_get_untilv (axlStream * stream,
// char * valid_chars,
// int * chunk_matched,
// axl_bool accept_terminator,
// int * result_size,
// int chunk_num,
// va_list args);
function axl_stream_get_untilv (stream:PaxlStream;
valid_chars:Pchar;
var chunk_matched:longint;
accept_terminator:Taxl_bool;
var result_size:longint;
chunk_num:longint;
args:array of const):Pchar;
cdecl;external External_library name 'axl_stream_get_untilv';
//int axl_stream_get_index (axlStream * stream);
function axl_stream_get_index (stream:PaxlStream):longint;
cdecl;external External_library name 'axl_stream_get_index';
//int axl_stream_get_global_index (axlStream * stream);
function axl_stream_get_global_index (stream:PaxlStream):longint;
cdecl;external External_library name 'axl_stream_get_global_index';
//int axl_stream_get_size (axlStream * stream);
function axl_stream_get_size (stream:PaxlStream):longint;
cdecl;external External_library name 'axl_stream_get_size';
//const char * axl_stream_get_near_to (axlStream * stream, int count);
function axl_stream_get_near_to (stream:PaxlStream; count:longint):Pchar;
cdecl;external External_library name 'axl_stream_get_near_to';
//const char * axl_stream_get_following (axlStream * stream, int count);
function axl_stream_get_following (stream:PaxlStream; count:longint):Pchar;
cdecl;external External_library name 'axl_stream_get_following';
//void axl_stream_link (axlStream * stream,
// axlPointer element,
// axlDestroyFunc func);
procedure axl_stream_link (stream:PaxlStream;
element:TaxlPointer;
func:TaxlDestroyFunc);
cdecl;external External_library name 'axl_stream_link';
//void axl_stream_link_full (axlStream * stream,
// axlPointer element,
// axlDestroyFunc func,
// axl_bool free_on_finish);
procedure axl_stream_link_full (stream:PaxlStream;
element:TaxlPointer;
func:TaxlDestroyFunc;
free_on_finish:Taxl_bool);
cdecl;external External_library name 'axl_stream_link_full';
//void axl_stream_unlink (axlStream * stream);
procedure axl_stream_unlink (stream:PaxlStream);
cdecl;external External_library name 'axl_stream_unlink';
//void axl_stream_free (axlStream * stream);
procedure axl_stream_free (stream:PaxlStream);
cdecl;external External_library name 'axl_stream_free';
//axl_bool axl_stream_is_white_space (char * chunk);
function axl_stream_is_white_space (chunk:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_stream_is_white_space';
//void axl_stream_consume_white_spaces (axlStream * stream);
procedure axl_stream_consume_white_spaces (stream:PaxlStream);
cdecl;external External_library name 'axl_stream_consume_white_spaces';
//axl_bool axl_stream_remains (axlStream * stream);
function axl_stream_remains (stream:PaxlStream):Taxl_bool;
cdecl;external External_library name 'axl_stream_remains';
(* @} *)
(* string handling interface *)
//void axl_stream_trim (char * chunk);
procedure axl_stream_trim (chunk:Pchar);
cdecl;external External_library name 'axl_stream_trim';
//void axl_stream_trim_with_size (char * chunk, int * trimmed);
procedure axl_stream_trim_with_size (chunk:Pchar; var trimmed:longint);
cdecl;external External_library name 'axl_stream_trim_with_size';
//void axl_stream_remove (char * chunk, const char * value, axl_bool first);
procedure axl_stream_remove (chunk:Pchar; const value:Pchar; first:Taxl_bool);
cdecl;external External_library name 'axl_stream_remove';
//axl_bool axl_stream_cmp (const char * chunk1, const char * chunk2, int size);
function axl_stream_cmp (const chunk1:Pchar; const chunk2:Pchar; size:longint):Taxl_bool;
cdecl;external External_library name 'axl_stream_cmp';
//axl_bool axl_stream_casecmp (const char * chunk1, const char * chunk2, int size);
function axl_stream_casecmp (const chunk1:Pchar; const chunk2:Pchar; size:longint):Taxl_bool;
cdecl;external External_library name 'axl_stream_casecmp';
//char * axl_stream_strdup (const char * chunk);
function axl_stream_strdup (const chunk:Pchar):Pchar;
cdecl;external External_library name 'axl_stream_strdup';
//char * axl_stream_strdup_n (const char * chunk, int n);
function axl_stream_strdup_n (const chunk:Pchar; n:longint):Pchar;
cdecl;external External_library name 'axl_stream_strdup_n';
//int axl_stream_vprintf_len (const char * format,
// va_list args);
function axl_stream_vprintf_len (const format:Pchar;
args:array of const):longint;
cdecl;external External_library name 'axl_stream_vprintf_len';
//int axl_stream_printf_len (const char * format,
// ...);
function axl_stream_printf_len (const format:Pchar;
args:array of const):longint;
cdecl;external External_library name 'axl_stream_printf_len';
function axl_stream_printf_len (const format:Pchar):longint;
cdecl;external External_library name 'axl_stream_printf_len';
//char * axl_stream_strdup_printf (const char * chunk, ...);
function axl_stream_strdup_printf (chunk:Pchar; args:array of const):Pchar;
cdecl;external External_library name 'axl_stream_strdup_printf';
function axl_stream_strdup_printf (chunk:Pchar):Pchar;
cdecl;external External_library name 'axl_stream_strdup_printf';
//char * axl_stream_strdup_printfv (const char * chunk, va_list args);
function axl_stream_strdup_printfv (const chunk:Pchar; args:array of const):Pchar;
cdecl;external External_library name 'axl_stream_strdup_printfv';
//char * axl_stream_strdup_printf_len (const char * chunk,
// int * chunk_size, ...);
function axl_stream_strdup_printf_len (const chunk:Pchar;
var chunk_size:longint; args:array of const):Pchar;
cdecl;external External_library name 'axl_stream_strdup_printf_len';
function axl_stream_strdup_printf_len (const chunk:Pchar;
var chunk_size:longint):Pchar;
cdecl;external External_library name 'axl_stream_strdup_printf_len';
//int axl_stream_printf_buffer (char * buffer,
// int buffer_size,
// int * real_size,
// const char * format, ...);
function axl_stream_printf_buffer (buffer:Pchar;
buffer_size:longint;
var real_size:longint;
const format:Pchar; args:array of const):longint;
cdecl;external External_library name 'axl_stream_printf_buffer';
function axl_stream_printf_buffer (buffer:Pchar;
buffer_size:longint;
var real_size:longint;
format:Pchar):longint;
cdecl;external External_library name 'axl_stream_printf_buffer';
//char ** axl_stream_split (const char * chunk, int separator_num, ...);
function axl_stream_split (const chunk:Pchar; separator_num:longint; args:array of const):PPchar;
cdecl;external External_library name 'axl_stream_split';
function axl_stream_split (const chunk:Pchar; separator_num:longint):PPchar;
cdecl;external External_library name 'axl_stream_split';
//void axl_stream_clean_split (char ** split);
procedure axl_stream_clean_split (split:PPchar);
cdecl;external External_library name 'axl_stream_clean_split';
//char * axl_stream_join (char ** strings, const char * separator);
function axl_stream_join (strings:PPchar; const separator:Pchar):Pchar;
cdecl;external External_library name 'axl_stream_join';
//char * axl_stream_concat (const char * chunk1, const char * chunk2);
function axl_stream_concat (const chunk1:Pchar; const chunk2:Pchar):Pchar;
cdecl;external External_library name 'axl_stream_concat';
//int axl_stream_strv_num (char ** chunks);
function axl_stream_strv_num (chunks:PPchar):longint;
cdecl;external External_library name 'axl_stream_strv_num';
//void axl_stream_freev (char ** chunks);
procedure axl_stream_freev (chunks:PPchar);
cdecl;external External_library name 'axl_stream_freev';
//char * axl_stream_to_upper (char * chunk);
function axl_stream_to_upper (chunk:Pchar):Pchar;
cdecl;external External_library name 'axl_stream_to_upper';
//char * axl_stream_to_lower (char * chunk);
function axl_stream_to_lower (chunk:Pchar):Pchar;
cdecl;external External_library name 'axl_stream_to_lower';
//char * axl_stream_to_upper_copy (const char * chunk);
function axl_stream_to_upper_copy (const chunk:Pchar):Pchar;
cdecl;external External_library name 'axl_stream_to_upper_copy';
//char * axl_stream_to_lower_copy (const char * chunk);
function axl_stream_to_lower_copy (const chunk:Pchar):Pchar;
cdecl;external External_library name 'axl_stream_to_lower_copy';
//axl_bool axl_cmp (const char * string, const char * string2);
function axl_cmp (const string1:Pchar; const string2:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_cmp';
//axl_bool axl_casecmp (const char * string, const char * string2);
function axl_casecmp (const string1:Pchar; string2:Pchar):Taxl_bool;
cdecl;external External_library name 'axl_casecmp';
//axl_bool axl_memcmp (const char * string, const char * string2, int size);
function axl_memcmp (const string1:Pchar; string2:Pchar; size:longint):Taxl_bool;
cdecl;external External_library name 'axl_memcmp';
//char * axl_strdup (const char * string);
function axl_strdup (const string1:Pchar):Pchar;
cdecl;external External_library name 'axl_strdup';
//axl_bool axl_stream_setup_decode (axlStream * stream,
// const char * source_encoding,
// axlStreamDecode decode_f,
// axlPointer user_data,
// axlError ** error);
function axl_stream_setup_decode (stream:PaxlStream;
const source_encoding:Pchar;
decode_f:TaxlStreamDecode;
user_data:TaxlPointer;
error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_stream_setup_decode';
//axl_bool axl_stream_setup_check (axlStream * stream,
// const char * source_encoding,
// axlStreamContentCheck check,
// axlPointer user_data,
// axlError ** error);
function axl_stream_setup_check (stream:PaxlStream;
const source_encoding:Pchar;
check:TaxlStreamContentCheck;
user_data:TaxlPointer;
error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_stream_setup_check';
//axl_bool axl_stream_decode (axlStream * stream,
// char * output,
// int output_max_size,
// int * output_decoded,
// int * op_result,
// axlError ** error);
function axl_stream_decode (stream:PaxlStream;
output:Pchar;
output_max_size:longint;
var output_decoded:longint;
var op_result:longint;
error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_stream_decode';
//axl_bool axl_stream_content_check (axlStream * stream,
// const char * content,
// int content_length,
// axlError ** error);
function axl_stream_content_check (stream:PaxlStream;
const content:Pchar;
content_length:longint;
error:PPaxlError):Taxl_bool;
cdecl;external External_library name 'axl_stream_content_check';
(**
* \addtogroup axl_string_module
* @{
*)
{$if 0}
//*** Find efficient way to define aliases as in C
(**
* @brief Alias definition for \ref axl_stream_strdup_printf.
*
* See \ref axl_stream_strdup_printf information for more details.
*)
#define axl_strdup_printf axl_stream_strdup_printf
(**
* @brief Alias definition for \ref axl_stream_strdup_printfv.
*)
#define axl_strdup_printfv axl_stream_strdup_printfv
(**
* @brief Alias definition for the \ref axl_stream_concat.
*)
#define axl_concat axl_stream_concat
(**
* @brief Alias definition for the \ref axl_stream_join.
*)
#define axl_join axl_stream_join
(**
* @brief Alias definition for the \ref axl_stream_split.
*)
#define axl_split axl_stream_split
(**
* @brief Alias definition for the \ref axl_stream_freev.
*)
#define axl_freev axl_stream_freev
{$endif} //if 0
(**
* @brief Convenient interface to check if an string reference is NULL
* to return an static "undefined string". This is useful in the case
* string references are used on functions that can't handle NULL
* values.
*
* @param ref An string reference to check.
*)
//#define axl_check_undef(ref) (ref ? ref : "NULL")
function axl_check_undef(ref:Pchar):Pchar;
(* @} *)

View File

@ -0,0 +1,56 @@
(*
* LibAxl: C Header file to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibAxl: Another XML library
* Copyright (C) 2006 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to
* develop proprietary applications using this library without any
* royalty or fee but returning back any change, improvement or
* addition in the form of source code, project image, documentation
* patches, etc.
*
* For commercial support on build XML enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* Edificio Alius A, Oficina 102,
* C/ Antonio Suarez 10,
* Alcalá de Henares 28802 Madrid
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/xml
*)
{$inline on}
//#define axl_check_undef(ref) (ref ? ref : "NULL")
function axl_check_undef(ref:Pchar):Pchar; inline;
begin
if not (nil = ref) then
Result := ref
else
Result := 'NULL';
end;
{$inline off}

View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="3">
<Name Value="LibAxl"/>
<Author Value="Wimpie Nortje"/>
<CompilerOptions>
<Version Value="8"/>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/>
</SearchPaths>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Description Value="Pascal translation of LibAxl header files."/>
<License Value="LGPL"/>
<Version Minor="5" Release="7"/>
<Files Count="1">
<Item1>
<Filename Value="axl.pas"/>
<UnitName Value="axl"/>
</Item1>
</Files>
<RequiredPkgs Count="1">
<Item1>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item1>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -0,0 +1,14 @@
{ This file was automatically created by Lazarus. do not edit !
This source is only used to compile and install the package.
}
unit LibAxl;
interface
uses
axl;
implementation
end.

View File

@ -0,0 +1,51 @@
BEEP To do:
-----------
- commit
- update beepfp page
- update ccr page
- forum notice
- Find way to update GUI from events
- BEEP inline documentation
_listener_
- Add TLS
- Add SASL
- fix: client het 2 ch oop, dan stop, -> exception. Shutdown listener while busy closing channels
_client_
- Add TLS
- Add SASL
- file transfer --> vortex_channel_set_serialize
_Peer_
_ALL_
- Add debug logs to file
_BeepChannelPool_
- dropped connection must free channels
- remove channels from pool must free the TBeepChannels in list
_BeepChannel_
- Fut: Add 2nd layer profile functions
- Fut: Blocking mode channel creation
_BeepListener_
- Channel accepted event
_BeepProfile_
_Profilebase_
- transform into 2nd layer stuff
Design
- nog nie deel van struktuur: profilebase
Vrae:
- kan nie GUI update in beep events nie agv threading. Hoe doen dit?
Docs:
- wiki: Networking

View File

@ -0,0 +1,657 @@
(*******************************************************************************
* BeepChannel.pas: BEEP protocol channel
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepChannel implements the channel handling capabilities of the
* Vortex library
******************************************************************************)
unit BeepChannel;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
axl, Vortex, BeepUtils, BeepObject, BeepContext, BeepConnection;
type
{ Event types}
TBeepCloseChannelNotify = procedure(ChanNum: integer) of object;
TBeepChannelEvent = procedure(ChanNum: integer) of object;
TBeepDroppedChannelEvent = procedure(aBeepChannel: TObject) of object;
{ Enums }
TChannelStates = (csInvalid, csBusy, csOK);
{ TBeepChannel }
TBeepChannel = class(TBEEPObject)
private
FOnClosed: TBeepCloseChannelNotify;
FOnDropped: TBeepDroppedChannelEvent;
FState: TChannelStates; //Channel state
FTargetNumber: integer; //Target channel number
FConnection: TBeepConnection; //Connection in which to operate
FVortexChannel: PVortexChannel; //The vortex channel object
function GetContext: TBeepContext;
function GetNumber: integer;
function GetProfileName: string;
procedure SetChannelRef;
procedure SetClosedHandler;
//Event triggers
procedure DoCloseNotify(ChanNum: integer);
procedure DoDropped;
//Event handlers
procedure BeepChannelDropped(Channel:PVortexChannel);
public
//Events
property OnCloseNotify: TBeepCloseChannelNotify read FOnClosed write FOnClosed;
property OnDropped: TBeepDroppedChannelEvent read FOnDropped write FOnDropped;
//Propereties
property VortexChannel: PVortexChannel read FVortexChannel; //Vortex channel object
property Context: TBeepContext read GetContext; //Context in which channel exists
property Connection: TBeepConnection read FConnection; //Connection in which channel exists
property ProfileName: string read GetProfileName; //Profile for this channel
property Number: integer read GetNumber; //Channel number
property State: TChannelStates read FState; //Channel creation state
constructor Create(aConnection: TBeepConnection; ChanNum: longint);
destructor Destroy; override;
procedure CloseChannel;
function SendMSG(Msg: PByte; MsgLen: integer; var MsgID: longint): boolean;
function SendMSG(Msg: string; var MsgID: longint): boolean;
function SendRPY(Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
function SendRPY(Msg: string; MsgID: longint): boolean;
function SendANS(Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
function SendANS(Msg: string; MsgID: longint): boolean;
function SendANSFinal(MsgID: longint): boolean;
function SendERR(Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
function SendERR(Msg: string; MsgID: longint): boolean;
end;
{ TBeepChannelListener }
TBeepChannelListener = class(TBeepChannel)
private
public
constructor Create(aConnection: TBeepConnection; aVChannel: PVortexChannel); reintroduce;
destructor Destroy; override;
end;
{ TBeepChannelInitiator }
TBeepChannelInitiator = class(TBeepChannel)
private
FOnCreated: TBeepChannelEvent;
FOnFailed: TBeepChannelEvent;
FTargetProfile: string; //Associated profile
//Event triggers
procedure DoCreated(ChanNum: integer);
procedure DoFailed(ChanNum: integer);
//Event handlers
procedure BeepChannelCreated(ChannelNum:longint; Channel:PVortexChannel; Conn:PVortexConnection);
public
//Events
property OnCreated: TBeepChannelEvent read FOnCreated write FOnCreated;
property OnFailed: TBeepChannelEvent read FOnFailed write FOnFailed;
constructor Create(aConnection: TBeepConnection; aProfileName: string; ChanNum: longint); reintroduce;
destructor Destroy; override;
procedure OpenChannel;
end;
{ Vortex functions to implement
function vortex_channel_new_full
function vortex_channel_new_fullv
function vortex_channel_empty_new
procedure vortex_channel_set_close_handler
procedure vortex_channel_invoke_closed
procedure vortex_channel_set_close_notify_handler
procedure vortex_channel_set_received_handler
procedure vortex_channel_set_complete_flag
function vortex_channel_have_previous_frame
function vortex_channel_get_previous_frame
procedure vortex_channel_store_previous_frame
function vortex_channel_build_single_pending_frame
procedure vortex_channel_update_status
procedure vortex_channel_update_status_received
function vortex_channel_get_next_msg_no
procedure vortex_channel_set_next_seq_no
function vortex_channel_get_last_msg_no_received (channel : PVortexChannel):longint;
function vortex_channel_get_next_seq_no (channel : PVortexChannel):longword;
function vortex_channel_get_next_expected_seq_no (channel : PVortexChannel):longword;
function vortex_channel_get_next_ans_no (channel : PVortexChannel):longword;
function vortex_channel_get_next_expected_ans_no (channel:PVortexChannel):longword;
function vortex_channel_get_next_reply_no (channel:PVortexChannel):longint;
function vortex_channel_get_next_expected_reply_no (channel : PVortexChannel):longint;
function vortex_channel_get_window_size (channel : PVortexChannel):longint;
procedure vortex_channel_set_window_size
function vortex_channel_get_mime_type (channel : PVortexChannel):Pchar;
function vortex_channel_get_transfer_encoding (channel : PVortexChannel):Pchar;
procedure vortex_channel_set_automatic_mime
function vortex_channel_get_automatic_mime (channel : PVortexChannel):longint;
function vortex_channel_get_max_seq_no_remote_accepted (channel : PVortexChannel):longword;
function vortex_channel_get_next_frame_size
function vortex_channel_set_next_frame_size_handler
procedure vortex_channel_update_remote_incoming_buffer
function vortex_channel_seq_no_exceeded_after_update (channel : PVortexChannel):Taxl_bool;
function vortex_channel_get_max_seq_no_accepted (channel : PVortexChannel):longword;
procedure vortex_channel_set_max_seq_no_accepted
function vortex_channel_are_equal
function vortex_channel_update_incoming_buffer
procedure vortex_channel_queue_pending_message
function vortex_channel_is_empty_pending_message (channel : PVortexChannel):Taxl_bool;
function vortex_channel_next_pending_message (channel : PVortexChannel):TaxlPointer;
procedure vortex_channel_remove_pending_message (channel : PVortexChannel);
function vortex_channel_is_running_profile
function vortex_channel_queue_frame
function vortex_channel_queue_is_empty (channel : PVortexChannel):Taxl_bool;
function vortex_channel_queue_next_msg (channel : PVortexChannel):PVortexWriterData;
function vortex_channel_queue_length (channel : PVortexChannel):longint;
procedure vortex_channel_set_serialize
procedure vortex_channel_set_data
procedure vortex_channel_set_data_full
procedure vortex_channel_delete_data
function vortex_channel_get_data
function vortex_channel_ref (channel : PVortexChannel):Taxl_bool;
procedure vortex_channel_unref (channel : PVortexChannel);
function vortex_channel_ref_count (channel : PVortexChannel):longint;
function vortex_channel_send_msgv
function vortex_channel_send_msg_and_wait
function vortex_channel_send_msg_and_waitv
function vortex_channel_send_rpyv
function vortex_channel_send_ans_rpyv
function vortex_channel_send_errv
function vortex_channel_is_opened (channel : PVortexChannel):Taxl_bool;
function vortex_channel_is_being_closed (channel : PVortexChannel):Taxl_bool;
function vortex_channel_is_defined_received_handler (channel : PVortexChannel):Taxl_bool;
function vortex_channel_is_defined_close_handler (channel : PVortexChannel):Taxl_bool;
function vortex_channel_wait_reply
function vortex_channel_create_wait_reply :PWaitReplyData;
procedure vortex_channel_wait_reply_ref (wait_reply : PWaitReplyData);
procedure vortex_channel_free_wait_reply (wait_reply : PWaitReplyData);
function vortex_channel_is_ready (channel : PVortexChannel):Taxl_bool;
procedure vortex_channel_queue_reply
function vortex_channel_get_reply
function vortex_channel_get_piggyback (channel : PVortexChannel):PVortexFrame;
function vortex_channel_have_piggyback (channel : PVortexChannel):Taxl_bool;
procedure vortex_channel_set_piggyback (channel : PVortexChannel;
procedure vortex_channel_defer_start (channel : PVortexChannel);
function vortex_channel_validate_err
DONE:
function vortex_channel_new
function vortex_channel_get_number
function vortex_channel_close_full
function vortex_channel_close
function vortex_channel_get_ctx
function vortex_channel_get_connection
function vortex_channel_send_msg
function vortex_channel_send_rpy
function vortex_channel_send_ans_rpy
function vortex_channel_finalize_ans_rpy
function vortex_channel_send_err
function vortex_channel_get_profile
procedure vortex_channel_set_closed_handler
}
implementation
{ Vortex Callbacks }
//* Implementation note:
//* Vortex library can't accept methods as callback functions. To allow multiple
//* instantiations of the class, global functions are used as callbacks. The
//* object references are passed to the global functions to allow the correct
//* event handlers to be called.
//New channel completely created
//User_data points to channel's TBeepChannel object (ie owning channel)
procedure VortexChannelCreated(Channel_num:longint; Channel:PVortexChannel;
Conn:PVortexConnection; User_data:TaxlPointer);cdecl;
var
Owner: TBeepChannelInitiator;
begin
if assigned(User_data) then
begin
Owner := TBeepChannelInitiator(User_data);
Owner.AcquireLock;
try
Owner.BeepChannelCreated(Channel_num, Channel, Conn);
finally
Owner.ReleaseLock;
end;
end;
end;
//Channel improperly closed, ie connection dropped
//User_data points to channel's TBeepChannel object (ie owning channel)
procedure VortexChannelClosed(Channel:PVortexChannel; User_data:TaxlPointer);cdecl;
var
Owner: TBeepChannel;
begin
if assigned(User_data) then
begin
Owner := TBeepChannel(User_data);
Owner.AcquireLock;
try
Owner.BeepChannelDropped(Channel);
finally
Owner.ReleaseLock;
end;
end;
end;
{ TBeepChannel }
procedure TBeepChannel.BeepChannelDropped(Channel: PVortexChannel);
begin
//Set channel state
FState := csInvalid;
//Trigger event
DoDropped;
end;
procedure TBeepChannel.CloseChannel;
begin
if FState = csOK then
begin
//CloseChannel the channel
vortex_channel_close(FVortexChannel, nil);
{TODO: what to do when channel closing is denied?}
// see vortex_channel_is_being_closed.
//add enum value csClosing?
//Set state
FState := csInvalid;
//Trigger event
DoCloseNotify(FTargetNumber);
end;
end;
constructor TBeepChannel.Create(aConnection: TBeepConnection; ChanNum: longint);
begin
//Safety checks
if aConnection = nil then
raise EBeepInvalidConnection.Create('A valid BeepConnection must be supplied to create a channel.');
if ChanNum < 0 then
raise EBeepInvalidChannelNumber.Create('Channel number must be >= 0');
inherited Create;
//Init
FConnection := aConnection;
FTargetNumber := ChanNum;
FVortexChannel := nil;
FState := csInvalid;
end;
destructor TBeepChannel.Destroy;
begin
inherited Destroy;
end;
procedure TBeepChannel.DoCloseNotify(ChanNum: integer);
begin
if assigned(FOnClosed) then
FOnClosed(ChanNum);
end;
procedure TBeepChannel.DoDropped;
begin
if assigned(FOnDropped) then
FOnDropped(self);
end;
function TBeepChannel.GetContext: TBeepContext;
begin
Result := Connection.Context;
end;
function TBeepChannel.GetNumber: integer;
begin
Result := vortex_channel_get_number(FVortexChannel)
end;
function TBeepChannel.GetProfileName: string;
begin
if FState = csOK then
Result := string(vortex_channel_get_profile(FVortexChannel))
else
Result := '';
end;
function TBeepChannel.SendANS(Msg: PByte; MsgLen: integer;
MsgID: longint): boolean;
begin
if FState = csOK then
//Queue the message
Result := (axl_true = vortex_channel_send_ans_rpy(FVortexChannel, Msg, MsgLen, MsgID))
else
//Channel is not open
Result := false;
end;
function TBeepChannel.SendANS(Msg: string; MsgID: longint): boolean;
begin
Result := SendANS(PByte(PChar(Msg)), length(Msg), MsgID);
end;
function TBeepChannel.SendANSFinal(MsgID: longint): boolean;
begin
if FState = csOK then
//Queue the message
Result := (axl_true = vortex_channel_finalize_ans_rpy(FVortexChannel, MsgID))
else
//Channel is not open
Result := false; end;
function TBeepChannel.SendERR(Msg: PByte; MsgLen: integer;
MsgID: longint): boolean;
begin
if FState = csOK then
//Queue the message
Result := (axl_true = vortex_channel_send_err(FVortexChannel, Msg, MsgLen, MsgID))
else
//Channel is not open
Result := false;
end;
function TBeepChannel.SendERR(Msg: string; MsgID: longint): boolean;
begin
Result := SendERR(PByte(PChar(Msg)), length(Msg), MsgID);
end;
function TBeepChannel.SendMSG(Msg: PByte; MsgLen: integer;
var MsgID: longint): boolean;
begin
if FState = csOK then
//Queue the message
Result := (axl_true = vortex_channel_send_msg(FVortexChannel, Msg, MsgLen, MsgID))
else
//Channel is not open
Result := false;
end;
function TBeepChannel.SendMSG(Msg: string; var MsgID: longint): boolean;
begin
Result := SendMSG(PByte(PChar(Msg)), length(Msg), MsgID);
end;
function TBeepChannel.SendRPY(Msg: PByte; MsgLen: integer;
MsgID: longint): boolean;
begin
if FState = csOK then
//Queue the message
Result := (axl_true = vortex_channel_send_rpy(FVortexChannel, Msg, MsgLen, MsgID))
else
//Channel is not open
Result := false;
end;
function TBeepChannel.SendRPY(Msg: string; MsgID: longint): boolean;
begin
Result := SendRPY(PByte(PChar(Msg)), length(Msg), MsgID);
end;
procedure TBeepChannel.SetChannelRef;
begin
//Store object ref
vortex_channel_set_data(FVortexChannel, KEY_OWNER, self);
end;
procedure TBeepChannel.SetClosedHandler;
begin
//Store failed connection handler
vortex_channel_set_closed_handler(FVortexChannel, @VortexChannelClosed, self);
end;
{ TBeepChannelListener }
constructor TBeepChannelListener.Create(aConnection: TBeepConnection;
aVChannel: PVortexChannel);
var
ChanNum: longint;
begin
//Safety checks
if aVChannel = nil then
raise EBeepInvalidChannel.Create('A valid Vortex channel must be supplied to create a listener channel.');
//Get channel number
ChanNum := vortex_channel_get_number(aVChannel);
//Create base
inherited Create(aConnection, ChanNum);
//Init
FVortexChannel := aVChannel; //override default
FState := csOK; //override default
//Store object ref
SetChannelRef;
//Set closed handler
SetClosedHandler;
end;
destructor TBeepChannelListener.Destroy;
begin
if FState = csOK then
{close}; {TODO channel close}
//don't close for channel pool
inherited Destroy;
end;
{ TBeepChannelInitiator }
procedure TBeepChannelInitiator.BeepChannelCreated(ChannelNum: longint;
Channel: PVortexChannel; Conn: PVortexConnection);
begin
//Check for valid channel
if nil <> Channel then
begin
//Store new channel
FVortexChannel := Channel;
//Update local value in case target was channel 0 (auto select)
FTargetNumber := ChannelNum;
//Set channel state
FState := csOK;
//Store object ref
SetChannelRef;
//Set closed handler
SetClosedHandler;
//Trigger event
DoCreated(ChannelNum);
end
else
begin
//Set channel state
FState := csInvalid;
//Trigger event
DoFailed(ChannelNum);
end;
end;
constructor TBeepChannelInitiator.Create(aConnection: TBeepConnection;
aProfileName: string; ChanNum: longint);
begin
//Safety checks
if aProfileName = EmptyStr then
raise EBeepInvalidProfile.Create('A valid BeepProfile must be supplied to create a channel.');
//Create base
inherited Create(aConnection, ChanNum);
//Init
FTargetProfile := aProfileName;
end;
destructor TBeepChannelInitiator.Destroy;
begin
CloseChannel;
inherited Destroy;
end;
procedure TBeepChannelInitiator.DoCreated(ChanNum: integer);
begin
if assigned(FOnCreated) then
FOnCreated(ChanNum);
end;
procedure TBeepChannelInitiator.DoFailed(ChanNum: integer);
begin
if assigned(FOnFailed) then
FOnFailed(ChanNum);
end;
procedure TBeepChannelInitiator.OpenChannel;
begin
//Check if ProfileName is supported on this connection
if axl_false = vortex_connection_is_profile_supported(Connection.VortexConnection, PChar(FTargetProfile)) then
raise EProfileNotSupported.Create('Profile'+#13#10+FTargetProfile+#13#10+
' is not supported on the current connection');
//Only do this once
if FState = csInvalid then
begin
{TODO: add support for 2nd level ProfileName functions}
//ie if assigned(fonreceived)
{TODO: implement blocking mode channel creation}
vortex_channel_new(FConnection.VortexConnection, FTargetNumber, PChar(FTargetProfile),
nil,nil,nil,nil, //<---- 2nd level handlers
@VortexChannelCreated, self);
//Set state
FState := csBusy;
end;
end;
end.

View File

@ -0,0 +1,409 @@
(*******************************************************************************
* BeepChannelPool.pas: BEEP protocol channel pool
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepChannelPool implements the channel pool handling capabilities of the
* Vortex library
******************************************************************************)
unit BeepChannelPool;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, contnrs,
axl, Vortex, BeepUtils, BeepObject, BeepConnection, BeepChannel;
type
{ TBeepChannelPool }
TBeepChannelPool = class(TBeepObject)
private
FConnection: TBeepConnection; //Connection in which this pool exists
FTargetCount: integer; //Number of channels to create in pool
FTargetProfile: string; //Profile for all channels in pool
FVortexPool: PVortexChannelPool;//Vortex channel pool
FPool: TFPObjectList; //All channels in pool. Match 1:1 with vortex channels
FOnPoolCreated: TNotifyEvent;
function GetCount: integer;
function GetID: integer;
function FindBeepChannel(VChan: PVortexChannel):TBeepChannelListener;
procedure FreeBeepChannel(VChan: PVortexChannel);
//Event triggers
procedure DoPoolCreated;
//Event handlers
procedure BeepCloseChannel(aChanNum: integer; aConnection: PVortexConnection; var Accept: boolean);
procedure BeepChannelDropped(Channel:PVortexChannel);
function BeepChannelPoolCreate(aConnection:PVortexConnection;
channel_num: longint; profile: PChar; on_close: TVortexOnCloseChannel;
on_close_user_data: TaxlPointer; on_received: TVortexOnFrameReceived;
on_received_user_data:TaxlPointer): PVortexChannel;
procedure BeepChannelPoolCreated(aPool:PVortexChannelPool);
public
//Events
property OnPoolCreated: TNotifyEvent read FOnPoolCreated write FOnPoolCreated;
//Properties
property Connection: TBeepConnection read FConnection; //Connection in which pool exists
property VortexPool: PVortexChannelPool read FVortexPool;
property Profile: string read FTargetProfile; //Profile for all channels in pool
property Count: integer read GetCount; //Actual number of channels in pool
property ID: integer read GetID; //Pool's unique ID
constructor Create(aConnection: TBeepConnection; aProfileName: string; ChanCount: longint);
destructor Destroy; override;
procedure Initialise; //Start up the pool's channels
procedure AddChannels(aCount: integer); //Add more channels to the pool
procedure RemoveChannels(aCount: integer); //Close some of the pool's channels
function GetNextReady(AutoInc: boolean = true):TBeepChannel; //Get a channel to use
procedure ReleaseChannel(aChannel: TBeepChannel); //Return the channel back to the pool
//attach
//deattach
end;
{Vortex functions to implement
procedure vortex_channel_pool_attach
procedure vortex_channel_pool_deattach
DONE
function vortex_channel_pool_new
function vortex_channel_pool_new_full
function vortex_channel_pool_get_num
function vortex_channel_pool_get_id
function vortex_channel_pool_get_connection
procedure vortex_channel_pool_add
procedure vortex_channel_pool_add_full
procedure vortex_channel_pool_remove
function vortex_channel_pool_get_next_ready
function vortex_channel_pool_get_next_ready_full
procedure vortex_channel_pool_release_channel
}
implementation
{ Vortex Callbacks }
//* Implementation note:
//* Vortex library can't accept methods as callback functions. To allow multiple
//* instantiations of the class, global functions are used as callbacks. The
//* object references are passed to the global functions to allow the correct
//* event handlers to be called.
//Request to close channel.
//User_data points to channel pool's TBeepChannelPool object (ie owning pool)
function VortexCloseChannelRequest(Channel_num: longint; Connection: PVortexConnection;
User_data: TaxlPointer): longint; cdecl;
var
Pool: TBeepChannelPool;
Accept: boolean;
begin
//Default response.
Accept := true;
//Execute user assigned event handler
if assigned(User_data) then
begin
Pool := TBeepChannelPool(User_data);
Pool.AcquireLock;
try
Pool.BeepCloseChannel(Channel_num, Connection, Accept);
finally
Pool.ReleaseLock;
end;
end;
//Return axl_false to deny channel closure
//Return axl_true to allow new channel closure
Result := VortexBool(Accept);
end;
//Channel improperly closed, ie connection dropped
//User_data points to channel's TBeepChannelPool object (ie owning pool)
procedure VortexChannelClosed(Channel:PVortexChannel; User_data:TaxlPointer);cdecl;
var
Owner: TBeepChannelPool;
begin
if assigned(User_data) then
begin
Owner := TBeepChannelPool(User_data);
Owner.AcquireLock;
try
Owner.BeepChannelDropped(Channel);
finally
Owner.ReleaseLock;
end;
end;
end;
//Create a new channel for the channel pool
//User_data points to channel pool's TBeepChannelPool object (ie owning pool)
function VortexChannelPoolCreate(connection:PVortexConnection;
channel_num: longint; profile: PChar; on_close: TVortexOnCloseChannel;
on_close_user_data: TaxlPointer; on_received: TVortexOnFrameReceived;
on_received_user_data:TaxlPointer; User_data: TaxlPointer
): PVortexChannel;cdecl;
var
Pool: TBeepChannelPool;
begin
if assigned(User_data) then
begin
Pool := TBeepChannelPool(User_data);
Pool.AcquireLock;
try
try
Result := Pool.BeepChannelPoolCreate(connection, channel_num, profile,
on_close, on_close_user_data, on_received,
on_received_user_data);
except
Result := nil;
end;
finally
Pool.ReleaseLock;
end;
end;
end;
//Creation of channel pool is completed
//User_data points to channel pool's TBeepChannelPool object (ie owning pool)
procedure VortexChannelPoolCreated(aPool:PVortexChannelPool; User_data:TaxlPointer);cdecl;
var
Pool: TBeepChannelPool;
begin
if assigned(User_data) then
begin
Pool := TBeepChannelPool(User_data);
Pool.AcquireLock;
try
Pool.BeepChannelPoolCreated(aPool);
finally
Pool.ReleaseLock;
end;
end;
end;
{ TBeepChannelPool }
procedure TBeepChannelPool.AddChannels(aCount: integer);
begin
//Add more channels
if aCount > 0 then
vortex_channel_pool_add_full(FVortexPool, aCount, self);
end;
procedure TBeepChannelPool.BeepChannelDropped(Channel: PVortexChannel);
begin
//Remove the beep channel from the list
FreeBeepChannel(Channel);
end;
function TBeepChannelPool.BeepChannelPoolCreate(aConnection: PVortexConnection;
channel_num: longint; profile: PChar; on_close: TVortexOnCloseChannel;
on_close_user_data: TaxlPointer; on_received: TVortexOnFrameReceived;
on_received_user_data: TaxlPointer): PVortexChannel;
var
VChan: PVortexChannel;
BeepChan: TBeepChannelListener;
begin
//Create the new Vortex channel
VChan := vortex_channel_new(aConnection, channel_num, profile, on_close,
on_close_user_data, on_received, on_received_user_data, nil, nil);
//Create the Beep channel objects
BeepChan := TBeepChannelListener.Create(Connection, VChan);
//Set event handler.
//NOTE: this is a hack this class should not use the vortex_channel_xxxxx
//functions directly. The TBeepChannel class must provide this functionality
vortex_channel_set_closed_handler(VChan, @VortexChannelClosed, self);
//Add new object to channel list
FPool.Add(BeepChan);
//Return new channel
Result := VChan;
end;
procedure TBeepChannelPool.BeepChannelPoolCreated(aPool: PVortexChannelPool);
begin
//Store reference
FVortexPool := aPool;
//Trigger event
DoPoolCreated;
end;
procedure TBeepChannelPool.BeepCloseChannel(aChanNum: integer;
aConnection: PVortexConnection; var Accept: boolean);
var
VChan: PVortexChannel;
begin
//Fetch the vortex channel
VChan := vortex_connection_get_channel(aConnection, aChanNum);
//Remove the beep channel from the list
FreeBeepChannel(VChan);
end;
constructor TBeepChannelPool.Create(aConnection: TBeepConnection;
aProfileName: string; ChanCount: longint);
begin
//Safety checks
if aConnection = nil then
raise EBeepInvalidConnection.Create('A valid BeepConnection must be supplied to create a channel pool.');
if aProfileName = EmptyStr then
raise EBeepInvalidProfile.Create('A valid Profile name must be supplied to create a channel pool');
inherited Create;
//Init
FConnection := aConnection;
FTargetProfile := aProfileName;
FTargetCount := ChanCount;
//Create objects
FPool := TFPObjectList.Create(true);
end;
destructor TBeepChannelPool.Destroy;
begin
FPool.Free;
inherited Destroy;
end;
procedure TBeepChannelPool.DoPoolCreated;
begin
if assigned(FOnPoolCreated) then
FOnPoolCreated(self);
end;
function TBeepChannelPool.FindBeepChannel(
VChan: PVortexChannel): TBeepChannelListener;
var
k: integer = 0;
Found : boolean = false;
PoolChan: PVortexChannel;
begin
Result := nil;
while (k < FPool.Count) and (not Found) do
begin
//Get vortex channel from list
PoolChan := TBeepChannelListener(FPool.Items[k]).VortexChannel;
//Compare
if axl_true = vortex_channel_are_equal(VChan, PoolChan) then
begin
Found := true;
Result := TBeepChannelListener(FPool.Items[k]);
end;
//Inc
Inc(k);
end;
end;
procedure TBeepChannelPool.FreeBeepChannel(VChan: PVortexChannel);
var
BeepChan: TBeepChannel;
Index: integer;
begin
//Find matching channel in list
BeepChan := FindBeepChannel(VChan);
//Remove the channel from the list. Free it
Index := FPool.Remove(BeepChan);
writeln('Removed item '+inttostr(Index));
//////////////
end;
function TBeepChannelPool.GetCount: integer;
begin
Result := vortex_channel_pool_get_num(FVortexPool);
end;
function TBeepChannelPool.GetID: integer;
begin
Result := vortex_channel_pool_get_id(FVortexPool);
end;
function TBeepChannelPool.GetNextReady(AutoInc: boolean): TBeepChannel;
var
VChan: PVortexChannel;
begin
//Fetch the channel from the pool
VChan := vortex_channel_pool_get_next_ready_full(FVortexPool, VortexBool(AutoInc), self);
//Find matching channel in list
Result := FindBeepChannel(VChan);
end;
procedure TBeepChannelPool.Initialise;
var
HandleClose: TVortexOnCloseChannel = nil;
HandleCreated: TVortexOnChannelPoolCreated = nil;
begin
//Blocking mode?
if assigned(FOnPoolCreated) then
HandleCreated := @VortexChannelPoolCreated;
//Create the pool
vortex_channel_pool_new_full(Connection.VortexConnection,
PChar(FTargetProfile), FTargetCount,
@VortexChannelPoolCreate, self,
HandleClose , self,
nil , self, {<--- OnFrameRcd 2nd level callbakc}
HandleCreated , self);
end;
procedure TBeepChannelPool.ReleaseChannel(aChannel: TBeepChannel);
begin
//Some safety
if aChannel <> nil then
begin
//Release channel back to pool
vortex_channel_pool_release_channel(FVortexPool, aChannel.VortexChannel);
end;
end;
procedure TBeepChannelPool.RemoveChannels(aCount: integer);
begin
if aCount > 0 then
vortex_channel_pool_remove(FVortexPool, aCount);
end;
end.

View File

@ -0,0 +1,256 @@
(*******************************************************************************
* BeepClient.pas: BEEP protocol client
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepClient implements a BEEP protocol client using the TBeepXXXXX classes.
* The client can make only 1 connection but have multiple channels to the peer.
******************************************************************************)
unit BeepClient;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, types,
BeepUtils, BeepPeer, BeepConnection, BeepChannelPool;
type
{ TBeepClient }
TBeepClient = class(TBeepPeer)
private
//FConnected: TConnectStates;
FConnection: TBeepConnectionInitiator; //BEEP connection
FHost: string; //Host to connect to
FOnConnected: TConnectionEvent; //Connected to listener
FOnConnectionFailed: TConnectionErrorEvent; //Could not connect to listener
FOnDisconnected: TConnectionEvent; //Disconnected from listener
FPort: string; //Port to connect to
procedure SetPort(const AValue: string);
//Event triggers
procedure DoConnectionFailed(Sender: TBeepConnection; Reason: string);
procedure DoConnected(Sender: TBeepConnection);
procedure DoDisconnected(Sender: TBeepConnection);
//Event handlers
procedure ConnectionConnected(Sender: TObject);
procedure ConnectionConnectionFailed(Sender: TObject; Reason: string);
procedure ConnectionDisconnected(Sender: TObject);
public
//Events
property OnConnectionFailed: TConnectionErrorEvent read FOnConnectionFailed write FOnConnectionFailed;
property OnConnected: TConnectionEvent read FOnConnected write FOnConnected;
property OnDisconnected: TConnectionEvent read FOnDisconnected write FOnDisconnected;
//Properties
property Connection: TBeepConnectionInitiator read FConnection;
property Host: string read FHost write FHost;
property Port: string read FPort write SetPort;
constructor Create; override;
destructor Destroy; override;
//Connection
procedure Connect;
procedure Disconnect;
//Channels
procedure OpenChannel(ChanNum: longint); reintroduce;
procedure CloseChannel(ChanNum: longint); reintroduce;
//Channel pools
function AddChannelPool(aProfileName: string; aChannelCount: integer; var PoolIdx: integer): TBeepChannelPool; reintroduce;
//Messages
function SendMSG(aNumber: integer; Msg: PByte; MsgLen: integer; var MsgID: longint): boolean; reintroduce;
function SendRPY(aNumber: integer; Msg: PByte; MsgLen: integer; MsgID: integer):boolean; reintroduce;
function SendANS(aNumber: integer; Msg: PByte; MsgLen: integer; MsgID: integer):boolean; reintroduce;
function SendANSFinal(aNumber: integer; MsgID: longint):boolean; reintroduce;
function SendERR(aNumber: integer; Msg: PByte; MsgLen: integer; MsgID: integer):boolean; reintroduce;
end;
implementation
{ TBeepClient }
function TBeepClient.AddChannelPool(aProfileName: string;
aChannelCount: integer; var PoolIdx: integer): TBeepChannelPool;
begin
Result := inherited AddChannelPool(Connection, aProfileName, aChannelCount, PoolIdx);
end;
procedure TBeepClient.CloseChannel(ChanNum: longint);
begin
inherited CloseChannel(Connection, ChanNum);
end;
procedure TBeepClient.Connect;
begin
//Create connection object
if FConnection = nil then
begin
FConnection := TBeepConnectionInitiator.Create(Context, Host, Port);
FConnection.OnConnected := @ConnectionConnected;
FConnection.OnConnectionFailed := @ConnectionConnectionFailed;
FConnection.OnDisconnected := @ConnectionDisconnected;
end;
//DEBUG.remove this line******
writeln('state='+inttostr(ord(FConnection.Connected )));
//Connect
if FConnection.Connected = csDisconnected then
FConnection.Connect;
end;
procedure TBeepClient.ConnectionConnected(Sender: TObject);
begin
DoConnected(TBeepConnectionInitiator(Sender));
end;
procedure TBeepClient.ConnectionConnectionFailed(Sender: TObject;
Reason: string);
begin
DoConnectionFailed(TBeepConnection(Sender), Reason);
end;
procedure TBeepClient.ConnectionDisconnected(Sender: TObject);
begin
//Disconnect;
CloseAllChannels;
DoDisconnected(TBeepConnection(Sender));
end;
constructor TBeepClient.Create;
begin
inherited Create;
//Init
FConnection := nil;
FHost := 'localhost';
FPort := '3000';
//FConnected := csDisconnected;
end;
destructor TBeepClient.Destroy;
begin
//Gracefull disconnect, channel close
Disconnect;
//Free objects
if assigned(FConnection) then
FConnection.Free;
inherited Destroy;
end;
procedure TBeepClient.Disconnect;
begin
//Close channels
CloseAllChannels;
//Close connection
if assigned(FConnection) then
FConnection.Disconnect;
end;
procedure TBeepClient.DoConnected(Sender: TBeepConnection);
begin
if assigned(FOnConnected) then
FOnConnected(Sender);
end;
procedure TBeepClient.DoConnectionFailed(Sender: TBeepConnection;
Reason: string);
begin
if assigned(FOnConnectionFailed) then
FOnConnectionFailed(Sender, Reason);
end;
procedure TBeepClient.DoDisconnected(Sender: TBeepConnection);
begin
if assigned(FOnDisconnected) then
FOnDisconnected(Sender);
end;
procedure TBeepClient.OpenChannel(ChanNum: longint);
begin
inherited OpenChannel(Connection, ChanNum);
end;
function TBeepClient.SendANS(aNumber: integer; Msg: PByte; MsgLen: integer;
MsgID: integer): boolean;
begin
Result := inherited SendANS(Connection, aNumber, Msg, MsgLen, MsgID);
end;
function TBeepClient.SendANSFinal(aNumber: integer; MsgID: longint): boolean;
begin
Result := inherited SendANSFinal(Connection, aNumber, MsgID);
end;
function TBeepClient.SendERR(aNumber: integer; Msg: PByte; MsgLen: integer;
MsgID: integer): boolean;
begin
Result := inherited SendERR(Connection, aNumber, Msg, MsgLen, MsgID);
end;
function TBeepClient.SendMSG(aNumber: integer; Msg: PByte; MsgLen: integer;
var MsgID: longint): boolean;
begin
Result := inherited SendMSG(Connection, aNumber, Msg, MsgLen, MsgID);
end;
function TBeepClient.SendRPY(aNumber: integer; Msg: PByte; MsgLen: integer;
MsgID: integer): boolean;
begin
Result := inherited SendRPY(Connection, aNumber, Msg, MsgLen, MsgID);
end;
procedure TBeepClient.SetPort(const AValue: string);
var
Val: integer;
begin
if AValue <> FPort then
begin
//Check string value
Val := StrToInt(AValue);
if (Val < 0) or (MAX_PORT < Val) then
raise EBeepInvalidPort.Create(AValue + ' is an invalid port number. Valid range is from 0 to 65536.');
//Valid
FPort := AValue;
end;
end;
end.

View File

@ -0,0 +1,312 @@
(*
* BeepClient.pas: BEEP protocol client
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of LazBEEP.
*
* LazBEEP is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LazBEEP 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LazBEEP. If not, see <http://www.gnu.org/licenses/>.}
*)
unit BeepClient;
{TODO: add file desc header}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, types,
axl, Vortex, BeepPeer, BeepProfile;
type
{ Enums }
TConnectStates = (csDisconnected, csConnecting, csConnected);
{ TBeepClient }
TBeepClient = class(TBeepPeer)
private
FConnected: TConnectStates;
FHost: string;
FPort: string;
FOnConnected: TNotifyEvent;
FOnConnectionFailed: TNotifyEvent;
FOnDisconnected: TNotifyEvent;
Con : PVortexConnection; //BEEP connection
Channels: TStringList; //Open channels
procedure SetPort(const AValue: string);
//Event triggers
procedure DoConnectionFailed(Reason: string);
procedure DoConnected;
procedure DoDisconnected;
//Event handlers
procedure BeepConnectionNew(Connection:PVortexConnection);
protected
procedure BeepConnectionClose(Connection:PVortexConnection); override;
public
//Events
property OnConnectionFailed: TNotifyEvent read FOnConnectionFailed write FOnConnectionFailed;
property OnConnected: TNotifyEvent read FOnConnected write FOnConnected;
property OnDisconnected: TNotifyEvent read FOnDisconnected write FOnDisconnected;
//Properties
property Connected: TConnectStates read FConnected;
property Host: string read FHost write FHost;
property Port: string read FPort write SetPort;
constructor Create; override;
destructor Destroy; override;
procedure Connect;
procedure Disconnect;
function OpenChannel(ChanNum: longint; Profile: string):boolean;
procedure CloseChannel(ChanNum: longint);
function SendMSG(ChanNum: longint; Msg: PByte; MsgLen: integer; var MsgID: integer):boolean;
function SendRPY(ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: integer):boolean;
function SendANS(ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: integer):boolean;
function SendANSFinal(ChanNum: longint; MsgID: longint):boolean;
function SendERR(ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: integer):boolean;
function CreateChannelPool:boolean;
end;
{usage
- get remote profiles
- get local profiles
- create channel pool -> events
- send file -> events
- how to use documentation
}
{ Vortex functionality to implement:
- 1st level message frame handlers, ie Receive and close handlers passed to
OpenChannel
- OpenChannel -> OnCreated, OnFailed
- Channel -> OnClosed
- Example: Send file
- Example: Send/Receive
}
implementation
{ Vortex Callbacks }
//* Implementation note:
//* Vortex library can't accept methods as callback functions. To allow multiple
//* instantiations of the class, global functions are used as callbacks. The
//* object references are passed to the global functions to allow the correct
//* event handlers to be called.
//User_data points to connection's TBeepClient object (ie owning client)
procedure VortexConnectionNew(Connection:PVortexConnection; User_data:TaxlPointer);cdecl;
var
Owner: TBeepClient;
begin
//Execute user assigned event handler
if assigned(User_data) then
begin
Owner := TBeepClient(User_data);
Owner.BeepConnectionNew(Connection);
end;
end;
{ TBeepClient }
{
CODE to get remote profiles
for local use vortex_profile_get_ref
List: PAxlList;
k: Integer;
Profile: string;
//Check profiles
List := vortex_connection_get_remote_profiles(Connection);
k := 0;
while k < axl_list_length (list) do
begin
//Get next profile
Profile := PChar(axl_list_get_nth (list, k));
writeln(Profile);
//Inc
Inc(k);
end;
}
procedure TBeepClient.BeepConnectionClose(Connection: PVortexConnection);
begin
inherited BeepConnectionClose(Connection);
end;
procedure TBeepClient.BeepConnectionNew(Connection: PVortexConnection);
var
Error: string;
begin
//Store connection
Con := Connection;
//Check new connection
if (axl_false = vortex_connection_is_ok(Con, axl_false)) then
begin
//Get error message
Error := vortex_connection_get_message(Con);
//Set state
FConnected := csDisconnected;
//Trigger event
DoConnectionFailed(Error);
end
else
begin
//Set close handler
vortex_connection_set_on_close_full(Con, @VortexConnectionClose, self);
//Set state
FConnected := csConnected;
//Trigger event
DoConnected;
end;
end;
procedure TBeepClient.CloseChannel(ChanNum: longint);
begin
ClosePeerChannel(Con, ChanNum);
end;
constructor TBeepClient.Create;
begin
inherited Create;
//Init
FConnected := csDisconnected;
FHost := 'localhost';
FPort := '3000';
//Create objects
Channels := TStringList.Create;;
end;
destructor TBeepClient.Destroy;
begin
Disconnect;
Channels.Free;
inherited Destroy;
end;
procedure TBeepClient.DoConnected;
begin
if assigned(FOnConnected) then
FOnConnected(self);
end;
procedure TBeepClient.DoConnectionFailed(Reason: string);
begin
if assigned(FOnConnectionFailed) then
FOnConnectionFailed(self);
end;
procedure TBeepClient.DoDisconnected;
begin
if assigned(FOnDisconnected) then
FOnDisconnected(self);
end;
function TBeepClient.OpenChannel(ChanNum: longint; Profile: string):boolean;
begin
Result := OpenPeerChannel(Con, ChanNum, Profile);
end;
function TBeepClient.SendANS(ChanNum: longint; Msg: PByte; MsgLen: integer;
MsgID: integer):boolean;
begin
Result := SendPeerChannelANS(Con, ChanNum, Msg, MsgLen, MsgID);
end;
function TBeepClient.SendANSFinal(ChanNum: longint; MsgID: longint): boolean;
begin
Result := SendPeerChannelANSFinal(Con, ChanNum, MsgID);
end;
function TBeepClient.SendERR(ChanNum: longint; Msg: PByte; MsgLen: integer;
MsgID: integer):boolean;
begin
Result := SendPeerChannelERR(Con, ChanNum, Msg, MsgLen, MsgID);
end;
function TBeepClient.SendMSG(ChanNum: longint; Msg: PByte; MsgLen: integer;
var MsgID: integer):boolean;
begin
Result := SendPeerChannelMSG(Con, ChanNum, Msg, MsgLen, MsgID);
end;
function TBeepClient.SendRPY(ChanNum: longint; Msg: PByte; MsgLen: integer;
MsgID: integer):boolean;
begin
Result := SendPeerChannelRPY(Con, ChanNum, Msg, MsgLen, MsgID);
end;
procedure TBeepClient.SetPort(const AValue: string);
var
Val: integer;
begin
if AValue <> FPort then
begin
//Check string value
Val := StrToInt(AValue);
if (Val < 0) or (MAX_PORT < Val) then
raise EBeepInvalidPort.Create(AValue + ' is an invalid port number. Valid range is from 0 to 65536.');
//Valid
FPort := AValue;
end;
end;
procedure TBeepClient.Connect;
begin
if FConnected = csDisconnected then
begin
//Create connection
vortex_connection_new(Ctx, PChar(FHost), PChar(FPort), @VortexConnectionNew, self);
//Set state
FConnected := csConnecting;
end;
end;
procedure TBeepClient.Disconnect;
begin
if FConnected = csConnected then
begin
//Close connection
vortex_connection_close(Con);
//Set state
FConnected := csDisconnected;
//Trigger event
DoDisconnected;
end;
end;
end.

View File

@ -0,0 +1,622 @@
(*******************************************************************************
* BeepConnection.pas: BEEP protocol connection
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepConnection implements the connection handling capabilities of the
* Vortex library
******************************************************************************)
unit BeepConnection;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
axl, Vortex, BeepUtils, BeepObject, BeepContext;
type
{ Exceptions }
EBeepConnection = class(EBeepError);
{Event types }
TBeepConnectionErrorEvent = procedure (Sender: TObject; Reason: string) of object;
{ Enums }
TConnectionStates = (csDisconnected, csConnecting, csConnected);
{ TBeepConnection }
{ Class: TBeepConnection
Implements the Vortex Connection module
}
TBeepConnection = class(TBEEPObject)
private
FConnected: TConnectionStates; //Current connection state
FContext: TBeepContext; //Context in which to operate
FHost: string;
FID: integer;
FOnDisconnected: TNotifyEvent;
FPort: string;
FVortexConnection: PVortexConnection; //Vortex connection
function GetValid: boolean;
procedure SetCloseHandler;
procedure StoreObjectRef;
procedure UpdateConnectionData;
//Event triggers
procedure DoDisconnected;
//Event handlers
procedure BeepConnectionClose(aConnection:PVortexConnection);
public
//Events
property OnDisconnected: TNotifyEvent read FOnDisconnected write FOnDisconnected;
//Properties
property Context: TBeepContext read FContext;
property VortexConnection: PVortexConnection read FVortexConnection;
property Connected: TConnectionStates read FConnected;
property Host: string read FHost; //Return actual host (not target host)
property Port: string read FPort; //Return actual port (not target port)
property ID: integer read FID; //Vortex connection ID
property Valid: boolean read GetValid; //Is the connection OK?
constructor Create(aCtx: TBeepContext);
destructor Destroy; override;
procedure Disconnect;
end;
{ TBeepConnectionListener }
TBeepConnectionListener = class(TBeepConnection)
private
FAutoShutdown: boolean;
function GetVortexListener: PVortexConnection;
public
//Properties
property AutoShutdown: boolean read FAutoShutdown write FAutoShutdown; //Shutdown the Vortex connection on free'ing (for listener)
property VortexListener: PVortexConnection read GetVortexListener; //Listener under which connection was created
constructor Create(aCtx: TBeepContext; aVortexConnection: PVortexConnection; aAutoShutdown: boolean = false); reintroduce;
destructor Destroy; override;
procedure Shutdown;
end;
{ TBeepConnectionInitiator }
TBeepConnectionInitiator = class(TBeepConnection)
private
FOnConnected: TNotifyEvent;
FOnConnectionFailed: TBeepConnectionErrorEvent;
FTargetHost: string; //Host to connect to
FTargetPort: string; //Port to connect to
//Event triggers
procedure DoConnectionFailed(Reason: string);
procedure DoConnected;
//Event handlers
procedure BeepConnectionNew(aConnection:PVortexConnection);
public
//Events
property OnConnectionFailed: TBeepConnectionErrorEvent read FOnConnectionFailed write FOnConnectionFailed;
property OnConnected: TNotifyEvent read FOnConnected write FOnConnected;
constructor Create(aCtx: TBeepContext; aHost: string; aPort: string); reintroduce;
destructor Destroy; override;
procedure Connect;
end;
{ Vortex Connection API to implement:
function vortex_connection_reconnect
function vortex_connection_sock_connect
function vortex_connection_do_greetings_exchange
function vortex_connection_ref
function vortex_connection_uncheck_ref (connection : PVortexConnection):Taxl_bool;
procedure vortex_connection_unref
function vortex_connection_ref_count (connection : PVortexConnection):longint;
function vortex_connection_new_empty
function vortex_connection_new_empty_from_connection
function vortex_connection_set_socket
procedure vortex_connection_timeout
procedure vortex_connection_connect_timeout
function vortex_connection_get_timeout (ctx : PVortexCtx):int64;
function vortex_connection_get_connect_timeout (ctx : PVortexCtx):int64;
function vortex_connection_get_message (connection : PVortexConnection):Pchar;
function vortex_connection_get_status (connection : PVortexConnection):TVortexStatus;
function vortex_connection_pop_channel_error
procedure vortex_connection_push_channel_error
function vortex_connection_get_remote_profiles (connection : PVortexConnection):PaxlList;
function vortex_connection_set_profile_mask
function vortex_connection_is_profile_filtered
function vortex_connection_is_profile_supported (connection : PVortexConnection;
function vortex_connection_channel_exists (connection : PVortexConnection;
function vortex_connection_channels_count (connection : PVortexConnection):longint;
function vortex_connection_foreach_channel (connection : PVortexConnection;
function vortex_connection_get_next_channel (connection : PVortexConnection):longint;
function vortex_connection_get_channel (connection : PVortexConnection;
function vortex_connection_get_channel_by_uri (connection : PVortexConnection;
function vortex_connection_get_channel_by_func (connection : PVortexConnection;
function vortex_connection_get_channel_count (connection : PVortexConnection;
function vortex_connection_get_socket (connection:PVortexConnection):TVORTEX_SOCKET;
procedure vortex_connection_set_close_socket (connection : PVortexConnection;
procedure vortex_connection_add_channel (connection : PVortexConnection;
procedure vortex_connection_remove_channel (connection : PVortexConnection;
function vortex_connection_get_server_name (connection : PVortexConnection):Pchar;
procedure vortex_connection_set_server_name (connection : PVortexConnection;
function vortex_connection_set_blocking_socket (connection : PVortexConnection):Taxl_bool;
function vortex_connection_set_nonblocking_socket (connection : PVortexConnection):Taxl_bool;
function vortex_connection_set_sock_tcp_nodelay (socket : TVORTEX_SOCKET;
function vortex_connection_set_sock_block (socket : TVORTEX_SOCKET;
procedure vortex_connection_set_data (connection : PVortexConnection;
procedure vortex_connection_set_data_full (connection : PVortexConnection;
procedure vortex_connection_set_connection_actions (ctx : PVortexCtx;
\
function vortex_connection_actions_notify (caller_conn : PPVortexConnection;
function vortex_connection_get_data (connection : PVortexConnection;
function vortex_connection_get_channels_hash (connection : PVortexConnection):PVortexHash;
function vortex_connection_get_channel_pool (connection : PVortexConnection;
function vortex_connection_get_pending_msgs (connection : PVortexConnection):longint;
function vortex_connection_get_role (connection : PVortexConnection):TVortexPeerRole;
function vortex_connection_get_features (connection : PVortexConnection):Pchar;
function vortex_connection_get_localize (connection : PVortexConnection):Pchar;
function vortex_connection_get_opened_channels (connection : PVortexConnection):longint;
function vortex_connection_set_send_handler (connection : PVortexConnection;
function vortex_connection_set_receive_handler (connection : PVortexConnection;
procedure vortex_connection_set_default_io_handler (connection : PVortexConnection);
procedure vortex_connection_sanity_socket_check (ctx : PVortexCtx;
function vortex_connection_parse_greetings_and_enable (connection : PVortexConnection;
procedure vortex_connection_set_preread_handler (connection : PVortexConnection;
function vortex_connection_is_defined_preread_handler (connection : PVortexConnection):Taxl_bool;
procedure vortex_connection_set_tlsfication_status (connection : PVortexConnection;
function vortex_connection_is_tlsficated (connection : PVortexConnection):Taxl_bool;
procedure vortex_connection_set_channel_added_handler (connection : PVortexConnection;
procedure vortex_connection_set_channel_removed_handler (connection : PVortexConnection;
procedure vortex_connection_block (conn : PVortexConnection;
function vortex_connection_is_blocked (conn : PVortexConnection):Taxl_bool;
function vortex_connection_get_next_frame_size (connection : PVortexConnection;
procedure vortex_connection_seq_frame_updates (connection : PVortexConnection;
function vortex_connection_seq_frame_updates_status (connection : PVortexConnection):Taxl_bool;
function vortex_connection_set_next_frame_size_handler (connection : PVortexConnection;
function vortex_connection_set_default_next_frame_size_handler (ctx : PVortexCtx;
DONE:
function vortex_connection_new
function vortex_connection_close
procedure vortex_connection_free
function vortex_connection_get_ctx
function vortex_connection_get_host
function vortex_connection_get_port
procedure vortex_connection_set_on_close
procedure vortex_connection_set_on_close_full
function vortex_connection_is_ok
function vortex_connection_get_id
function vortex_connection_get_listener
procedure vortex_connection_shutdown
}
{
CODE to get remote profiles
for local use vortex_profile_get_ref
List: PAxlList;
k: Integer;
Profile: string;
//Check profiles
List := vortex_connection_get_remote_profiles(Connection);
k := 0;
while k < axl_list_length (list) do
begin
//Get next profile
Profile := PChar(axl_list_get_nth (list, k));
writeln(Profile);
//Inc
Inc(k);
end;
}
implementation
{ Vortex Callbacks }
//* Implementation note:
//* Vortex library can't accept methods as callback functions. To allow multiple
//* instantiations of the class, global functions are used as callbacks. The
//* object references are passed to the global functions to allow the correct
//* event handlers to be called.
//User_data points to connection's TBeepConnection object (ie owning connection)
procedure VortexConnectionNew(aConnection:PVortexConnection; User_data:TaxlPointer);cdecl;
var
Owner: TBeepConnectionInitiator;
begin
//Execute user assigned event handler
if assigned(User_data) then
begin
Owner := TBeepConnectionInitiator(User_data);
Owner.AcquireLock;
try
Owner.BeepConnectionNew(aConnection);
finally
Owner.ReleaseLock;
end;
end;
end;
//User_data points to connection's TBeepConnection object (ie owning connection)
procedure VortexConnectionClose(Connection:PVortexConnection; Data:TaxlPointer);cdecl;
var
Owner: TBeepConnection;
begin
if assigned(Data) then
begin
Owner := TBeepConnection(Data);
Owner.AcquireLock;
try
Owner.BeepConnectionClose(Connection);
finally
Owner.ReleaseLock;
end;
end;
end;
{ TBeepConnection }
procedure TBeepConnection.BeepConnectionClose(aConnection: PVortexConnection);
begin
//Future note: This test is probably not necessary, or maybe another test
//is necessary. There is something I don't understand yet but it seems that
//all listeners and/or all connections in a context gets notified about all
//(or some?) events. In any case, LazBEEP was designed to allow multiple
//listeners in the same context but this must be reviewed. For now only a
//single listener will be allowed in a context.
if FConnected <> csDisconnected then
begin
//writeln('Beep Connection(%d): BeepConnectionClose');
//Set state
FConnected := csDisconnected;
//Trigger event
DoDisconnected;
end;
end;
constructor TBeepConnection.Create(aCtx: TBeepContext);
begin
//Safety checks
if aCtx = nil then
raise EBeepInvalidContext.Create('TBeepConnection requires a valid context.');
inherited Create;
FContext := aCtx;
FVortexConnection := nil;
FConnected := csDisconnected;
end;
destructor TBeepConnection.Destroy;
begin
inherited Destroy;
end;
procedure TBeepConnection.Disconnect;
begin
if FConnected = csConnected then
begin
//Close connection
vortex_connection_close(FVortexConnection);
//Set state
FConnected := csDisconnected;
//*********^^ as disconnect refuse, is hierdie nie so nie.
//*????stel in die handler? Hoe destroy mens dan?
end;
end;
procedure TBeepConnection.DoDisconnected;
begin
if assigned(FOnDisconnected) then
FOnDisconnected(self);
end;
function TBeepConnection.GetValid: boolean;
begin
Result := (axl_true = vortex_connection_is_ok(FVortexConnection, axl_false));
end;
procedure TBeepConnection.SetCloseHandler;
begin
//Set the handler for connection OnClose events
vortex_connection_set_on_close_full(FVortexConnection, @VortexConnectionClose, self);
end;
procedure TBeepConnection.StoreObjectRef;
begin
//Store the object's referece in the Vortex object
vortex_connection_set_data(FVortexConnection, KEY_OWNER, self);
end;
procedure TBeepConnection.UpdateConnectionData;
begin
//Only try when connection is alive
if Valid then
begin
FID := vortex_connection_get_id(FVortexConnection);
FHost := vortex_connection_get_host(FVortexConnection);
FPort := vortex_connection_get_port(FVortexConnection)
end;
end;
{ TBeepConnectionListener }
constructor TBeepConnectionListener.Create(aCtx: TBeepContext;
aVortexConnection: PVortexConnection; aAutoShutdown: boolean);
begin
//Safety checks
if aVortexConnection = nil then
raise EBeepInvalidConnection.Create('TBeepConnection requires a valid Vortex connection.');
inherited Create(aCtx);
//Vortex connection is already open
FVortexConnection := aVortexConnection;
//Assign event handler
SetCloseHandler;
//Store object ref
StoreObjectRef;
//Update all connection specific info
UpdateConnectionData;
//Set state
FConnected := csConnected;
//Init
FAutoShutdown := aAutoShutdown; //Should Destroy shutdown the vortex connection?
end;
destructor TBeepConnectionListener.Destroy;
begin
//Listener
begin
if FAutoShutdown and Valid then
Shutdown;
end;
inherited Destroy;
end;
function TBeepConnectionListener.GetVortexListener: PVortexConnection;
begin
Result := vortex_connection_get_listener(FVortexConnection);
end;
procedure TBeepConnectionListener.Shutdown;
begin
vortex_connection_shutdown(FVortexConnection);
end;
{ TBeepConnectionInitiator }
procedure TBeepConnectionInitiator.BeepConnectionNew(
aConnection: PVortexConnection);
var
Error: string;
begin
//Store connection
FVortexConnection := aConnection;
//Check new connection
if not Valid then
begin
//Get error message
Error := vortex_connection_get_message(FVortexConnection);
//Set state
FConnected := csDisconnected;
//Trigger event
DoConnectionFailed(Error);
end
else
begin
//Set close handler
if assigned(FOnDisconnected) or assigned(FOnConnectionFailed) then
SetCloseHandler;
//Store object ref
StoreObjectRef;
//Update all connection specific info
UpdateConnectionData;
//Set state
FConnected := csConnected;
//Trigger event
DoConnected;
end;
end;
procedure TBeepConnectionInitiator.Connect;
begin
//check for previous connection
if FConnected = csDisconnected then
begin
//No event handler, blocking mode
if FOnConnected = nil then
begin
//Create new connection
FVortexConnection := vortex_connection_new(FContext.VortexCtx, PChar(FTargetHost), PChar(FTargetPort), nil, nil);
//Check error
if not Valid then
begin
raise EBeepConnection.Create('Can''t create BEEP connection. Vortex error is:'+#13#10+
vortex_connection_get_message(FVortexConnection));
end;
//Set close handler
if assigned(FOnDisconnected) or assigned(FOnConnectionFailed) then
SetCloseHandler;
//Store object ref
StoreObjectRef;
//Set state
FConnected := csConnected;
//Trigger event
DoConnected;
end
//Event handler specified, non-blocking mode
else
begin
//Create connection
vortex_connection_new(FContext.VortexCtx, PChar(FTargetHost), PChar(FTargetPort), @VortexConnectionNew, self);
//Set state
FConnected := csConnecting; //set in handler
end;
end;
end;
constructor TBeepConnectionInitiator.Create(aCtx: TBeepContext; aHost: string;
aPort: string);
var
Val: integer;
begin
//Safety checks
Val := StrToInt(aPort);
if (Val < 0) or (MAX_PORT < Val) then
raise EBeepInvalidPort.Create(aPort + ' is an invalid port number. Valid range is from 0 to 65536.');
inherited Create(aCtx);
FTargetHost := aHost;
FTargetPort := aPort;
end;
destructor TBeepConnectionInitiator.Destroy;
begin
//Close connection
Disconnect;
inherited Destroy;
end;
procedure TBeepConnectionInitiator.DoConnected;
begin
if assigned(FOnConnected) then
FOnConnected(self);
end;
procedure TBeepConnectionInitiator.DoConnectionFailed(Reason: string);
begin
if assigned(FOnConnectionFailed) then
FOnConnectionFailed(self, Reason);
end;
end.

View File

@ -0,0 +1,109 @@
(*******************************************************************************
* BeepContext.pas: Vortex BEEP context
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepContext implements the context handling capabilities of the Vortex
* library
******************************************************************************)
unit BeepContext;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
axl, Vortex, BeepUtils, BeepObject;
type
{ Exceptions }
EBeepContext = class(EBeepError);
{ TBeepContext }
TBeepContext = class(TBEEPObject)
private
FCtx : PVortexCtx; //Vortex context
public
property VortexCtx: PVortexCtx read FCtx;
constructor Create;
destructor Destroy; override;
end;
{ Vortex Context functions not implemented:
procedure vortex_ctx_set_data
procedure vortex_ctx_set_data_full
function vortex_ctx_get_data
procedure vortex_ctx_set_frame_received
procedure vortex_ctx_set_close_notify_handler
procedure vortex_ctx_set_channel_added_handler
procedure vortex_ctx_set_channel_removed_handler
procedure vortex_ctx_set_channel_start_handler
procedure vortex_ctx_install_cleanup
DONE
function vortex_ctx_new:PVortexCtx;
procedure vortex_ctx_free (ctx : PVortexCtx);
}
implementation
{ TBeepContext }
constructor TBeepContext.Create;
var
VResult : Taxl_bool;
begin
//Create the context
FCtx := vortex_ctx_new ();
//Init vortex library
VResult := vortex_init_ctx (FCtx);
//Init error
if axl_false = VResult then
raise EBeepContext.Create('Could not initialise BEEP context. Network communication is not functional');
end;
destructor TBeepContext.Destroy;
begin
if assigned(FCtx) then
vortex_exit_ctx(FCtx, axl_true);
inherited Destroy;
end;
end.

View File

@ -0,0 +1,83 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="3">
<Name Value="beepfp"/>
<CompilerOptions>
<Version Value="8"/>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/>
</SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Files Count="12">
<Item1>
<Filename Value="beeppeer.pas"/>
<UnitName Value="BeepPeer"/>
</Item1>
<Item2>
<Filename Value="beepchannel.pas"/>
<UnitName Value="BeepChannel"/>
</Item2>
<Item3>
<Filename Value="beepchannelpool.pas"/>
<UnitName Value="BeepChannelPool"/>
</Item3>
<Item4>
<Filename Value="beepclient.pas"/>
<UnitName Value="BeepClient"/>
</Item4>
<Item5>
<Filename Value="beepconnection.pas"/>
<UnitName Value="BeepConnection"/>
</Item5>
<Item6>
<Filename Value="beepcontext.pas"/>
<UnitName Value="BeepContext"/>
</Item6>
<Item7>
<Filename Value="beepframe.pas"/>
<UnitName Value="BeepFrame"/>
</Item7>
<Item8>
<Filename Value="beeplistener.pas"/>
<UnitName Value="BeepListener"/>
</Item8>
<Item9>
<Filename Value="beepobject.pas"/>
<UnitName Value="BeepObject"/>
</Item9>
<Item10>
<Filename Value="beepprofile.pas"/>
<UnitName Value="BeepProfile"/>
</Item10>
<Item11>
<Filename Value="beepserver.pas"/>
<UnitName Value="BeepServer"/>
</Item11>
<Item12>
<Filename Value="beeputils.pas"/>
<UnitName Value="BeepUtils"/>
</Item12>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2">
<Item1>
<PackageName Value="libvortex"/>
<MinVersion Major="1" Minor="1" Release="2" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -0,0 +1,22 @@
{ This file was automatically created by Lazarus. do not edit !
This source is only used to compile and install the package.
}
unit beepfp;
interface
uses
BeepPeer, BeepChannel, BeepChannelPool, BeepClient, BeepConnection,
BeepContext, BeepFrame, BeepListener, BeepObject, BeepProfile, BeepServer,
BeepUtils, LazarusPackageIntf;
implementation
procedure Register;
begin
end;
initialization
RegisterPackage('beepfp', @Register);
end.

View File

@ -0,0 +1,250 @@
(*******************************************************************************
* BeepFrame.pas: Beep frames
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepFrame implements all the frame handling capabilities of the Vortex
* library
******************************************************************************)
unit BeepFrame;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, types,
Vortex, BeepUtils, BeepObject;
type
{ TBeepFrame }
TBeepFrame = class(TBEEPObject)
private
FVortexFrame: PVortexFrame;
function GetMsgNum: integer;
function GetPayload: PByte;
function GetPayloadAsByteArray: TByteDynArray;
function GetPayloadAsString: string;
function GetPayloadSize: integer;
public
//Properties
property VortexFrame: PVortexFrame read FVortexFrame;
property Payload: PByte read GetPayload;
property PayloadSize: integer read GetPayloadSize;
property PayloadAsByteArray: TByteDynArray read GetPayloadAsByteArray;
property PayloadAsString: string read GetPayloadAsString;
property MsgNum: integer read GetMsgNum;
//Overload create to create a frame from other initial conditions
constructor Create(aFrame: PVortexFrame);
destructor Destroy; override;
end;
{ Vortex functions to implement
function vortex_frame_build_up_from_params
function vortex_frame_build_up_from_params_s
function vortex_frame_build_up_from_params_s_buffer
function vortex_frame_seq_build_up_from_params
function vortex_frame_seq_build_up_from_params_buffer
function vortex_frame_create
function vortex_frame_create_full
function vortex_frame_create_full_ref
function vortex_frame_copy (frame : PVortexFrame):PVortexFrame;
function vortex_frame_get_raw_frame (frame : PVortexFrame):Pchar;
function vortex_frame_get_next (connection : PVortexConnection):PVortexFrame;
function vortex_frame_send_raw (connection :PVortexConnection;
function vortex_frame_receive_raw (connection : PVortexConnection;
function vortex_frame_readline (connection : PVortexConnection;
function vortex_frame_ref (frame : PVortexFrame):Taxl_bool;
procedure vortex_frame_unref (frame : PVortexFrame);
function vortex_frame_ref_count (frame : PVortexFrame):longint;
procedure vortex_frame_free (frame : PVortexFrame);
function vortex_frame_join (a : PVortexFrame;
function vortex_frame_join_extending (a : PVortexFrame;
function vortex_frame_are_joinable (a : PVortexFrame;
function vortex_frame_are_equal (a : PVortexFrame;
function vortex_frame_get_id (frame : PVortexFrame):longint;
function vortex_frame_get_type (frame:PVortexFrame):TVortexFrameType;
function vortex_frame_get_content_type (frame : PVortexFrame):Pchar;
function vortex_frame_get_transfer_encoding (frame : PVortexFrame):Pchar;
function vortex_frame_get_mime_header_size (frame : PVortexFrame):longint;
function vortex_frame_get_channel (frame : PVortexFrame):longint;
function vortex_frame_get_channel_ref (frame : PVortexFrame):PVortexChannel;
procedure vortex_frame_set_channel_ref (frame : PVortexFrame;
function vortex_frame_get_msgno (frame : PVortexFrame):longint;
function vortex_frame_get_more_flag (frame : PVortexFrame):Taxl_bool;
function vortex_frame_get_seqno (frame:PVortexFrame):longword;
function vortex_frame_get_ansno (frame:PVortexFrame):longint;
function vortex_frame_get_ok_message :Pchar;
function vortex_frame_get_ctx (frame : PVortexFrame):PVortexCtx;
function vortex_frame_get_content_size (frame : PVortexFrame):longint;
function vortex_frame_get_content (frame:PVortexFrame):Pchar;
function vortex_frame_get_error_message (code : Pchar;
function vortex_frame_is_error_message (frame : PVortexFrame;
function vortex_frame_get_start_message (channel_num : longint;
function vortex_frame_get_start_rpy_message (profile : Pchar;
function vortex_frame_get_close_message (number : longint;
function vortex_frame_is_mime_message (frame : PVortexFrame):Taxl_bool;
function vortex_frame_mime_process (frame : PVortexFrame):Taxl_bool;
procedure vortex_frame_set_mime_header (frame : PVortexFrame;
function vortex_frame_get_mime_header (frame : PVortexFrame;
function vortex_frame_mime_header_name (header : PVortexMimeHeader):Pchar;
function vortex_frame_mime_header_content (header : PVortexMimeHeader):Pchar;
function vortex_frame_mime_header_next (header : PVortexMimeHeader):PVortexMimeHeader;
function vortex_frame_mime_header_count (header : PVortexMimeHeader):longint;
function vortex_frame_mime_status_is_available (frame : PVortexFrame):Taxl_bool;
DONE
function vortex_frame_get_payload_size
function vortex_frame_get_payload
}
implementation
{ TBeepFrame }
constructor TBeepFrame.Create(aFrame: PVortexFrame);
begin
FVortexFrame := aFrame;
end;
destructor TBeepFrame.Destroy;
begin
inherited Destroy;
end;
function TBeepFrame.GetMsgNum: integer;
begin
Result := vortex_frame_get_msgno(FVortexFrame);
end;
function TBeepFrame.GetPayload: PByte;
begin
Result := PByte(vortex_frame_get_payload(FVortexFrame));
end;
function TBeepFrame.GetPayloadAsByteArray: TByteDynArray;
var
FramePayloadSize: integer;
FramePayload: PByte;
Data: TByteDynArray;
k: Integer;
begin
//Read info from frame
FramePayloadSize := PayloadSize;
FramePayload := Payload;
//Allocate memory
Setlength(Data, FramePayloadSize);
//Copy the data into the array
for k := 0 to FramePayloadSize-1 do
Data[k] := FramePayload[k];
Result := Data;
end;
function TBeepFrame.GetPayloadAsString: string;
var
FramePayloadSize: integer;
FramePayload: PByte;
Data: string;
k: Integer;
begin
//Read info from frame
FramePayloadSize := PayloadSize;
FramePayload := Payload;
//Allocate memory
Setlength(Data, FramePayloadSize);
//Copy the data into the array
for k := 0 to FramePayloadSize-1 do
Data[k+1] := Char(FramePayload[k]);
Result := Data;
end;
function TBeepFrame.GetPayloadSize: integer;
begin
Result := vortex_frame_get_payload_size(FVortexFrame);
end;
end.

View File

@ -0,0 +1,507 @@
(*******************************************************************************
* BeepListener.pas: Vortex BEEP listener class
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepListener implements the listener handling capabilities of the Vortex
* library
******************************************************************************)
unit BeepListener;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, contnrs,
axl, Vortex, BeepUtils, BeepObject, BeepContext, BeepConnection;
type
{ Event types }
TBeepListenerReady = procedure (aListener: TObject) of object;
TBeepListenerFailed = procedure (aListener: TObject; const ErrMsg: string) of object;
TBeepListenerStop = procedure (aListener: TObject) of object;
TBeepAcceptConnection = procedure (aConnection: TBeepConnectionListener; var Accept: boolean) of object;
TBeepCloseConnection = procedure (aConnection: TBeepConnection) of object;
{ Enums }
TListenStates = (lsStopped, lsStarting, lsActive);
{ TBeepListener }
TBeepListener = class(TBEEPObject)
private
FConnections: TFPObjectList;//All the accepted connections
FContext: TBeepContext; //Operating context
FHost: string; //Host at which to listen. 0.0.0.0 = everywhere
FOnConnectionAccept: TBeepAcceptConnection;
FOnConnectionClose: TBeepCloseConnection;
FOnFailed: TBeepListenerFailed;
FOnReady: TBeepListenerReady;
FOnStop: TBeepListenerStop;
FPort: string; //Port at which to lister. 0 = all ports
FState: TListenStates; //State of the listener
FVortexListener: PVortexConnection; //The connection listening on
FZombies: TFPObjectList; //List of dropped connections that need to be destroyed ASAP
procedure SetHost(const AValue: string);
procedure SetPort(const AValue: string);
procedure KillZombies;
procedure MakeZombie(aZombie: TObject);
//Event triggers
procedure DoConnectionAccept(aConnection: TBeepConnectionListener; var Accept: boolean);
procedure DoConnectionClose(aConnection: TBeepConnection);
procedure DoReady;
procedure DoFailed(const ErrorMsg: string);
procedure DoStop;
//Event handlers
procedure BeepAcceptConnection(aConnection: PVortexConnection;
var Accept: boolean);
procedure BeepListenerReady(aHost:Pchar; aPort:longint; aStatus:TVortexStatus;
aMessage:Pchar; aConnection:PVortexConnection);
procedure ConnectionClose(Sender: TObject);
public
//Events
property OnConnectionAccept: TBeepAcceptConnection read FOnConnectionAccept write FOnConnectionAccept; //Beep received a connection request. Return true to accept, false to reject See VortexOnAcceptedConnection()
property OnConnectionClose: TBeepCloseConnection read FOnConnectionClose write FOnConnectionClose; //Connection was closed/broken
property OnReady: TBeepListenerReady read FOnReady write FOnReady; //Listener created and ready
property OnFailed: TBeepListenerFailed read FOnFailed write FOnFailed;//Listener creation failed
property OnStop: TBeepListenerStop read FOnStop write FOnStop; //Listener stopped
//Properties
property Context: TBeepContext read FContext;
property State: TListenStates read FState;
property Host: string read FHost write SetHost;
property Port: string read FPort write SetPort;
constructor Create(aCtx: TBeepContext);
destructor Destroy; override;
procedure Start;
procedure Stop;
//future: Stop specified connection using (Host, Port)
procedure Wait;
procedure Unblock;
end;
{ Vortex Context functions not implemented:
function vortex_listener_sock_listen (ctx : PVortexCtx;
procedure vortex_listener_accept_connection (connection : PVortexConnection;
function vortex_listener_parse_conf_and_start (ctx : PVortexCtx):Taxl_bool;
procedure vortex_listener_set_default_realm (ctx : PVortexCtx;
function vortex_listener_get_default_realm (ctx : PVortexCtx):Pchar;
DONE:
function vortex_listener_new
function vortex_listener_new2
function vortex_listener_new_full
procedure vortex_listener_shutdown
procedure vortex_listener_set_on_connection_accepted
procedure vortex_listener_wait
procedure vortex_listener_unlock
}
implementation
{ Vortex Callbacks }
//* Implementation note:
//* Vortex library can't accept methods as callback functions. To allow multiple
//* instantiations of the class, global functions are used as callbacks. The
//* object references are passed to the global functions to allow the correct
//* event handlers to be called.
//Data points to connection's TBeepListener object (ie owning listener)
function VortexAcceptedConnection(Connection:PVortexConnection; Data:TaxlPointer):Taxl_bool;cdecl;
var
Owner: TBeepListener;
Accept: boolean;
begin
//Default response.
Accept := true;
//Execute user assigned event handler
if assigned(Data) then
begin
Owner := TBeepListener(Data);
Owner.AcquireLock;
try
Owner.BeepAcceptConnection(Connection, Accept);
finally
Owner.ReleaseLock;
end;
end;
//Return axl_true to accept the connection to be created
Result := VortexBool(Accept);
end;
//User_data points to listener's TBeepListener object (ie owning listener)
procedure VortexListenerReady(Host:Pchar; Port:longint; Status:TVortexStatus;
aMessage:Pchar; Connection:PVortexConnection; User_data:TaxlPointer);cdecl;
var
Owner: TBeepListener;
begin
//Execute user assigned event handler
if assigned(User_data) then
begin
Owner := TBeepListener(User_data);
Owner.BeepListenerReady(Host, Port, Status, aMessage, Connection);
end;
end;
{ TBeepListener }
procedure TBeepListener.BeepAcceptConnection(aConnection: PVortexConnection;
var Accept: boolean);
var
NewConn: TBeepConnectionListener;
VListen: PVortexConnection;
LHost: string;
LPort: string;
KeepObject: boolean = false;
begin
//Create the new connection
NewConn := TBeepConnectionListener.Create(Context, aConnection);
{$IFDEF DBG_LISTEN}
writeln(Format('Beep Listener(%s:%s) AcceptConnection(%s)', [Host, Port, IntToStr(ptrint(NewConn))]));
{$ENDIF}
//Get the originating listener
VListen := NewConn.VortexListener;
//Get listener host:port
LHost := vortex_connection_get_host(VListen);
LPort := vortex_connection_get_port(VListen);
//Request is on my port
if (FHost = LHost) and (FPort = LPort) then
begin
//Execute user handler
DoConnectionAccept(NewConn, Accept);
//Local copy of Accept because Accept may not be manipulated here
KeepObject := Accept;
end;
//Store connection information
if KeepObject then
begin
//Assign event handler
NewConn.OnDisconnected := @ConnectionClose;
//Automatically shutdown the vortex connection
NewConn.AutoShutdown := true;
//Add to list of active connections
FConnections.Add(NewConn);
end
else
begin
//The connection is not needed
NewConn.Free;
end;
//Free some resources
KillZombies;
end;
procedure TBeepListener.BeepListenerReady(aHost: Pchar; aPort: longint;
aStatus: TVortexStatus; aMessage: Pchar; aConnection: PVortexConnection);
begin
//Check error
if axl_true = vortex_connection_is_ok (aConnection, axl_false) then
begin
//Store reference
FVortexListener := aConnection;
//Set socket values
FHost := vortex_connection_get_host(FVortexListener);
FPort := vortex_connection_get_port(FVortexListener);
//Set state
FState := lsActive;
//Trigger event
DoReady;
end
else
begin
//Set state
FState := lsStopped;
//Trigger event
DoFailed(string(aMessage));
end;
end;
procedure TBeepListener.ConnectionClose(Sender: TObject);
begin
{$IFDEF DBG_LISTEN}
writeln(Format('Beep Listener(%s:%s) ConnectionClose', [Host, Port]));
{$ENDIF}
//Connection is already closed. Don't try it again
TBeepConnectionListener(Sender).AutoShutdown := false;
//Schedule connection for free'ing
MakeZombie(Sender);
//Trigger event
DoConnectionClose(TBeepConnection(Sender));
end;
constructor TBeepListener.Create(aCtx: TBeepContext);
begin
//Safety checks
if aCtx = nil then
raise EBeepInvalidConnection.Create('TBeepListener requires a valid context.');
inherited Create;
//Init
FContext := aCtx;
FVortexListener := nil;
FState := lsStopped;
FPort := '3000';
FHost := 'localhost';
//Create objects
FZombies := TFPObjectList.Create(true); //Free objects when deleted.
FConnections := TFPObjectList.Create(false); //Don't free objects when deleted.
//Configure connection notification
vortex_listener_set_on_connection_accepted(FContext.VortexCtx, @VortexAcceptedConnection, self);
end;
destructor TBeepListener.Destroy;
begin
//Stop listener, close connections
Stop;
//Free lists
FConnections.Free;
FZombies.Free;
inherited Destroy;
end;
procedure TBeepListener.DoConnectionAccept(
aConnection: TBeepConnectionListener; var Accept: boolean);
begin
if assigned(FOnConnectionAccept) then
FOnConnectionAccept(aConnection, Accept);
{$IFDEF DBG_LISTEN}
write(Format('Beep Listener(%s:%s) accept connection from %s:%s', [Host, Port, aConnection.Host, aConnection.Port]));
if Accept then
writeln(' (Accepted)')
else
writeln(' (Denied)');
{$ENDIF}
end;
procedure TBeepListener.DoConnectionClose(aConnection: TBeepConnection);
begin
{$IFDEF DBG_LISTEN}
writeln(Format('Beep Listener(%s:%s) closed connection from %s:%s', [Host, Port, aConnection.Host, aConnection.Port]));
{$ENDIF}
if assigned(FOnConnectionClose) then
FOnConnectionClose(aConnection);
end;
procedure TBeepListener.DoFailed(const ErrorMsg: string);
begin
{$IFDEF DBG_LISTEN}
writeln(Format('Beep Listener(%s:%s) connection failed', [Host, Port]));
{$ENDIF}
if assigned(FOnFailed) then
FOnFailed(self, ErrorMsg);
end;
procedure TBeepListener.DoReady;
begin
{$IFDEF DBG_LISTEN}
writeln(Format('Beep Listener(%s:%s) (self=%s) ready', [Host, Port, IntToStr(ptrint(self))]));
{$ENDIF}
if assigned(FOnReady) then
FOnReady(self);
end;
procedure TBeepListener.DoStop;
begin
{$IFDEF DBG_LISTEN}
writeln(Format('Beep Listener(%s:%s) stopping', [Host, Port]));
{$ENDIF}
if assigned(FOnStop) then
FOnStop(self);
end;
procedure TBeepListener.KillZombies;
begin
{$IFDEF DBG_LISTEN}
writeln(Format('Beep Listener(%s:%s) Kill Zombies', [Host, Port]));
writeln(Format('Beep Listener(%s:%s) Connections=%s Zombies=%s', [Host, Port, IntToStr(FConnections.Count), IntToStr(FZombies.Count)]));
if FConnections.Count > 0 then
writeln(Format('Beep Listener(%s:%s) Connection[0]=%s', [Host, Port, IntToStr(ptrint(TBeepConnection(FConnections.Items[0]).VortexConnection))]));
if FZombies.Count > 0 then
writeln(Format('Beep Listener(%s:%s) Zombie [0]=%s', [Host, Port, IntToStr(ptrint(TBeepConnection(FZombies.Items[0]).VortexConnection))]));
{$ENDIF}
//Free current zombies
FZombies.Clear;
end;
procedure TBeepListener.MakeZombie(aZombie: TObject);
var
Item: TObject;
begin
{$IFDEF DBG_LISTEN}
writeln(Format('Beep Listener(%s:%s) MakeZombie', [Host, Port]));
{$ENDIF}
//Remove connection from list without freeing
Item := FConnections.Extract(aZombie);
//BIIIIG problem
if Item = nil then
raise EBeepListener.Create('TBeepListener: The dropped connection was not in the list of active connections. Please investigate.'+#13#10
+TBeepConnection(aZombie).Port);
//Move connection to zombie list. Can't free it now because it is the caller.
FZombies.Add(aZombie);
end;
procedure TBeepListener.SetHost(const AValue: string);
begin
if FState = lsStopped then
FHost := AValue;
end;
procedure TBeepListener.SetPort(const AValue: string);
begin
if FState = lsStopped then
begin
//Check validity
if not VortexPortOK(AValue) then
raise EBeepInvalidPort.Create(AValue + ' is an invalid port number. Valid range is from 0 to 65536.');
//OK
FPort := AValue;
end;
end;
procedure TBeepListener.Start;
begin
//Not listening already
if FState = lsStopped then
begin
//Blocking mode
if FOnReady = nil then
begin
//Create the listener
FVortexListener := vortex_listener_new(FContext.VortexCtx, PChar(FHost), PChar(FPort), nil, nil);
//Check error
if (axl_false = vortex_connection_is_ok (FVortexListener, axl_false)) then
begin
raise EBeepListener.Create('Can''t create BEEP listener. Vortex error is:'+#13#10+
vortex_connection_get_message(FVortexListener));
end;
//Set state
FState := lsActive;
end
//Non-blocking mode
else
begin
//Start creating a listener
vortex_listener_new_full(FContext.VortexCtx, PChar(FHost), PChar(FPort), @VortexListenerReady, self);
//Set state
FState := lsStarting;
end;
end;
end;
procedure TBeepListener.Stop;
var
k: Integer;
begin
{$IFDEF DBG_LISTEN}
writeln(Format('Listener(%s:%s): Connection objects: %s',[Host, Port, IntToStr(FConnections.Count)]));
writeln(Format('Listener(%s:%s): Zombie objects : %s',[Host, Port, IntToStr(FZombies.Count)]));
{$ENDIF}
if FState = lsActive then
begin
//Close all open connections. This moves them to Zombies list
for k := 0 to FConnections.Count-1 do
begin
TBeepConnectionListener(FConnections.Items[k]).Shutdown;
end;
//Clear the list
FConnections.Clear;
//Remove all zombies
FZombies.Clear;
//Trigger event
DoStop;
//Stop listening. Stop all active connections
vortex_listener_shutdown(FVortexListener, axl_true);
//Set state
FState := lsStopped;
end;
end;
procedure TBeepListener.Unblock;
begin
vortex_listener_unlock(FContext.VortexCtx);
end;
procedure TBeepListener.Wait;
begin
vortex_listener_wait(FContext.VortexCtx);
end;
end.

View File

@ -0,0 +1,76 @@
(*******************************************************************************
* BeepObject.pas: Utilities for BEEP classes
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepObject implements the base class for all LazBEEP classes.
******************************************************************************)
unit BeepObject;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, syncobjs;
type
{ TBEEPOBject }
TBEEPObject = class(TObject)
private
Semaphore: TCriticalSection;
public
constructor Create;
destructor Destroy; override;
procedure AcquireLock;
procedure ReleaseLock;
end;
implementation
{ TBEEPObject }
procedure TBEEPObject.AcquireLock;
begin
Semaphore.Acquire;
end;
constructor TBEEPObject.Create;
begin
Semaphore := TCriticalSection.Create;
end;
destructor TBEEPObject.Destroy;
begin
Semaphore.Free;
inherited Destroy;
end;
procedure TBEEPObject.ReleaseLock;
begin
Semaphore.Release;
end;
end.

View File

@ -0,0 +1,560 @@
(*******************************************************************************
* BeepPeer.pas: BEEP protocol peer base class
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepPeer implements the common features found in a BEEP client and a BEEP
* listener using the TBeepXXXXX classes.
* TBeepPeer does not have any connections and thus cannot function without a
* higher level class.
******************************************************************************)
unit BeepPeer;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, contnrs,
BeepUtils, BeepObject, BeepContext, BeepConnection, BeepProfile, BeepChannel,
BeepChannelPool;
type
{ Exceptions }
EDuplicateChannel = class(EBeepError);
{ Event types}
TConnectionEvent = procedure (Sender: TBeepConnection) of object;
TConnectionErrorEvent = procedure (Sender: TBeepConnection; Reason: string) of object;
{ TBeepPeer }
TBeepPeer = class(TBEEPObject)
private //Managed
FChannelsInitiator: TStringList; //Open channels initiated
FChannelsListener: TStringList; //Open channels accepted
FChannelZombies: TFPObjectList; //Closed channel objects that must be destroyed
FChannelPool: TFPObjectList; //Channel pools
FContext: TBeepContext; //Operating context
FProfiles: TStringList; //Active profiles
function CalcChannelID(aConnection: TBeepConnection; aNumber: integer): string;
function FetchChannel(aConnection: TBeepConnection; aNumber: integer): TBeepChannelInitiator;
//Event triggers
//Event handlers
procedure ChannelDropped(aBeepChannel: TObject);
procedure ProfileCreatedChannel(aChannel: TBeepChannelListener);
procedure ProfileClosingChannel(aChannel: TBeepChannel);
public
//Events
//Properties
property Context: TBeepContext read FContext; //Operating context
constructor Create; virtual;
destructor Destroy; override;
//Profiles
function AddProfile(aName: string): TBeepProfile;
procedure DeleteProfile(aName: string);
//Channels
function AddChannel(aConnection: TBeepConnection; aProfileName: string; aNumber: integer): TBeepChannelInitiator;
//DeleteChannel
procedure OpenChannel(aConnection: TBeepConnection; aNumber: integer);
procedure CloseChannel(aConnection: TBeepConnection; aNumber: integer);
procedure CloseAllChannels;
//Channel pools
function AddChannelPool(aConnection: TBeepConnection; aProfileName: string; aChannelCount: integer; var PoolIdx: integer): TBeepChannelPool;
procedure InitialisePool(PoolIdx: integer);
procedure AddPoolChannels(PoolIdx: integer; aCount: integer);
procedure RemovePoolChannels(PoolIdx: integer; aCount: integer);
function GetPoolChannel(PoolIdx: integer; AutoInc: boolean = true):TBeepChannel;
procedure ReleasePoolChannel(PoolIdx: integer; aChannel: TBeepChannel);
//Messages
function SendMSG(aConnection: TBeepConnection; aNumber: integer; Msg: PByte; MsgLen: integer; var MsgID: longint): boolean;
function SendRPY(aConnection: TBeepConnection; aNumber: integer; Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
function SendANS(aConnection: TBeepConnection; aNumber: integer; Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
function SendANSFinal(aConnection: TBeepConnection; aNumber: integer; MsgID: longint): boolean;
function SendERR(aConnection: TBeepConnection; aNumber: integer; Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
end;
implementation
{ TBeepPeer }
function TBeepPeer.AddChannel(aConnection: TBeepConnection;
aProfileName: string; aNumber: integer): TBeepChannelInitiator;
var
Chan: TBeepChannelInitiator;
Index: integer;
ID: string;
begin
//Channel must be open
if aConnection = nil then
raise EBeepInvalidConnection.Create('Connection must be established before adding channels.');
if aConnection.Connected <> csConnected then
raise EBeepInvalidConnection.Create('Connection must be established before adding channels.');
//Don't allow auto channel number selection
if aNumber < 1 then
raise EBeepInvalidChannelNumber.Create('Channel number must be > 0.');
//Convert
ID := CalcChannelID(aConnection, aNumber);
//Check for duplicates
Index := FChannelsInitiator.IndexOf(ID);
//If not exist
if Index = -1 then
begin
//Create a new channel
Chan := TBeepChannelInitiator.Create(aConnection, aProfileName, aNumber);
//Keep track of all channels
FChannelsInitiator.AddObject(ID, Chan);
//Return a reference
Result := Chan;
end
else //Exists
begin
//Return existing profile
Result := TBeepChannelInitiator(FChannelsInitiator.Objects[Index]);
end;
end;
function TBeepPeer.AddChannelPool(aConnection: TBeepConnection;
aProfileName: string; aChannelCount: integer;
var PoolIdx: integer): TBeepChannelPool;
var
Pool: TBeepChannelPool;
begin
//Create a pool
Pool := TBeepChannelPool.Create(aConnection, aProfileName, aChannelCount);
//Put pool in list
PoolIdx := FChannelPool.Add(Pool);
//Return object
Result := Pool;
end;
procedure TBeepPeer.AddPoolChannels(PoolIdx: integer; aCount: integer);
var
Pool: TBeepChannelPool;
begin
//Fetch the pool
Pool := TBeepChannelPool(FChannelPool.Items[PoolIdx]);
//Safety
if Pool <> nil then
Pool.AddChannels(aCount);
end;
function TBeepPeer.AddProfile(aName: string): TBeepProfile;
var
Prof: TBeepProfile;
Index: integer;
begin
//Check for duplicates
Index := FProfiles.IndexOfName(aName);
//If not exist
if Index = -1 then
begin
//Create a new profile
Prof := TBeepProfile.Create(Context, aName, @ProfileCreatedChannel, @ProfileClosingChannel);
Prof.RegisterProfile;
//Keep track of all profiles
FProfiles.AddObject(aName, Prof);
//Return a reference
Result := Prof;
end
else //Exists
begin
//Return existing profile
Result := TBeepProfile(FProfiles.Objects[Index]);
end;
end;
function TBeepPeer.CalcChannelID(aConnection: TBeepConnection;
aNumber: integer): string;
begin
Result := IntToStr(aConnection.ID)+':'+IntToStr(aNumber);
end;
procedure TBeepPeer.ChannelDropped(aBeepChannel: TObject);
var
aChannel: TBeepChannel;
ChannelList: TStringList;
Index: integer;
ID: string;
begin
//Cast object
aChannel := TBeepChannel(aBeepChannel);
////////*****
writeln('Peer dropped channel '+inttostr(aChannel.Number));
//Convert
ID := CalcChannelID(aChannel.Connection, aChannel.Number);
//Find index
ChannelList := FChannelsInitiator;
Index := FChannelsInitiator.IndexOf(ID);
if Index = -1 then
begin
ChannelList := FChannelsListener;
Index := FChannelsListener.IndexOf(ID);
end;
//Delete item from list.
ChannelList.Delete(Index);
//Add to zombies
FChannelZombies.Add(aBeepChannel);
end;
procedure TBeepPeer.CloseAllChannels;
var
Chan: TBeepChannel;
k: Integer;
begin
if assigned(FChannelsInitiator) then
for k := 0 to FChannelsInitiator.Count-1 do
begin
Chan := TBeepChannel(FChannelsInitiator.Objects[k]);
Chan.CloseChannel;
//writeln('Closing ch '+FChannelsInitiator.Strings[k]);
end;
end;
procedure TBeepPeer.CloseChannel(aConnection: TBeepConnection;
aNumber: integer);
var
Chan: TBeepChannel;
begin
writeln('Peer closed channel '+inttostr(aNumber));
//Fetch the channel object
Chan := FetchChannel(aConnection, aNumber);
//Open the connection
if Chan <> nil then
Chan.CloseChannel;
end;
constructor TBeepPeer.Create;
begin
inherited Create;
//Create objects
FContext := TBeepContext.Create;
FProfiles := TStringList.Create;
FChannelsInitiator := TStringList.Create;
FChannelsListener := TStringList.Create;
FChannelZombies := TFPObjectList.Create(true);
FChannelPool := TFPObjectList.Create(true);
end;
procedure TBeepPeer.DeleteProfile(aName: string);
var
Prof: TBeepProfile;
Index: integer;
begin
//Get index
Index := FProfiles.IndexOfName(aName);
//Get profile
Prof := TBeepProfile(FProfiles.Objects[Index]);
//Unregister
Prof.UnRegisterProfile;
//Delete from local list
FProfiles.Delete(Index);
//Free
Prof.Free;
end;
destructor TBeepPeer.Destroy;
var
k: Integer;
begin
//Free objects
FChannelPool.Free;
FChannelZombies.Free;
//Received channels
if assigned(FChannelsListener) then
for k := 0 to FChannelsListener.Count-1 do
FChannelsListener.Objects[k].Free;
FChannelsListener.Free;
//Initiated channels
if assigned(FChannelsInitiator) then
for k := 0 to FChannelsInitiator.Count-1 do
FChannelsInitiator.Objects[k].Free;
FChannelsInitiator.Free;
//Profiles
if assigned(FProfiles) then
for k := 0 to FProfiles.Count-1 do
FProfiles.Objects[k].Free;
FProfiles.Free;
FContext.Free;
inherited Destroy;
end;
function TBeepPeer.FetchChannel(aConnection: TBeepConnection;
aNumber: integer): TBeepChannelInitiator;
var
ID: string;
Index: integer;
begin
//Get channel ID
ID := CalcChannelID(aConnection, aNumber);
//Get index
Index := FChannelsInitiator.IndexOf(ID);
//Get channel object
if Index >= 0 then
Result := TBeepChannelInitiator(FChannelsInitiator.Objects[Index])
else
Result := nil;
end;
function TBeepPeer.GetPoolChannel(PoolIdx: integer;
AutoInc: boolean): TBeepChannel;
var
Pool: TBeepChannelPool;
begin
//Fetch the pool
Pool := TBeepChannelPool(FChannelPool.Items[PoolIdx]);
//Safety
if Pool <> nil then
Result := Pool.GetNextReady(AutoInc)
else
Result := nil;
end;
procedure TBeepPeer.InitialisePool(PoolIdx: integer);
var
Pool: TBeepChannelPool;
begin
//Fetch the pool
Pool := TBeepChannelPool(FChannelPool.Items[PoolIdx]);
//Safety
if Pool <> nil then
Pool.Initialise;
end;
procedure TBeepPeer.OpenChannel(aConnection: TBeepConnection;
aNumber: integer);
var
Chan: TBeepChannelInitiator;
begin
//Fetch the channel object
Chan := FetchChannel(aConnection, aNumber);
//Open the connection
if Chan <> nil then
Chan.OpenChannel;
end;
procedure TBeepPeer.ProfileClosingChannel(aChannel: TBeepChannel);
var
Index: integer;
ID: string;
begin
writeln('Peer closing channel '+inttostr(aChannel.Number));
//Convert
ID := CalcChannelID(aChannel.Connection, aChannel.Number);
//Find index
Index := FChannelsListener.IndexOf(ID);
//Delete item from open list.
FChannelsListener.Delete(Index);
//Add to zombie list
FChannelZombies.Add(aChannel);
end;
procedure TBeepPeer.ProfileCreatedChannel(aChannel: TBeepChannelListener);
var
Chan: TBeepChannelListener;
Index: integer;
ID: string;
begin
writeln('Peer created channel '+inttostr(aChannel.Number));
//***********
//Convert
ID := CalcChannelID(aChannel.Connection, aChannel.Number);
//Check for duplicates
Index := FChannelsListener.IndexOf(ID);
//If not exist
if Index = -1 then
begin
//Create a new channel
Chan := TBeepChannelListener.Create(aChannel.Connection, aChannel.VortexChannel);
//Add handlers
Chan.OnDropped := @ChannelDropped;
//Keep track of all channels
FChannelsListener.AddObject(ID, Chan);
end
else //Exists
begin
//Raise exception
raise EDuplicateChannel.Create('Duplicate channel. Can''t have identical channels in a single peer.');
end;
end;
procedure TBeepPeer.ReleasePoolChannel(PoolIdx: integer;
aChannel: TBeepChannel);
var
Pool: TBeepChannelPool;
begin
//Fetch the pool
Pool := TBeepChannelPool(FChannelPool.Items[PoolIdx]);
//Safety
if Pool <> nil then
Pool.ReleaseChannel(aChannel);
end;
procedure TBeepPeer.RemovePoolChannels(PoolIdx: integer; aCount: integer);
var
Pool: TBeepChannelPool;
begin
//Fetch the pool
Pool := TBeepChannelPool(FChannelPool.Items[PoolIdx]);
//Safety
if Pool <> nil then
Pool.RemoveChannels(aCount);
end;
function TBeepPeer.SendANS(aConnection: TBeepConnection; aNumber: integer;
Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
var
Chan: TBeepChannel;
begin
//Default
Result := false;
//Fetch the channel object
Chan := FetchChannel(aConnection, aNumber);
//Queue the message
if Chan <> nil then
Result := Chan.SendANS(Msg, MsgLen, MsgID);
end;
function TBeepPeer.SendANSFinal(aConnection: TBeepConnection; aNumber: integer;
MsgID: longint): boolean;
var
Chan: TBeepChannel;
begin
//Default
Result := false;
//Fetch the channel object
Chan := FetchChannel(aConnection, aNumber);
//Queue the message
if Chan <> nil then
Result := Chan.SendANSFinal(MsgID);
end;
function TBeepPeer.SendERR(aConnection: TBeepConnection; aNumber: integer;
Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
var
Chan: TBeepChannel;
begin
//Default
Result := false;
//Fetch the channel object
Chan := FetchChannel(aConnection, aNumber);
//Queue the message
if Chan <> nil then
Result := Chan.SendERR(Msg, MsgLen, MsgID);
end;
function TBeepPeer.SendMSG(aConnection: TBeepConnection;
aNumber: integer; Msg: PByte; MsgLen: integer; var MsgID: longint): boolean;
var
Chan: TBeepChannel;
begin
//Default
Result := false;
//Fetch the channel object
Chan := FetchChannel(aConnection, aNumber);
//Queue the message
if Chan <> nil then
Result := Chan.SendMSG(Msg, MsgLen, MsgID);
end;
function TBeepPeer.SendRPY(aConnection: TBeepConnection; aNumber: integer;
Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
var
Chan: TBeepChannel;
begin
//Default
Result := false;
//Fetch the channel object
Chan := FetchChannel(aConnection, aNumber);
//Queue the message
if Chan <> nil then
Result := Chan.SendRPY(Msg, MsgLen, MsgID);
end;
end.

View File

@ -0,0 +1,323 @@
(*
* BeepPeer.pas: BEEP protocol peer base class
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of LazBEEP.
*
* LazBEEP is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LazBEEP 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LazBEEP. If not, see <http://www.gnu.org/licenses/>.}
*)
unit BeepPeer;
{TODO: add file desc header}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
axl, Vortex, BeepUtils, BeepProfile, BeepProfileBase;
type
{ Event types}
TVortexConnClose = procedure (Connection: PVortexConnection) of object;
{ Exceptions }
EBeepInvalidPort = class(EBeepError);
{ TBeepPeer }
TBeepPeer = class(TObject)
private //Managed
FOnConnectionClose: TVortexConnClose;
procedure DoConnectionClose(Connection: PVortexConnection);
protected
Ctx: PVortexCtx; //Vortex Context
Profiles: TStringList; //All profiles active in context
function OpenPeerChannel(Connection: PVortexConnection; ChanNum: longint; Profile: string):boolean;
function ClosePeerChannel(Connection: PVortexConnection; ChanNum: longint): boolean;
function SendPeerChannelMSG(Connection: PVortexConnection; ChanNum: longint; Msg: PByte; MsgLen: integer; var MsgID: longint): boolean;
function SendPeerChannelRPY(Connection: PVortexConnection; ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
function SendPeerChannelANS(Connection: PVortexConnection; ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: longint):boolean;
function SendPeerChannelANSFinal(Connection: PVortexConnection; ChanNum: longint; MsgID: longint):boolean;
function SendPeerChannelERR(Connection: PVortexConnection; ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
function CreatePeerChannelPool(Connection: PVortexConnection; ChanNum: longint; Profile: string):boolean;
//Event handlers
procedure BeepConnectionClose(Connection:PVortexConnection); virtual;
public
//Events
property OnConnectionClose: TVortexConnClose read FOnConnectionClose write FOnConnectionClose; //Listener or client are closing the connection. See VortexConnectionOnClose
constructor Create; virtual;
destructor Destroy; override;
//Register a profile in the context. See vortex_profiles_register. All profiles are visible/usable by all listeners and all channels in the context
function AddProfile(Name: string): TBeepProfile;
procedure DeleteProfile(Name: string);
end;
{NOTE: this is Vortex Context module. Do all the main funcionts and context functions in here}
const
MAX_PORT = 65536; //Highest port number allowed
{ Vortex callbacks }
// Connection
procedure VortexConnectionClose(Connection:PVortexConnection; Data:TaxlPointer);cdecl;
implementation
{ Vortex Callbacks }
//* Implementation note:
//* Vortex library can't accept methods as callback functions. To allow multiple
//* instantiations of the class, global functions are used as callbacks. The
//* object references are passed to the global functions to allow the correct
//* event handlers to be called.
//Data points to connection's TBeepListener object (ie owning listener)
procedure VortexConnectionClose(Connection:PVortexConnection; Data:TaxlPointer);cdecl;
var
Owner: TBeepPeer;
begin
if assigned(Data) then
begin
Owner := TBeepPeer(Data);
Owner.BeepConnectionClose(Connection);
end;
end;
{ TBeepPeer }
function TBeepPeer.AddProfile(Name: string): TBeepProfile;
var
Prof: TBeepProfile;
Index: integer;
begin
//Check for duplicates
Index := Profiles.IndexOfName(Name);
//If not exist
if Index = -1 then
begin
//Create a new profile
Prof := TBeepProfile.Create(Name);
//Add new profile
Profiles.AddObject(Name, Prof);
//Register profile
vortex_profiles_register(Ctx , PChar(Prof.Name),
@VortexStartChannel , TaxlPointer(Prof),
@VortexCloseChannel , TaxlPointer(Prof),
@VortexFrameReceived, TaxlPointer(Prof));
//Return a reference
Result := Prof;
end
else //Exists
begin
//Return existing profile
Result := TBeepProfile(Profiles.Objects[Index]);
end;
end;
procedure TBeepPeer.BeepConnectionClose(Connection: PVortexConnection);
begin
//Trigger event
DoConnectionClose(Connection);
end;
function TBeepPeer.ClosePeerChannel(Connection: PVortexConnection; ChanNum: longint): boolean;
var
Channel: PVortexChannel;
begin
//Default result
Result := false;
//Get channel object
Channel := vortex_connection_get_channel(Connection, ChanNum);
if Channel <> nil then
//Close channel
Result := (axl_true = vortex_channel_close(Channel, nil));
end;
constructor TBeepPeer.Create;
var
VResult : Taxl_bool;
begin
//Create objects
Profiles := TStringList.Create;
//Create the context
Ctx := vortex_ctx_new ();
//Init vortex library
VResult := vortex_init_ctx (Ctx);
//Init error
if axl_false = VResult then
raise EBeepContext.Create('Could not initialise BEEP context. Network communication is not functional');
end;
procedure TBeepPeer.DeleteProfile(Name: string);
begin
//if registered, unregister
//if in list, remove, free
{TODO: unregister profile}
end;
destructor TBeepPeer.Destroy;
var
k: Integer;
begin
//Free the objects
if assigned(Profiles) then
for k := 0 to Profiles.Count-1 do
Profiles.Objects[k].Free;
Profiles.Free;
//End vortex function, stop all threads
if assigned(Ctx) then
vortex_exit_ctx (Ctx, axl_true);
inherited Destroy;
end;
procedure TBeepPeer.DoConnectionClose(Connection: PVortexConnection);
begin
if assigned(FOnConnectionClose) then
FOnConnectionClose(Connection);
end;
function TBeepPeer.OpenPeerChannel(Connection: PVortexConnection; ChanNum: longint; Profile: string): boolean;
begin
//Default = success
Result := false;
//Check profile support
if axl_true = vortex_connection_is_profile_supported(Connection, PChar(Profile)) then
begin
//Open channel
Result := (nil <> vortex_channel_new(Connection, ChanNum, PChar(Profile), nil, nil, nil, nil, nil, nil) );
{TODO: Add 1st level profile handlers}
{TODO: Give possibilty to have OnCreated handler to prevent blocking}
end
end;
function TBeepPeer.SendPeerChannelANS(Connection: PVortexConnection;
ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
var
Channel: PVortexChannel;
begin
//Default
Result := false;
//Get channel object
Channel := vortex_connection_get_channel(Connection, ChanNum);
if Channel <> nil then
begin
//Queue the message
Result := (axl_true = vortex_channel_send_ans_rpy(Channel, Msg, MsgLen, MsgID));
end;
end;
function TBeepPeer.SendPeerChannelANSFinal(Connection: PVortexConnection;
ChanNum: longint; MsgID: longint): boolean;
var
Channel: PVortexChannel;
begin
//Default
Result := false;
//Get channel object
Channel := vortex_connection_get_channel(Connection, ChanNum);
if Channel <> nil then
begin
//Queue the message
Result := (axl_true = vortex_channel_finalize_ans_rpy(Channel, MsgID));
end;
end;
function TBeepPeer.SendPeerChannelERR(Connection: PVortexConnection;
ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
var
Channel: PVortexChannel;
begin
//Default
Result := false;
//Get channel object
Channel := vortex_connection_get_channel(Connection, ChanNum);
if Channel <> nil then
begin
//Queue the message
Result := (axl_true = vortex_channel_send_err(Channel, Msg, MsgLen, MsgID));
end;
end;
function TBeepPeer.SendPeerChannelMSG(Connection: PVortexConnection;
ChanNum: longint; Msg: PByte; MsgLen: integer; var MsgID: longint): boolean;
var
Channel: PVortexChannel;
begin
//Default
Result := false;
//Get channel object
Channel := vortex_connection_get_channel(Connection, ChanNum);
if Channel <> nil then
begin
//Queue the message
Result := (axl_true = vortex_channel_send_msg(Channel, Msg, MsgLen, MsgID));
end;
end;
function TBeepPeer.SendPeerChannelRPY(Connection: PVortexConnection;
ChanNum: longint; Msg: PByte; MsgLen: integer; MsgID: longint): boolean;
var
Channel: PVortexChannel;
begin
//Default
Result := false;
//Get channel object
Channel := vortex_connection_get_channel(Connection, ChanNum);
if Channel <> nil then
begin
//Queue the message
Result := (axl_true = vortex_channel_send_rpy(Channel, Msg, MsgLen, MsgID));
end;
end;
end.

View File

@ -0,0 +1,368 @@
(*******************************************************************************
* BeepProfile.pas: Helper class for BeepPeer
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepProfile implements all the BEEP profile handling capabilities of the
* Vortex library
******************************************************************************)
unit BeepProfile;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
axl, Vortex, BeepUtils, BeepObject, BeepContext, BeepConnection, BeepFrame, BeepChannel;
type
{ Event types }
TBeepStartChannelRequest = procedure (aConnection: TBeepConnection; ChanNum: integer; var Accept: boolean) of object;
TBeepCreatedChannel = procedure (aChannel: TBeepChannelListener) of object;
TBeepFrameReceived = procedure (aConnection: TBeepConnection; aChannel: TBeepChannel; aFrame: TBeepFrame) of object;
TBeepCloseChannelRequest = procedure (aConnection: TBeepConnection; ChanNum: integer; var Accept: boolean) of object;
TBeepClosingChannel = procedure (aChannel: TBeepChannel) of object;
{ TBeepProfile }
TBeepProfile = class(TBEEPObject)
private
FContext: TBeepContext;
FName: string;
FOnCloseChannelRequest: TBeepCloseChannelRequest; //User event: can channel close?
FOnClosingChannel: TBeepClosingChannel; //Owner event: closing channel. User said yes
FOnCreatedChannel: TBeepCreatedChannel; //Owner event: creating new channel. User said yes
FOnFrameReceived: TBeepFrameReceived; //User event: received new frame
FOnStartChannelRequest: TBeepStartChannelRequest; //User event: can open channel?
procedure SetName(const AValue: string);
//Event triggers
procedure DoCloseChannel(aConnection: TBeepConnection; ChanNum: integer; var Accept: boolean);
procedure DoClosingChannel(aChannel: TBeepChannel);
procedure DoCreatedChannel(aChannel: TBeepChannelListener);
procedure DoFrameReceived(aConnection: TBeepConnection; aChannel: TBeepChannel; aFrame: TBeepFrame);
procedure DoStartChannel(aConnection: TBeepConnection; ChanNum: integer; var Accept: boolean);
//Event handlers
procedure BeepCloseChannel(ChanNum: integer; Connection: PVortexConnection; var Accept: boolean);
procedure BeepFrameReceived(Channel: PVortexChannel; Connection: PVortexConnection; Frame: PVortexFrame);
procedure BeepStartChannel(ChanNum: integer; Connection: PVortexConnection; var Accept: boolean);
public
//Events
property OnCloseChannelRequest: TBeepCloseChannelRequest read FOnCloseChannelRequest write FOnCloseChannelRequest;
property OnFrameReceived: TBeepFrameReceived read FOnFrameReceived write FOnFrameReceived;
property OnStartChannelRequest: TBeepStartChannelRequest read FOnStartChannelRequest write FOnStartChannelRequest;
//Properties
property Context: TBeepContext read FContext;
property Name: string read FName write SetName;
constructor Create(aCtx: TBeepContext; aName: string; OnCreatedChannel: TBeepCreatedChannel; OnClosingChannel: TBeepClosingChannel);
destructor Destroy; override;
procedure RegisterProfile;
procedure UnRegisterProfile;
end;
{ Vortex funtions to implement
function vortex_profiles_set_mime_type
function vortex_profiles_get_mime_type
function vortex_profiles_get_transfer_encoding ar;
function vortex_profiles_register_extended_start ;
function vortex_profiles_is_defined_start
function vortex_profiles_is_defined_close
function vortex_profiles_is_defined_received
function vortex_profiles_get_actual_list (ctx : PVortexCtx):PaxlList;
function vortex_profiles_get_actual_list_ref (ctx : PVortexCtx):PaxlList;
function vortex_profiles_registered (ctx : PVortexCtx):longint;
function vortex_profiles_is_registered
procedure vortex_profiles_set_automatic_mime
function vortex_profiles_get_automatic_mime
DONE:
function vortex_profiles_register
function vortex_profiles_unregister
}
implementation
{ Vortex Callbacks }
//* Implementation note:
//* Vortex library can't accept methods as callback functions. To allow multiple
//* instantiations of the class, global functions are used as callbacks. The
//* object references are passed to the global functions to allow the correct
//* event handlers to be called.
//User_data points to profile's TBeepProfile object (ie owning profile)
function VortexCloseChannelRequest(Channel_num: longint; Connection: PVortexConnection;
User_data: TaxlPointer): longint; cdecl;
var
Prof: TBeepProfile;
Accept: boolean;
begin
//Default response.
Accept := true;
//Execute user assigned event handler
if assigned(User_data) then
begin
Prof := TBeepProfile(User_data);
Prof.AcquireLock;
try
Prof.BeepCloseChannel(Channel_num, Connection, Accept);
finally
Prof.ReleaseLock;
end;
end;
//Return axl_false to deny channel closure
//Return axl_true to allow new channel closure
Result := VortexBool(Accept);
end;
//User_data points to profile's TBeepProfile object (ie owning profile)
procedure VortexFrameReceived (Channel: PVortexChannel; Connection: PVortexConnection;
Frame: PVortexFrame; User_data: TaxlPointer); cdecl;
var
Prof: TBeepProfile;
begin
//Execute user assigned event handler
if assigned(User_data) then
begin
Prof := TBeepProfile(User_data);
Prof.AcquireLock;
try
Prof.BeepFrameReceived(Channel, Connection, Frame);
finally
Prof.ReleaseLock;
end;
end;
end;
//User_data points to profile's TBeepProfile object (ie owning profile)
function VortexStartChannel (Channel_num: longint; Connection: PVortexConnection;
User_data: TaxlPointer):longint;cdecl;
var
Prof: TBeepProfile;
Accept: boolean;
begin
//Default response.
Accept := true;
//Execute user assigned event handler
if assigned(User_data) then
begin
Prof := TBeepProfile(user_data);
Prof.AcquireLock;
try
Prof.BeepStartChannel(Channel_num, Connection, Accept);
finally
Prof.ReleaseLock;
end;
end;
//Return axl_false to deny channel creation
//Return axl_true to allow new channel creation
Result := VortexBool(Accept);
end;
{ TBeepProfile }
procedure TBeepProfile.BeepCloseChannel(ChanNum: integer;
Connection: PVortexConnection; var Accept: boolean);
var
BeepCon: TBeepConnection;
VChan: PVortexChannel;
BeepChan: TBeepChannel;
begin
//Retrieve the associated objects
BeepCon := TBeepConnection(vortex_connection_get_data(Connection, KEY_OWNER));
//Trigger event
DoCloseChannel(BeepCon, ChanNum, Accept);
//Inform owner about the closing
if Accept then
begin
//Fetch the closing channel
VChan := vortex_connection_get_channel(Connection, ChanNum);
//Fetch the channel object
BeepChan := TBeepChannel(vortex_channel_get_data(VChan, KEY_OWNER));
//Trigger event
DoClosingChannel(BeepChan);
end;
end;
procedure TBeepProfile.BeepFrameReceived(Channel: PVortexChannel;
Connection: PVortexConnection; Frame: PVortexFrame);
var
BeepCon: TBeepConnection;
BeepChan: TBeepChannel;
BeepFrame: TBeepFrame;
begin
//Retrieve the associated objects
BeepCon := TBeepConnection(vortex_connection_get_data(Connection, KEY_OWNER));
BeepChan := TBeepChannel (vortex_channel_get_data (Channel , KEY_OWNER));
//Create temporary object
BeepFrame := TBeepFrame.Create(Frame);
//Trigger event
DoFrameReceived(BeepCon, BeepChan, BeepFrame);
//Free object
BeepFrame.Free;
end;
procedure TBeepProfile.BeepStartChannel(ChanNum: integer;
Connection: PVortexConnection; var Accept: boolean);
var
BeepCon: TBeepConnection;
VChan: PVortexChannel;
BeepChan: TBeepChannelListener;
begin
//Retrieve the associated objects
BeepCon := TBeepConnection(vortex_connection_get_data(Connection, KEY_OWNER));
//Trigger event
DoStartChannel(BeepCon, ChanNum, Accept);
//Inform the owner about the new channel
if Accept then
begin
//Fetch the semi existent channel
VChan := vortex_connection_get_channel(Connection, ChanNum);
//Create a temp channel object
//BeepChan := TBeepChannelListener.Create(BeepCon, VChan, ChanNum);
BeepChan := TBeepChannelListener.Create(BeepCon, VChan);
//Trigger event
DoCreatedChannel(BeepChan);
//Free the temp object
BeepChan.Free;
end;
end;
constructor TBeepProfile.Create(aCtx: TBeepContext; aName: string;
OnCreatedChannel: TBeepCreatedChannel; OnClosingChannel: TBeepClosingChannel);
begin
//Safety checks
if aCtx = nil then
raise EBeepInvalidContext.Create('TBeepProfile requires a valid context.');
if aName = EmptyStr then
; //raise
{TODO: exception}
inherited Create;
FContext := aCtx;
FName := aName;
FOnCreatedChannel := OnCreatedChannel; //Private event to owner
FOnClosingChannel := OnClosingChannel; //Private event to owner
end;
destructor TBeepProfile.Destroy;
begin
inherited Destroy;
end;
procedure TBeepProfile.DoCloseChannel(aConnection: TBeepConnection;
ChanNum: integer; var Accept: boolean);
begin
if assigned(FOnCloseChannelRequest) then
FOnCloseChannelRequest(aConnection, ChanNum, Accept);
end;
procedure TBeepProfile.DoClosingChannel(aChannel: TBeepChannel);
begin
if assigned(FOnClosingChannel) then
FOnClosingChannel(aChannel);
end;
procedure TBeepProfile.DoCreatedChannel(aChannel: TBeepChannelListener);
begin
if assigned(FOnCreatedChannel) then
FOnCreatedChannel(aChannel);
end;
procedure TBeepProfile.DoFrameReceived(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
begin
if assigned(FOnFrameReceived) then
FOnFrameReceived(aConnection, aChannel, aFrame);
end;
procedure TBeepProfile.DoStartChannel(aConnection: TBeepConnection;
ChanNum: integer; var Accept: boolean);
begin
if assigned(FOnStartChannelRequest) then
FOnStartChannelRequest(aConnection, ChanNum, Accept);
end;
procedure TBeepProfile.RegisterProfile;
begin
//Only if not registered yet
if axl_false = vortex_profiles_is_registered(Context.VortexCtx, PChar(Name)) then
//Register
if axl_false = vortex_profiles_register(Context.VortexCtx, PChar(Name),
@VortexStartChannel , self,
@VortexCloseChannelRequest, self,
@VortexFrameReceived , self) then
raise EProfileNotRegistered.Create('Profile could not be registered:#13#10'+Name);
end;
procedure TBeepProfile.SetName(const AValue: string);
begin
if FName = AValue then exit;
FName := AValue;
end;
procedure TBeepProfile.UnRegisterProfile;
begin
//Unregister
vortex_profiles_unregister(Context.VortexCtx, PChar(Name));
end;
end.

View File

@ -0,0 +1,154 @@
(*
* BeepProfileBase.pas: Base class for Beep profiles
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
*)
unit BeepProfileBase;
{TODO: add file desc header}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
axl, Vortex, BeepFrame;
type
{ Event types}
TVortexCloseChannel = procedure (ChanNum: integer; Connection: PVortexConnection; var Accept: boolean) of object;
//TVortexFrameReceived = procedure (Channel: PVortexChannel; Connection: PVortexConnection; Frame: PVortexFrame) of object;
TVortexFrameReceived = procedure (Frame: TBeepFrame) of object;
{ TBeepProfileBase }
TBeepProfileBase = class(TObject)
private
FOnCloseChannel: TVortexCloseChannel;
FOnFrameReceived: TVortexFrameReceived;
//Event triggers
procedure DoCloseChannel(ChanNum: integer; Connection: PVortexConnection; var Accept: boolean);
//procedure DoFrameReceived(Channel: PVortexChannel; Connection: PVortexConnection; Frame: PVortexFrame);
procedure DoFrameReceived(aFrame: TBeepFrame);
//Event handlers
procedure BeepCloseChannel(ChanNum: integer; Connection: PVortexConnection; var Accept: boolean);cdecl;
procedure BeepFrameReceived(Channel: PVortexChannel; Connection: PVortexConnection; Frame: PVortexFrame);
public
//Events
property OnCloseChannel: TVortexCloseChannel read FOnCloseChannel write FOnCloseChannel;
property OnFrameReceived: TVortexFrameReceived read FOnFrameReceived write FOnFrameReceived;
end;
{ Vortex Callbacks }
function VortexCloseChannel(Channel_num: longint; Connection: PVortexConnection;
User_data: TaxlPointer): longint; cdecl;
procedure VortexFrameReceived (Channel: PVortexChannel; Connection: PVortexConnection;
Frame: PVortexFrame; User_data: TaxlPointer); cdecl;
implementation
uses
BeepUtils;
{ Vortex Callbacks }
//* Implementation note:
//* Vortex library can't accept methods as callback functions. To allow multiple
//* instantiations of the class, global functions are used as callbacks. The
//* object references are passed to the global functions to allow the correct
//* event handlers to be called.
//User_data points to profile's TBeepProfile object (ie owning profile)
function VortexCloseChannel(Channel_num: longint; Connection: PVortexConnection;
User_data: TaxlPointer): longint; cdecl;
var
Prof: TBeepProfileBase;
Accept: boolean;
begin
//Default response.
Accept := true;
//Execute user assigned event handler
if assigned(User_data) then
begin
Prof := TBeepProfileBase(User_data);
Prof.BeepCloseChannel(Channel_num, Connection, Accept);
end;
//Return axl_false to deny channel closure
//Return axl_true to allow new channel closure
Result := VortexBool(Accept);
end;
//User_data points to profile's TBeepProfile object (ie owning profile)
procedure VortexFrameReceived (Channel: PVortexChannel; Connection: PVortexConnection;
Frame: PVortexFrame; User_data: TaxlPointer); cdecl;
var
Prof: TBeepProfileBase;
begin
//Execute user assigned event handler
if assigned(User_data) then
begin
Prof := TBeepProfileBase(User_data);
Prof.BeepFrameReceived(Channel, Connection, Frame);
end;
end;
{ TBeepProfileBase }
procedure TBeepProfileBase.BeepCloseChannel(ChanNum: integer;
Connection: PVortexConnection; var Accept: boolean); cdecl;
begin
//Trigger event
DoCloseChannel(ChanNum, Connection, Accept);
end;
procedure TBeepProfileBase.BeepFrameReceived(Channel: PVortexChannel;
Connection: PVortexConnection; Frame: PVortexFrame);
begin
//Trigger event
//DoFrameReceived(Channel, Connection, Frame);
//DoFrameReceived();
end;
procedure TBeepProfileBase.DoCloseChannel(ChanNum: integer;
Connection: PVortexConnection; var Accept: boolean);
begin
if assigned(FOnCloseChannel) then
FOnCloseChannel(ChanNum, Connection, Accept);
end;
procedure TBeepProfileBase.DoFrameReceived(aFrame: TBeepFrame);
begin
if assigned(FOnFrameReceived) then
FOnFrameReceived(aFrame);
end;
end.

View File

@ -0,0 +1,238 @@
(*******************************************************************************
* BeepServer.pas: BEEP protocol server implementation
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepServer implements a BEEP protocol listener using the TBeepXXXXX
* classes. The sever does not originate any connections. It accepts
* multiple concurrent connections from different peers and each connection can
* have multiple channels to the peer.
******************************************************************************)
unit BeepServer;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, contnrs,
BeepPeer, BeepListener, BeepConnection;
type
{ Event types}
TListenerReadyEvent = procedure(aListener: TBeepListener) of object;
TListenerFailedEvent = procedure(aListener: TBeepListener; const ErrMsg: string) of object;
TListenerStopEvent = procedure(aListener: TBeepListener) of object;
{ TBeepServer }
TBeepServer = class(TBeepPeer)
private
FListeners: TFPObjectList; //All the active listeners
FOnConnectionAccept: TBeepAcceptConnection;
FOnConnectionClose: TBeepCloseConnection;
FOnListenerFailed: TListenerFailedEvent;
FOnListenerReady: TListenerReadyEvent;
FOnListenerStop: TListenerStopEvent;
//Event triggers
procedure DoConnectionAccept(aConnection: TBeepConnectionListener; var Accept: boolean);
procedure DoConnectionClose(aConnection: TBeepConnection);
procedure DoListenerFailed(aListener: TBeepListener; const ErrMsg: string);
procedure DoListenerReady(aListener: TBeepListener);
procedure DoListenerStop(aListener: TBeepListener);
//Event handlers
procedure ListenConnectionAccept(aConnection: TBeepConnectionListener;
var Accept: boolean);
procedure ListenConnectionClose(aConnection: TBeepConnection);
procedure ListenFailed(aListener: TObject; const ErrMsg: string);
procedure ListenReady(aListener: TObject);
procedure ListenStop(aListener: TObject);
public
//Events
property OnListenerReady: TListenerReadyEvent read FOnListenerReady write FOnListenerReady; //Listener created and ready
property OnListenerFailed: TListenerFailedEvent read FOnListenerFailed write FOnListenerFailed;//Listener creation failed
property OnListenerStop: TListenerStopEvent read FOnListenerStop write FOnListenerStop; //Listener is stopping
property OnConnectionAccept: TBeepAcceptConnection read FOnConnectionAccept write FOnConnectionAccept; //Connection request
property OnConnectionClose: TBeepCloseConnection read FOnConnectionClose write FOnConnectionClose; //Connection closed/dropped
constructor Create; override;
destructor Destroy; override;
//Listeners
procedure AddListener(aHost: string; aPort: string); //Register a Host:Port combination on which to listen for FConnections. All the FPortListeners will have all the profiles
procedure StartAll;
procedure StopAll;
end;
implementation
uses
BeepUtils;
{ TBeepServer }
procedure TBeepServer.AddListener(aHost: string; aPort: string);
var
NewListen: TBeepListener;
begin
{* NOTE:
* BeepFp was designed with multiple listeners in one Server(Context) in mind.
* There are some things I don't yet understand about Vortex operation. It seems
* that all the Vortex Listeners in one context are informed about all the
* events happeing on any of the listeners. This means that the listeners are
* not indepent from each other. Whether it is required to have
* multiple listeners in one context must be reviewed. Maybe it is better to
* have multiple servers, each with their one listener. In any case, a lot of
* the work has been done, but its use are prevented by the following check.
* The problems with the current implementation is that each BeepListener
* object must check whether the triggered event (connection accept, close, etc)
* does actually involve it (the beeplistener). Failing to do this results in
* crashes because uninitialised object are passed around and used.}
//Warn for unsupported usage
if FListeners.Count > 0 then
raise EBeepListener.Create('Multiple listeners in one TBeepServer is not yet supported.');
//Safety check
if not VortexPortOK(aPort) then
raise EBeepInvalidPort.Create('Invalid port number. Valid range for Port is 0 to '+IntToStr(MAX_PORT));
{TODO: Prevent duplicate entries}
//How to check what exists
//Create a listener
NewListen := TBeepListener.Create(Context);
NewListen.Host := aHost;
NewListen.Port := aPort;
NewListen.OnReady := @ListenReady;
NewListen.OnFailed := @ListenFailed;
NewListen.OnStop := @ListenStop;
NewListen.OnConnectionAccept := @ListenConnectionAccept;
NewListen.OnConnectionClose := @ListenConnectionClose;
//Add to list
FListeners.Add(NewListen);
end;
constructor TBeepServer.Create;
begin
inherited Create;
//Create objects
FListeners := TFPObjectList.Create(true); //Free objects automatically
end;
destructor TBeepServer.Destroy;
begin
FListeners.Free;
inherited Destroy;
end;
procedure TBeepServer.DoConnectionAccept(aConnection: TBeepConnectionListener;
var Accept: boolean);
begin
if assigned(FOnConnectionAccept) then
FOnConnectionAccept(aConnection, Accept);
end;
procedure TBeepServer.DoConnectionClose(aConnection: TBeepConnection);
begin
if assigned(FOnConnectionClose) then
FOnConnectionClose(aConnection);
end;
procedure TBeepServer.DoListenerFailed(aListener: TBeepListener;
const ErrMsg: string);
begin
if assigned(FOnListenerFailed) then
FOnListenerFailed(aListener, ErrMsg);
end;
procedure TBeepServer.DoListenerReady(aListener: TBeepListener);
begin
if assigned(FOnListenerReady) then
FOnListenerReady(aListener);
end;
procedure TBeepServer.DoListenerStop(aListener: TBeepListener);
begin
if assigned(FOnListenerStop) then
FOnListenerStop(aListener);
end;
procedure TBeepServer.ListenConnectionAccept(
aConnection: TBeepConnectionListener; var Accept: boolean);
begin
{$IFDEF DBG_SERVER}
writeln(Format('Beep Server(%s:%s) Connection Accept', [aConnection.Host, aConnection.Port]));
{$ENDIF}
//Trigger event
DoConnectionAccept(aConnection, Accept);
end;
procedure TBeepServer.ListenConnectionClose(aConnection: TBeepConnection);
begin
{$IFDEF DBG_SERVER}
writeln(Format('Beep Server(%s:%s) Closing connection', [aConnection.Host, aConnection.Port]));
{$ENDIF}
//Trigger event
DoConnectionClose(aConnection);
end;
procedure TBeepServer.ListenFailed(aListener: TObject; const ErrMsg: string);
begin
DoListenerFailed( TBeepListener(aListener), ErrMsg);
end;
procedure TBeepServer.ListenReady(aListener: TObject);
begin
DoListenerReady( TBeepListener(aListener) );
end;
procedure TBeepServer.ListenStop(aListener: TObject);
begin
DoListenerStop( TBeepListener(aListener) );
end;
procedure TBeepServer.StartAll;
var
k: Integer;
begin
for k := 0 to FListeners.Count-1 do
TBeepListener(FListeners.Items[k]).Start;
end;
procedure TBeepServer.StopAll;
var
k: Integer;
begin
for k := 0 to FListeners.Count-1 do
TBeepListener(FListeners.Items[k]).Stop;
end;
end.

View File

@ -0,0 +1,87 @@
(*******************************************************************************
* BeepUtils.pas: Utilities for BEEP classes
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TBeepUtils implements some utility functions and definitions used across
* LazBEEP
******************************************************************************)
unit BeepUtils;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
axl;
type
{ Exceptions }
EBeepError = class(Exception);
EBeepInvalidContext = class(EBeepError);
EBeepInvalidConnection = class(EBeepError);
EBeepInvalidChannel = class(EBeepError);
EBeepInvalidPort = class(EBeepError);
EBeepInvalidProfile = class(EBeepError);
EBeepInvalidChannelNumber = class(EBeepError);
EProfileNotSupported = class(EBeepError);
EProfileNotRegistered = class(EBeepError);
EBeepListener = class(EBeepError);
const
MAX_PORT = 65536; //Highest port number allowed
KEY_OWNER : PChar = 'Owner'; //Key used to store BEEP object pointers in the Vortex structures
function VortexBool(aValue: boolean): Taxl_bool; inline;
function VortexPortOK(aPort: integer): boolean;
function VortexPortOK(aPort: string): boolean;
implementation
{$inline on}
function VortexBool(aValue: boolean): Taxl_bool; inline;
begin
if aValue then
Result := axl_true
else
Result := axl_false;
end;
function VortexPortOK(aPort: string): boolean;
var
Val: integer;
begin
//Convert string
Val := StrToInt(aPort);
Result := VortexPortOK(Val);
end;
function VortexPortOK(aPort: integer): boolean;
begin
Result := (aPort >= 0) and (MAX_PORT >= aPort)
end;
{$inline off}
end.

View File

@ -0,0 +1,38 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>TBeepConnection</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 12-07-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="TBeepConnection"></a>TBeepConnection</h1><div class=CBody><p>Implements the Vortex Connection module</p></div></div></div>
</div><!--Content-->
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Menu><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Class Index</a></div></div><div class=MEntry><div class=MFile><a href="beeppeer_old-pas.html">Do all the main funcionts and context functions in here</a></div></div><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MFile id=MSelected>TBeepConnection</div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option></select></div></div><!--Menu-->
<!--START_ND_TOOLTIPS-->
<!--END_ND_TOOLTIPS-->
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>this is Vortex Context module.&nbsp; Do all the main funcionts and context functions in here</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 12-07-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Content><div class="CGeneric"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="this_is_Vortex_Context_module.Do_all_the_main_funcionts_and_context_functions_in_here"></a>this is Vortex Context module.&nbsp; Do all the main funcionts and context functions in here</h1><div class=CBody></div></div></div>
</div><!--Content-->
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Menu><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Class Index</a></div></div><div class=MEntry><div class=MFile id=MSelected>Do all the main funcionts and context functions in here</div></div><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MFile><a href="beepconnection-pas.html">TBeepConnection</a></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option></select></div></div><!--Menu-->
<!--START_ND_TOOLTIPS-->
<!--END_ND_TOOLTIPS-->
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

View File

@ -0,0 +1 @@
<html><head><meta http-equiv="Refresh" CONTENT="0; URL=files3/beeppeer_old-pas.html"></head></html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>Class Index</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="IndexPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 12-07-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Index><div class=IPageTitle>Class Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; D &middot; E &middot; F &middot; G &middot; H &middot; I &middot; J &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; <a href="#T">T</a> &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="T"></a>T</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files3/beepconnection-pas.html#TBeepConnection" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>TBeepConnection</a></td></tr></table>
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CClass>Implements the Vortex Connection module</div></div><!--END_ND_TOOLTIPS-->
</div><!--Index-->
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Menu><div class=MEntry><div class=MIndex id=MSelected>Class Index</div></div><div class=MEntry><div class=MFile><a href="../files3/beeppeer_old-pas.html">Do all the main funcionts and context functions in here</a></div></div><div class=MEntry><div class=MIndex><a href="General.html">Everything</a></div></div><div class=MEntry><div class=MFile><a href="../files3/beepconnection-pas.html">TBeepConnection</a></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option></select></div></div><!--Menu-->
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>Index</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="IndexPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 12-07-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Index><div class=IPageTitle>Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; B &middot; C &middot; <a href="#D">D</a> &middot; E &middot; F &middot; G &middot; H &middot; I &middot; J &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; <a href="#T">T</a> &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="D"></a>D</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files3/beeppeer_old-pas.html#this_is_Vortex_Context_module.Do_all_the_main_funcionts_and_context_functions_in_here" class=ISymbol>Do all the main funcionts and context functions in here</a>, <span class=IParent>this is Vortex Context module</span></td></tr><tr><td class=IHeading><a name="T"></a>T</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files3/beepconnection-pas.html#TBeepConnection" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>TBeepConnection</a></td></tr></table>
<!--START_ND_TOOLTIPS-->
<!--END_ND_TOOLTIPS-->
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CClass>Implements the Vortex Connection module</div></div><!--END_ND_TOOLTIPS-->
</div><!--Index-->
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Menu><div class=MEntry><div class=MIndex><a href="Classes.html">Class Index</a></div></div><div class=MEntry><div class=MFile><a href="../files3/beeppeer_old-pas.html">Do all the main funcionts and context functions in here</a></div></div><div class=MEntry><div class=MIndex id=MSelected>Everything</div></div><div class=MEntry><div class=MFile><a href="../files3/beepconnection-pas.html">TBeepConnection</a></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option></select></div></div><!--Menu-->
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

View File

@ -0,0 +1,835 @@
// This file is part of Natural Docs, which is Copyright (C) 2003-2005 Greg Valure
// Natural Docs is licensed under the GPL
//
// Browser Styles
// ____________________________________________________________________________
var agt=navigator.userAgent.toLowerCase();
var browserType;
var browserVer;
if (agt.indexOf("opera") != -1)
{
browserType = "Opera";
if (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1)
{ browserVer = "Opera7"; }
else if (agt.indexOf("opera 8") != -1 || agt.indexOf("opera/8") != -1)
{ browserVer = "Opera8"; }
else if (agt.indexOf("opera 9") != -1 || agt.indexOf("opera/9") != -1)
{ browserVer = "Opera9"; }
}
else if (agt.indexOf("applewebkit") != -1)
{
browserType = "Safari";
if (agt.indexOf("version/3") != -1)
{ browserVer = "Safari3"; }
else if (agt.indexOf("safari/4") != -1)
{ browserVer = "Safari2"; }
}
else if (agt.indexOf("khtml") != -1)
{
browserType = "Konqueror";
}
else if (agt.indexOf("msie") != -1)
{
browserType = "IE";
if (agt.indexOf("msie 6") != -1)
{ browserVer = "IE6"; }
else if (agt.indexOf("msie 7") != -1)
{ browserVer = "IE7"; }
}
else if (agt.indexOf("gecko") != -1)
{
browserType = "Firefox";
if (agt.indexOf("rv:1.7") != -1)
{ browserVer = "Firefox1"; }
else if (agt.indexOf("rv:1.8)") != -1 || agt.indexOf("rv:1.8.0") != -1)
{ browserVer = "Firefox15"; }
else if (agt.indexOf("rv:1.8.1") != -1)
{ browserVer = "Firefox2"; }
}
//
// Support Functions
// ____________________________________________________________________________
function GetXPosition(item)
{
var position = 0;
if (item.offsetWidth != null)
{
while (item != document.body && item != null)
{
position += item.offsetLeft;
item = item.offsetParent;
};
};
return position;
};
function GetYPosition(item)
{
var position = 0;
if (item.offsetWidth != null)
{
while (item != document.body && item != null)
{
position += item.offsetTop;
item = item.offsetParent;
};
};
return position;
};
function MoveToPosition(item, x, y)
{
// Opera 5 chokes on the px extension, so it can use the Microsoft one instead.
if (item.style.left != null)
{
item.style.left = x + "px";
item.style.top = y + "px";
}
else if (item.style.pixelLeft != null)
{
item.style.pixelLeft = x;
item.style.pixelTop = y;
};
};
//
// Menu
// ____________________________________________________________________________
function ToggleMenu(id)
{
if (!window.document.getElementById)
{ return; };
var display = window.document.getElementById(id).style.display;
if (display == "none")
{ display = "block"; }
else
{ display = "none"; }
window.document.getElementById(id).style.display = display;
}
function HideAllBut(ids, max)
{
if (document.getElementById)
{
ids.sort( function(a,b) { return a - b; } );
var number = 1;
while (number < max)
{
if (ids.length > 0 && number == ids[0])
{ ids.shift(); }
else
{
document.getElementById("MGroupContent" + number).style.display = "none";
};
number++;
};
};
}
//
// Tooltips
// ____________________________________________________________________________
var tooltipTimer = 0;
function ShowTip(event, tooltipID, linkID)
{
if (tooltipTimer)
{ clearTimeout(tooltipTimer); };
var docX = event.clientX + window.pageXOffset;
var docY = event.clientY + window.pageYOffset;
var showCommand = "ReallyShowTip('" + tooltipID + "', '" + linkID + "', " + docX + ", " + docY + ")";
tooltipTimer = setTimeout(showCommand, 1000);
}
function ReallyShowTip(tooltipID, linkID, docX, docY)
{
tooltipTimer = 0;
var tooltip;
var link;
if (document.getElementById)
{
tooltip = document.getElementById(tooltipID);
link = document.getElementById(linkID);
}
/* else if (document.all)
{
tooltip = eval("document.all['" + tooltipID + "']");
link = eval("document.all['" + linkID + "']");
}
*/
if (tooltip)
{
var left = GetXPosition(link);
var top = GetYPosition(link);
top += link.offsetHeight;
// The fallback method is to use the mouse X and Y relative to the document. We use a separate if and test if its a number
// in case some browser snuck through the above if statement but didn't support everything.
if (!isFinite(top) || top == 0)
{
left = docX;
top = docY;
}
// Some spacing to get it out from under the cursor.
top += 10;
// Make sure the tooltip doesnt get smushed by being too close to the edge, or in some browsers, go off the edge of the
// page. We do it here because Konqueror does get offsetWidth right even if it doesnt get the positioning right.
if (tooltip.offsetWidth != null)
{
var width = tooltip.offsetWidth;
var docWidth = document.body.clientWidth;
if (left + width > docWidth)
{ left = docWidth - width - 1; }
// If there's a horizontal scroll bar we could go past zero because it's using the page width, not the window width.
if (left < 0)
{ left = 0; };
}
MoveToPosition(tooltip, left, top);
tooltip.style.visibility = "visible";
}
}
function HideTip(tooltipID)
{
if (tooltipTimer)
{
clearTimeout(tooltipTimer);
tooltipTimer = 0;
}
var tooltip;
if (document.getElementById)
{ tooltip = document.getElementById(tooltipID); }
else if (document.all)
{ tooltip = eval("document.all['" + tooltipID + "']"); }
if (tooltip)
{ tooltip.style.visibility = "hidden"; }
}
//
// Blockquote fix for IE
// ____________________________________________________________________________
function NDOnLoad()
{
if (browserVer == "IE6")
{
var scrollboxes = document.getElementsByTagName('blockquote');
if (scrollboxes.item(0))
{
NDDoResize();
window.onresize=NDOnResize;
};
};
};
var resizeTimer = 0;
function NDOnResize()
{
if (resizeTimer != 0)
{ clearTimeout(resizeTimer); };
resizeTimer = setTimeout(NDDoResize, 250);
};
function NDDoResize()
{
var scrollboxes = document.getElementsByTagName('blockquote');
var i;
var item;
i = 0;
while (item = scrollboxes.item(i))
{
item.style.width = 100;
i++;
};
i = 0;
while (item = scrollboxes.item(i))
{
item.style.width = item.parentNode.offsetWidth;
i++;
};
clearTimeout(resizeTimer);
resizeTimer = 0;
}
/* ________________________________________________________________________________________________________
Class: SearchPanel
________________________________________________________________________________________________________
A class handling everything associated with the search panel.
Parameters:
name - The name of the global variable that will be storing this instance. Is needed to be able to set timeouts.
mode - The mode the search is going to work in. Pass <NaturalDocs::Builder::Base->CommandLineOption()>, so the
value will be something like "HTML" or "FramedHTML".
________________________________________________________________________________________________________
*/
function SearchPanel(name, mode, resultsPath)
{
if (!name || !mode || !resultsPath)
{ alert("Incorrect parameters to SearchPanel."); };
// Group: Variables
// ________________________________________________________________________
/*
var: name
The name of the global variable that will be storing this instance of the class.
*/
this.name = name;
/*
var: mode
The mode the search is going to work in, such as "HTML" or "FramedHTML".
*/
this.mode = mode;
/*
var: resultsPath
The relative path from the current HTML page to the results page directory.
*/
this.resultsPath = resultsPath;
/*
var: keyTimeout
The timeout used between a keystroke and when a search is performed.
*/
this.keyTimeout = 0;
/*
var: keyTimeoutLength
The length of <keyTimeout> in thousandths of a second.
*/
this.keyTimeoutLength = 500;
/*
var: lastSearchValue
The last search string executed, or an empty string if none.
*/
this.lastSearchValue = "";
/*
var: lastResultsPage
The last results page. The value is only relevant if <lastSearchValue> is set.
*/
this.lastResultsPage = "";
/*
var: deactivateTimeout
The timeout used between when a control is deactivated and when the entire panel is deactivated. Is necessary
because a control may be deactivated in favor of another control in the same panel, in which case it should stay
active.
*/
this.deactivateTimout = 0;
/*
var: deactivateTimeoutLength
The length of <deactivateTimeout> in thousandths of a second.
*/
this.deactivateTimeoutLength = 200;
// Group: DOM Elements
// ________________________________________________________________________
// Function: DOMSearchField
this.DOMSearchField = function()
{ return document.getElementById("MSearchField"); };
// Function: DOMSearchType
this.DOMSearchType = function()
{ return document.getElementById("MSearchType"); };
// Function: DOMPopupSearchResults
this.DOMPopupSearchResults = function()
{ return document.getElementById("MSearchResults"); };
// Function: DOMPopupSearchResultsWindow
this.DOMPopupSearchResultsWindow = function()
{ return document.getElementById("MSearchResultsWindow"); };
// Function: DOMSearchPanel
this.DOMSearchPanel = function()
{ return document.getElementById("MSearchPanel"); };
// Group: Event Handlers
// ________________________________________________________________________
/*
Function: OnSearchFieldFocus
Called when focus is added or removed from the search field.
*/
this.OnSearchFieldFocus = function(isActive)
{
this.Activate(isActive);
};
/*
Function: OnSearchFieldChange
Called when the content of the search field is changed.
*/
this.OnSearchFieldChange = function()
{
if (this.keyTimeout)
{
clearTimeout(this.keyTimeout);
this.keyTimeout = 0;
};
var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
if (searchValue != this.lastSearchValue)
{
if (searchValue != "")
{
this.keyTimeout = setTimeout(this.name + ".Search()", this.keyTimeoutLength);
}
else
{
if (this.mode == "HTML")
{ this.DOMPopupSearchResultsWindow().style.display = "none"; };
this.lastSearchValue = "";
};
};
};
/*
Function: OnSearchTypeFocus
Called when focus is added or removed from the search type.
*/
this.OnSearchTypeFocus = function(isActive)
{
this.Activate(isActive);
};
/*
Function: OnSearchTypeChange
Called when the search type is changed.
*/
this.OnSearchTypeChange = function()
{
var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
if (searchValue != "")
{
this.Search();
};
};
// Group: Action Functions
// ________________________________________________________________________
/*
Function: CloseResultsWindow
Closes the results window.
*/
this.CloseResultsWindow = function()
{
this.DOMPopupSearchResultsWindow().style.display = "none";
this.Activate(false, true);
};
/*
Function: Search
Performs a search.
*/
this.Search = function()
{
this.keyTimeout = 0;
var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
var searchTopic = this.DOMSearchType().value;
var pageExtension = searchValue.substr(0,1);
if (pageExtension.match(/^[a-z]/i))
{ pageExtension = pageExtension.toUpperCase(); }
else if (pageExtension.match(/^[0-9]/))
{ pageExtension = 'Numbers'; }
else
{ pageExtension = "Symbols"; };
var resultsPage;
var resultsPageWithSearch;
var hasResultsPage;
// indexSectionsWithContent is defined in searchdata.js
if (indexSectionsWithContent[searchTopic][pageExtension] == true)
{
resultsPage = this.resultsPath + '/' + searchTopic + pageExtension + '.html';
resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
hasResultsPage = true;
}
else
{
resultsPage = this.resultsPath + '/NoResults.html';
resultsPageWithSearch = resultsPage;
hasResultsPage = false;
};
var resultsFrame;
if (this.mode == "HTML")
{ resultsFrame = window.frames.MSearchResults; }
else if (this.mode == "FramedHTML")
{ resultsFrame = window.top.frames['Content']; };
if (resultsPage != this.lastResultsPage ||
// Bug in IE. If everything becomes hidden in a run, none of them will be able to be reshown in the next for some
// reason. It counts the right number of results, and you can even read the display as "block" after setting it, but it
// just doesn't work in IE 6 or IE 7. So if we're on the right page but the previous search had no results, reload the
// page anyway to get around the bug.
(browserType == "IE" && hasResultsPage && resultsFrame.searchResults.lastMatchCount == 0) )
{
resultsFrame.location.href = resultsPageWithSearch;
}
// So if the results page is right and there's no IE bug, reperform the search on the existing page. We have to check if there
// are results because NoResults.html doesn't have any JavaScript, and it would be useless to do anything on that page even
// if it did.
else if (hasResultsPage)
{
// We need to check if this exists in case the frame is present but didn't finish loading.
if (resultsFrame.searchResults)
{ resultsFrame.searchResults.Search(searchValue); }
// Otherwise just reload instead of waiting.
else
{ resultsFrame.location.href = resultsPageWithSearch; };
};
var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
if (this.mode == "HTML" && domPopupSearchResultsWindow.style.display != "block")
{
var domSearchType = this.DOMSearchType();
var left = GetXPosition(domSearchType);
var top = GetYPosition(domSearchType) + domSearchType.offsetHeight;
MoveToPosition(domPopupSearchResultsWindow, left, top);
domPopupSearchResultsWindow.style.display = 'block';
};
this.lastSearchValue = searchValue;
this.lastResultsPage = resultsPage;
};
// Group: Activation Functions
// Functions that handle whether the entire panel is active or not.
// ________________________________________________________________________
/*
Function: Activate
Activates or deactivates the search panel, resetting things to their default values if necessary. You can call this on every
control's OnBlur() and it will handle not deactivating the entire panel when focus is just switching between them transparently.
Parameters:
isActive - Whether you're activating or deactivating the panel.
ignoreDeactivateDelay - Set if you're positive the action will deactivate the panel and thus want to skip the delay.
*/
this.Activate = function(isActive, ignoreDeactivateDelay)
{
// We want to ignore isActive being false while the results window is open.
if (isActive || (this.mode == "HTML" && this.DOMPopupSearchResultsWindow().style.display == "block"))
{
if (this.inactivateTimeout)
{
clearTimeout(this.inactivateTimeout);
this.inactivateTimeout = 0;
};
this.DOMSearchPanel().className = 'MSearchPanelActive';
var searchField = this.DOMSearchField();
if (searchField.value == 'Search')
{ searchField.value = ""; }
}
else if (!ignoreDeactivateDelay)
{
this.inactivateTimeout = setTimeout(this.name + ".InactivateAfterTimeout()", this.inactivateTimeoutLength);
}
else
{
this.InactivateAfterTimeout();
};
};
/*
Function: InactivateAfterTimeout
Called by <inactivateTimeout>, which is set by <Activate()>. Inactivation occurs on a timeout because a control may
receive OnBlur() when focus is really transferring to another control in the search panel. In this case we don't want to
actually deactivate the panel because not only would that cause a visible flicker but it could also reset the search value.
So by doing it on a timeout instead, there's a short period where the second control's OnFocus() can cancel the deactivation.
*/
this.InactivateAfterTimeout = function()
{
this.inactivateTimeout = 0;
this.DOMSearchPanel().className = 'MSearchPanelInactive';
this.DOMSearchField().value = "Search";
this.lastSearchValue = "";
this.lastResultsPage = "";
};
};
/* ________________________________________________________________________________________________________
Class: SearchResults
_________________________________________________________________________________________________________
The class that handles everything on the search results page.
_________________________________________________________________________________________________________
*/
function SearchResults(name, mode)
{
/*
var: mode
The mode the search is going to work in, such as "HTML" or "FramedHTML".
*/
this.mode = mode;
/*
var: lastMatchCount
The number of matches from the last run of <Search()>.
*/
this.lastMatchCount = 0;
/*
Function: Toggle
Toggles the visibility of the passed element ID.
*/
this.Toggle = function(id)
{
if (this.mode == "FramedHTML")
{ return; };
var parentElement = document.getElementById(id);
var element = parentElement.firstChild;
while (element && element != parentElement)
{
if (element.nodeName == 'DIV' && element.className == 'ISubIndex')
{
if (element.style.display == 'block')
{ element.style.display = "none"; }
else
{ element.style.display = 'block'; }
};
if (element.nodeName == 'DIV' && element.hasChildNodes())
{ element = element.firstChild; }
else if (element.nextSibling)
{ element = element.nextSibling; }
else
{
do
{
element = element.parentNode;
}
while (element && element != parentElement && !element.nextSibling);
if (element && element != parentElement)
{ element = element.nextSibling; };
};
};
};
/*
Function: Search
Searches for the passed string. If there is no parameter, it takes it from the URL query.
Always returns true, since other documents may try to call it and that may or may not be possible.
*/
this.Search = function(search)
{
if (!search)
{
search = window.location.search;
search = search.substring(1); // Remove the leading ?
search = unescape(search);
};
search = search.replace(/^ +/, "");
search = search.replace(/ +$/, "");
search = search.toLowerCase();
if (search.match(/[^a-z0-9]/)) // Just a little speedup so it doesn't have to go through the below unnecessarily.
{
search = search.replace(/\_/g, "_und");
search = search.replace(/\ +/gi, "_spc");
search = search.replace(/\~/g, "_til");
search = search.replace(/\!/g, "_exc");
search = search.replace(/\@/g, "_att");
search = search.replace(/\#/g, "_num");
search = search.replace(/\$/g, "_dol");
search = search.replace(/\%/g, "_pct");
search = search.replace(/\^/g, "_car");
search = search.replace(/\&/g, "_amp");
search = search.replace(/\*/g, "_ast");
search = search.replace(/\(/g, "_lpa");
search = search.replace(/\)/g, "_rpa");
search = search.replace(/\-/g, "_min");
search = search.replace(/\+/g, "_plu");
search = search.replace(/\=/g, "_equ");
search = search.replace(/\{/g, "_lbc");
search = search.replace(/\}/g, "_rbc");
search = search.replace(/\[/g, "_lbk");
search = search.replace(/\]/g, "_rbk");
search = search.replace(/\:/g, "_col");
search = search.replace(/\;/g, "_sco");
search = search.replace(/\"/g, "_quo");
search = search.replace(/\'/g, "_apo");
search = search.replace(/\</g, "_lan");
search = search.replace(/\>/g, "_ran");
search = search.replace(/\,/g, "_com");
search = search.replace(/\./g, "_per");
search = search.replace(/\?/g, "_que");
search = search.replace(/\//g, "_sla");
search = search.replace(/[^a-z0-9\_]i/gi, "_zzz");
};
var resultRows = document.getElementsByTagName("div");
var matches = 0;
var i = 0;
while (i < resultRows.length)
{
var row = resultRows.item(i);
if (row.className == "SRResult")
{
var rowMatchName = row.id.toLowerCase();
rowMatchName = rowMatchName.replace(/^sr\d*_/, '');
if (search.length <= rowMatchName.length && rowMatchName.substr(0, search.length) == search)
{
row.style.display = "block";
matches++;
}
else
{ row.style.display = "none"; };
};
i++;
};
document.getElementById("Searching").style.display="none";
if (matches == 0)
{ document.getElementById("NoMatches").style.display="block"; }
else
{ document.getElementById("NoMatches").style.display="none"; }
this.lastMatchCount = matches;
return true;
};
};

View File

@ -0,0 +1,62 @@
var indexSectionsWithContent = {
"General": {
"Symbols": false,
"Numbers": false,
"A": false,
"B": false,
"C": false,
"D": true,
"E": false,
"F": false,
"G": false,
"H": false,
"I": false,
"J": false,
"K": false,
"L": false,
"M": false,
"N": false,
"O": false,
"P": false,
"Q": false,
"R": false,
"S": false,
"T": false,
"U": false,
"V": false,
"W": false,
"X": false,
"Y": false,
"Z": false
},
"Classes": {
"Symbols": false,
"Numbers": false,
"A": false,
"B": false,
"C": false,
"D": false,
"E": false,
"F": false,
"G": false,
"H": false,
"I": false,
"J": false,
"K": false,
"L": false,
"M": false,
"N": false,
"O": false,
"P": false,
"Q": false,
"R": false,
"S": false,
"T": true,
"U": false,
"V": false,
"W": false,
"X": false,
"Y": false,
"Z": false
}
}

View File

@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script></head><body class="PopupSearchResultsPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 12-07-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_TBeepConnection><div class=IEntry><a href="../files3/beepconnection-pas.html#TBeepConnection" target=_parent class=ISymbol>TBeepConnection</a></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults", "HTML");
searchResults.Search();
--></script></div><script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script></head><body class="PopupSearchResultsPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 12-07-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_Do_spcall_spcthe_spcmain_spcfuncionts_spcand_spccontext_spcfunctions_spcin_spchere><div class=IEntry><a href="../files3/beeppeer_old-pas.html#this_is_Vortex_Context_module.Do_all_the_main_funcionts_and_context_functions_in_here" target=_parent class=ISymbol>Do all the main funcionts and context functions in here</a>, <span class=IParent>this is Vortex Context module</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults", "HTML");
searchResults.Search();
--></script></div><script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script></head><body class="PopupSearchResultsPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 12-07-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_TBeepConnection><div class=IEntry><a href="../files3/beepconnection-pas.html#TBeepConnection" target=_parent class=ISymbol>TBeepConnection</a></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults", "HTML");
searchResults.Search();
--></script></div><script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script></head><body class="PopupSearchResultsPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 12-07-2007 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Index><div class=SRStatus id=NoMatches>No Matches</div></div><script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

View File

@ -0,0 +1,759 @@
/*
IMPORTANT: If you're editing this file in the output directory of one of
your projects, your changes will be overwritten the next time you run
Natural Docs. Instead, copy this file to your project directory, make your
changes, and you can use it with -s. Even better would be to make a CSS
file in your project directory with only your changes, which you can then
use with -s [original style] [your changes].
On the other hand, if you're editing this file in the Natural Docs styles
directory, the changes will automatically be applied to all your projects
that use this style the next time Natural Docs is run on them.
This file is part of Natural Docs, which is Copyright (C) 2003-2005 Greg Valure
Natural Docs is licensed under the GPL
*/
body {
font: 10pt Verdana, Arial, sans-serif;
color: #000000;
margin: 0; padding: 0;
}
.ContentPage,
.IndexPage,
.FramedMenuPage {
background-color: #E8E8E8;
}
.FramedContentPage,
.FramedIndexPage,
.FramedSearchResultsPage,
.PopupSearchResultsPage {
background-color: #FFFFFF;
}
a:link,
a:visited { color: #900000; text-decoration: none }
a:hover { color: #900000; text-decoration: underline }
a:active { color: #FF0000; text-decoration: underline }
td {
vertical-align: top }
img { border: 0; }
/*
Comment out this line to use web-style paragraphs (blank line between
paragraphs, no indent) instead of print-style paragraphs (no blank line,
indented.)
*/
p {
text-indent: 5ex; margin: 0 }
/* Can't use something like display: none or it won't break. */
.HB {
font-size: 1px;
visibility: hidden;
}
/* Blockquotes are used as containers for things that may need to scroll. */
blockquote {
padding: 0;
margin: 0;
overflow: auto;
}
.Firefox1 blockquote {
padding-bottom: .5em;
}
/* Turn off scrolling when printing. */
@media print {
blockquote {
overflow: visible;
}
.IE blockquote {
width: auto;
}
}
#Menu {
font-size: 9pt;
padding: 10px 0 0 0;
}
.ContentPage #Menu,
.IndexPage #Menu {
position: absolute;
top: 0;
left: 0;
width: 31ex;
overflow: hidden;
}
.ContentPage .Firefox #Menu,
.IndexPage .Firefox #Menu {
width: 27ex;
}
.MTitle {
font-size: 16pt; font-weight: bold; font-variant: small-caps;
text-align: center;
padding: 5px 10px 15px 10px;
border-bottom: 1px dotted #000000;
margin-bottom: 15px }
.MSubTitle {
font-size: 9pt; font-weight: normal; font-variant: normal;
margin-top: 1ex; margin-bottom: 5px }
.MEntry a:link,
.MEntry a:hover,
.MEntry a:visited { color: #606060; margin-right: 0 }
.MEntry a:active { color: #A00000; margin-right: 0 }
.MGroup {
font-variant: small-caps; font-weight: bold;
margin: 1em 0 1em 10px;
}
.MGroupContent {
font-variant: normal; font-weight: normal }
.MGroup a:link,
.MGroup a:hover,
.MGroup a:visited { color: #545454; margin-right: 10px }
.MGroup a:active { color: #A00000; margin-right: 10px }
.MFile,
.MText,
.MLink,
.MIndex {
padding: 1px 17px 2px 10px;
margin: .25em 0 .25em 0;
}
.MText {
font-size: 8pt; font-style: italic }
.MLink {
font-style: italic }
#MSelected {
color: #000000; background-color: #FFFFFF;
/* Replace padding with border. */
padding: 0 10px 0 10px;
border-width: 1px 2px 2px 0; border-style: solid; border-color: #000000;
margin-right: 5px;
}
/* Close off the left side when its in a group. */
.MGroup #MSelected {
padding-left: 9px; border-left-width: 1px }
/* A treat for Mozilla users. Blatantly non-standard. Will be replaced with CSS 3 attributes when finalized/supported. */
.Firefox #MSelected {
-moz-border-radius-topright: 10px;
-moz-border-radius-bottomright: 10px }
.Firefox .MGroup #MSelected {
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomleft: 10px }
#MSearchPanel {
padding: 0px 6px;
margin: .25em 0;
}
#MSearchField {
font: italic 9pt Verdana, sans-serif;
color: #606060;
background-color: #E8E8E8;
border: none;
padding: 2px 4px;
width: 100%;
}
/* Only Opera gets it right. */
.Firefox #MSearchField,
.IE #MSearchField,
.Safari #MSearchField {
width: 94%;
}
.Opera9 #MSearchField,
.Konqueror #MSearchField {
width: 97%;
}
.FramedMenuPage .Firefox #MSearchField,
.FramedMenuPage .Safari #MSearchField,
.FramedMenuPage .Konqueror #MSearchField {
width: 98%;
}
/* Firefox doesn't do this right in frames without #MSearchPanel added on.
It's presence doesn't hurt anything other browsers. */
#MSearchPanel.MSearchPanelInactive:hover #MSearchField {
background-color: #FFFFFF;
border: 1px solid #C0C0C0;
padding: 1px 3px;
}
.MSearchPanelActive #MSearchField {
background-color: #FFFFFF;
border: 1px solid #C0C0C0;
font-style: normal;
padding: 1px 3px;
}
#MSearchType {
visibility: hidden;
font: 8pt Verdana, sans-serif;
width: 98%;
padding: 0;
border: 1px solid #C0C0C0;
}
.MSearchPanelActive #MSearchType,
/* As mentioned above, Firefox doesn't do this right in frames without #MSearchPanel added on. */
#MSearchPanel.MSearchPanelInactive:hover #MSearchType,
#MSearchType:focus {
visibility: visible;
color: #606060;
}
#MSearchType option#MSearchEverything {
font-weight: bold;
}
.Opera8 .MSearchPanelInactive:hover,
.Opera8 .MSearchPanelActive {
margin-left: -1px;
}
iframe#MSearchResults {
width: 60ex;
height: 15em;
}
#MSearchResultsWindow {
display: none;
position: absolute;
left: 0; top: 0;
border: 1px solid #000000;
background-color: #E8E8E8;
}
#MSearchResultsWindowClose {
font-weight: bold;
font-size: 8pt;
display: block;
padding: 2px 5px;
}
#MSearchResultsWindowClose:link,
#MSearchResultsWindowClose:visited {
color: #000000;
text-decoration: none;
}
#MSearchResultsWindowClose:active,
#MSearchResultsWindowClose:hover {
color: #800000;
text-decoration: none;
background-color: #F4F4F4;
}
#Content {
padding-bottom: 15px;
}
.ContentPage #Content {
border-width: 0 0 1px 1px;
border-style: solid;
border-color: #000000;
background-color: #FFFFFF;
font-size: 9pt; /* To make 31ex match the menu's 31ex. */
margin-left: 31ex;
}
.ContentPage .Firefox #Content {
margin-left: 27ex;
}
.CTopic {
font-size: 10pt;
margin-bottom: 3em;
}
.CTitle {
font-size: 12pt; font-weight: bold;
border-width: 0 0 1px 0; border-style: solid; border-color: #A0A0A0;
margin: 0 15px .5em 15px }
.CGroup .CTitle {
font-size: 16pt; font-variant: small-caps;
padding-left: 15px; padding-right: 15px;
border-width: 0 0 2px 0; border-color: #000000;
margin-left: 0; margin-right: 0 }
.CClass .CTitle,
.CInterface .CTitle,
.CDatabase .CTitle,
.CDatabaseTable .CTitle,
.CSection .CTitle {
font-size: 18pt;
color: #FFFFFF; background-color: #A0A0A0;
padding: 10px 15px 10px 15px;
border-width: 2px 0; border-color: #000000;
margin-left: 0; margin-right: 0 }
#MainTopic .CTitle {
font-size: 20pt;
color: #FFFFFF; background-color: #7070C0;
padding: 10px 15px 10px 15px;
border-width: 0 0 3px 0; border-color: #000000;
margin-left: 0; margin-right: 0 }
.CBody {
margin-left: 15px; margin-right: 15px }
.CToolTip {
position: absolute; visibility: hidden;
left: 0; top: 0;
background-color: #FFFFE0;
padding: 5px;
border-width: 1px 2px 2px 1px; border-style: solid; border-color: #000000;
font-size: 8pt;
}
.Opera .CToolTip {
max-width: 98%;
}
/* Scrollbars would be useless. */
.CToolTip blockquote {
overflow: hidden;
}
.IE6 .CToolTip blockquote {
overflow: visible;
}
.CHeading {
font-weight: bold; font-size: 10pt;
margin: 1.5em 0 .5em 0;
}
.CBody pre {
font: 10pt "Courier New", Courier, monospace;
margin: 1em 0;
}
.CBody ul {
/* I don't know why CBody's margin doesn't apply, but it's consistent across browsers so whatever.
Reapply it here as padding. */
padding-left: 15px; padding-right: 15px;
margin: .5em 5ex .5em 5ex;
}
.CDescriptionList {
margin: .5em 5ex 0 5ex }
.CDLEntry {
font: 10pt "Courier New", Courier, monospace; color: #808080;
padding-bottom: .25em;
white-space: nowrap }
.CDLDescription {
font-size: 10pt; /* For browsers that don't inherit correctly, like Opera 5. */
padding-bottom: .5em; padding-left: 5ex }
.CTopic img {
text-align: center;
display: block;
margin: 1em auto;
}
.CImageCaption {
font-variant: small-caps;
font-size: 8pt;
color: #808080;
text-align: center;
position: relative;
top: 1em;
}
.CImageLink {
color: #808080;
font-style: italic;
}
a.CImageLink:link,
a.CImageLink:visited,
a.CImageLink:hover { color: #808080 }
.Prototype {
font: 10pt "Courier New", Courier, monospace;
padding: 5px 3ex;
border-width: 1px; border-style: solid;
margin: 0 5ex 1.5em 5ex;
}
.Prototype td {
font-size: 10pt;
}
.PDefaultValue,
.PDefaultValuePrefix,
.PTypePrefix {
color: #8F8F8F;
}
.PTypePrefix {
text-align: right;
}
.PAfterParameters {
vertical-align: bottom;
}
.IE .Prototype table {
padding: 0;
}
.CFunction .Prototype {
background-color: #F4F4F4; border-color: #D0D0D0 }
.CProperty .Prototype {
background-color: #F4F4FF; border-color: #C0C0E8 }
.CVariable .Prototype {
background-color: #FFFFF0; border-color: #E0E0A0 }
.CDatabaseIndex .Prototype,
.CConstant .Prototype {
background-color: #D0D0D0; border-color: #000000 }
.CType .Prototype,
.CClass .Prototype,
.CInterface .Prototype {
background-color: #FAF0F0; border-color: #E0B0B0;
}
.CDatabaseTrigger .Prototype,
.CEvent .Prototype,
.CDelegate .Prototype {
background-color: #F0FCF0; border-color: #B8E4B8 }
.CToolTip .Prototype {
margin: 0 0 .5em 0;
white-space: nowrap;
}
.Summary {
margin: 1.5em 5ex 0 5ex }
.STitle {
font-size: 12pt; font-weight: bold;
margin-bottom: .5em }
.SBorder {
background-color: #FFFFF0;
padding: 15px;
border: 1px solid #C0C060 }
/* In a frame IE 6 will make them too long unless you set the width to 100%. Without frames it will be correct without a width
or slightly too long (but not enough to scroll) with a width. This arbitrary weirdness simply astounds me. IE 7 has the same
problem with frames, haven't tested it without. */
.FramedContentPage .IE .SBorder {
width: 100% }
/* A treat for Mozilla users. Blatantly non-standard. Will be replaced with CSS 3 attributes when finalized/supported. */
.Firefox .SBorder {
-moz-border-radius: 20px }
.STable {
font-size: 9pt; width: 100% }
.SEntry {
width: 30% }
.SDescription {
width: 70% }
.SMarked {
background-color: #F8F8D8 }
.SDescription { padding-left: 2ex }
.SIndent1 .SEntry { padding-left: 1.5ex } .SIndent1 .SDescription { padding-left: 3.5ex }
.SIndent2 .SEntry { padding-left: 3.0ex } .SIndent2 .SDescription { padding-left: 5.0ex }
.SIndent3 .SEntry { padding-left: 4.5ex } .SIndent3 .SDescription { padding-left: 6.5ex }
.SIndent4 .SEntry { padding-left: 6.0ex } .SIndent4 .SDescription { padding-left: 8.0ex }
.SIndent5 .SEntry { padding-left: 7.5ex } .SIndent5 .SDescription { padding-left: 9.5ex }
.SDescription a { color: #800000}
.SDescription a:active { color: #A00000 }
.SGroup td {
padding-top: .5em; padding-bottom: .25em }
.SGroup .SEntry {
font-weight: bold; font-variant: small-caps }
.SGroup .SEntry a { color: #800000 }
.SGroup .SEntry a:active { color: #F00000 }
.SMain td,
.SClass td,
.SDatabase td,
.SDatabaseTable td,
.SSection td {
font-size: 10pt;
padding-bottom: .25em }
.SClass td,
.SDatabase td,
.SDatabaseTable td,
.SSection td {
padding-top: 1em }
.SMain .SEntry,
.SClass .SEntry,
.SDatabase .SEntry,
.SDatabaseTable .SEntry,
.SSection .SEntry {
font-weight: bold;
}
.SMain .SEntry a,
.SClass .SEntry a,
.SDatabase .SEntry a,
.SDatabaseTable .SEntry a,
.SSection .SEntry a { color: #000000 }
.SMain .SEntry a:active,
.SClass .SEntry a:active,
.SDatabase .SEntry a:active,
.SDatabaseTable .SEntry a:active,
.SSection .SEntry a:active { color: #A00000 }
.ClassHierarchy {
margin: 0 15px 1em 15px }
.CHEntry {
border-width: 1px 2px 2px 1px; border-style: solid; border-color: #A0A0A0;
margin-bottom: 3px;
padding: 2px 2ex;
font-size: 10pt;
background-color: #F4F4F4; color: #606060;
}
.Firefox .CHEntry {
-moz-border-radius: 4px;
}
.CHCurrent .CHEntry {
font-weight: bold;
border-color: #000000;
color: #000000;
}
.CHChildNote .CHEntry {
font-style: italic;
font-size: 8pt;
}
.CHIndent {
margin-left: 3ex;
}
.CHEntry a:link,
.CHEntry a:visited,
.CHEntry a:hover {
color: #606060;
}
.CHEntry a:active {
color: #800000;
}
#Index {
background-color: #FFFFFF;
}
/* As opposed to .PopupSearchResultsPage #Index */
.IndexPage #Index,
.FramedIndexPage #Index,
.FramedSearchResultsPage #Index {
padding: 15px;
}
.IndexPage #Index {
border-width: 0 0 1px 1px;
border-style: solid;
border-color: #000000;
font-size: 9pt; /* To make 27ex match the menu's 27ex. */
margin-left: 27ex;
}
.IPageTitle {
font-size: 20pt; font-weight: bold;
color: #FFFFFF; background-color: #7070C0;
padding: 10px 15px 10px 15px;
border-width: 0 0 3px 0; border-color: #000000; border-style: solid;
margin: -15px -15px 0 -15px }
.FramedSearchResultsPage .IPageTitle {
margin-bottom: 15px;
}
.INavigationBar {
font-size: 10pt;
text-align: center;
background-color: #FFFFF0;
padding: 5px;
border-bottom: solid 1px black;
margin: 0 -15px 15px -15px;
}
.INavigationBar a {
font-weight: bold }
.IHeading {
font-size: 16pt; font-weight: bold;
padding: 2.5em 0 .5em 0;
text-align: center;
width: 3.5ex;
}
#IFirstHeading {
padding-top: 0;
}
.IEntry {
font-size: 10pt;
padding-left: 1ex;
}
.PopupSearchResultsPage .IEntry {
font-size: 8pt;
padding: 1px 5px;
}
.PopupSearchResultsPage .Opera9 .IEntry,
.FramedSearchResultsPage .Opera9 .IEntry {
text-align: left;
}
.FramedSearchResultsPage .IEntry {
padding: 0;
}
.ISubIndex {
padding-left: 3ex; padding-bottom: .5em }
.PopupSearchResultsPage .ISubIndex {
display: none;
}
/* While it may cause some entries to look like links when they aren't, I found it's much easier to read the
index if everything's the same color. */
.ISymbol {
font-weight: bold; color: #900000 }
.IndexPage .ISymbolPrefix,
.FramedIndexPage .ISymbolPrefix {
font-size: 10pt;
text-align: right;
color: #C47C7C;
background-color: #F8F8F8;
border-right: 3px solid #E0E0E0;
border-left: 1px solid #E0E0E0;
padding: 0 1px 0 2px;
}
.PopupSearchResultsPage .ISymbolPrefix,
.FramedSearchResultsPage .ISymbolPrefix {
color: #900000;
}
.PopupSearchResultsPage .ISymbolPrefix {
font-size: 8pt;
}
.IndexPage #IFirstSymbolPrefix,
.FramedIndexPage #IFirstSymbolPrefix {
border-top: 1px solid #E0E0E0;
}
.IndexPage #ILastSymbolPrefix,
.FramedIndexPage #ILastSymbolPrefix {
border-bottom: 1px solid #E0E0E0;
}
.IndexPage #IOnlySymbolPrefix,
.FramedIndexPage #IOnlySymbolPrefix {
border-top: 1px solid #E0E0E0;
border-bottom: 1px solid #E0E0E0;
}
a.IParent,
a.IFile {
display: block;
}
.PopupSearchResultsPage .SRStatus {
padding: 2px 5px;
font-size: 8pt;
font-style: italic;
}
.FramedSearchResultsPage .SRStatus {
font-size: 10pt;
font-style: italic;
}
.SRResult {
display: none;
}
#Footer {
font-size: 8pt;
color: #989898;
text-align: right;
}
#Footer p {
text-indent: 0;
margin-bottom: .5em;
}
.ContentPage #Footer,
.IndexPage #Footer {
text-align: right;
margin: 2px;
}
.FramedMenuPage #Footer {
text-align: center;
margin: 5em 10px 10px 10px;
padding-top: 1em;
border-top: 1px solid #C8C8C8;
}
#Footer a:link,
#Footer a:hover,
#Footer a:visited { color: #989898 }
#Footer a:active { color: #A00000 }

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
(*******************************************************************************
* BEEP_Client.lpr: Client test application for BeepFp
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* This is an example of using TBeepClient class
******************************************************************************)
program BEEP_Client;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Interfaces, Forms, LResources, clientmain,
beepchannel, beepchannelpool, beepclient, beepconnection,
beepcontext, beepframe, beeplistener, beepobject, beeppeer,
beepprofile, beeputils;
{$IFDEF WINDOWS}{$R BEEP_Client.rc}{$ENDIF}
begin
{$I BEEP_Client.lrs}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "BEEP_Client.manifest"
MAINICON ICON "BEEP_Client.ico"

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,523 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Title Value="BEEP_Listen"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="56">
<Unit0>
<Filename Value="BEEP_Listen.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BEEP_Listen"/>
<CursorPos X="49" Y="7"/>
<TopLine Value="1"/>
<EditorIndex Value="4"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="clientmain.pas"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="clientmain"/>
<CursorPos X="55" Y="147"/>
<TopLine Value="158"/>
<UsageCount Value="161"/>
</Unit1>
<Unit2>
<Filename Value="../beepclient.pas"/>
<UnitName Value="BeepClient"/>
<CursorPos X="17" Y="70"/>
<TopLine Value="54"/>
<UsageCount Value="118"/>
</Unit2>
<Unit3>
<Filename Value="../../lazvortex/test/vortex_simple_client.lpr"/>
<UnitName Value="vortex_simple_client"/>
<CursorPos X="26" Y="106"/>
<TopLine Value="94"/>
<UsageCount Value="36"/>
</Unit3>
<Unit4>
<Filename Value="../beepserver.pas"/>
<UnitName Value="BeepServer"/>
<CursorPos X="80" Y="58"/>
<TopLine Value="41"/>
<UsageCount Value="55"/>
</Unit4>
<Unit5>
<Filename Value="../beeppeer.pas"/>
<UnitName Value="BeepPeer"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="168"/>
</Unit5>
<Unit6>
<Filename Value="listenermain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ListenerMain"/>
<CursorPos X="9" Y="227"/>
<TopLine Value="216"/>
<EditorIndex Value="0"/>
<UsageCount Value="313"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="../beepprofile.pas"/>
<UnitName Value="BeepProfile"/>
<CursorPos X="5" Y="35"/>
<TopLine Value="1"/>
<UsageCount Value="128"/>
</Unit7>
<Unit8>
<Filename Value="../beepprofilebase.pas"/>
<UnitName Value="BeepProfileBase"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="62"/>
</Unit8>
<Unit9>
<Filename Value="../beeputils.pas"/>
<UnitName Value="BeepUtils"/>
<CursorPos X="13" Y="79"/>
<TopLine Value="32"/>
<UsageCount Value="129"/>
</Unit9>
<Unit10>
<Filename Value="../beepchannelpool.pas"/>
<UnitName Value="BeepChannelPool"/>
<CursorPos X="1" Y="25"/>
<TopLine Value="2"/>
<UsageCount Value="17"/>
</Unit10>
<Unit11>
<Filename Value="../beepconnection.pas"/>
<UnitName Value="BeepConnection"/>
<CursorPos X="34" Y="358"/>
<TopLine Value="307"/>
<UsageCount Value="84"/>
</Unit11>
<Unit12>
<Filename Value="../beepcontext.pas"/>
<UnitName Value="BeepContext"/>
<CursorPos X="69" Y="18"/>
<TopLine Value="18"/>
<UsageCount Value="84"/>
</Unit12>
<Unit13>
<Filename Value="../beepchannel.pas"/>
<UnitName Value="BeepChannel"/>
<CursorPos X="1" Y="56"/>
<TopLine Value="38"/>
<UsageCount Value="16"/>
</Unit13>
<Unit14>
<Filename Value="../beepframe.pas"/>
<UnitName Value="BeepFrame"/>
<CursorPos X="69" Y="18"/>
<TopLine Value="1"/>
<UsageCount Value="44"/>
</Unit14>
<Unit15>
<Filename Value="../beeplistener.pas"/>
<UnitName Value="BeepListener"/>
<CursorPos X="65" Y="126"/>
<TopLine Value="115"/>
<UsageCount Value="2"/>
<Bookmarks Count="2">
<Item0 X="26" Y="130" ID="1"/>
<Item1 X="15" Y="270" ID="2"/>
</Bookmarks>
</Unit15>
<Unit16>
<Filename Value="../lazbeep/beeputils.pas"/>
<UnitName Value="BeepUtils"/>
<CursorPos X="42" Y="38"/>
<TopLine Value="16"/>
<UsageCount Value="265"/>
</Unit16>
<Unit17>
<Filename Value="../lazbeep/beepchannel.pas"/>
<UnitName Value="BeepChannel"/>
<CursorPos X="49" Y="450"/>
<TopLine Value="432"/>
<UsageCount Value="265"/>
</Unit17>
<Unit18>
<Filename Value="../lazbeep/beepclient.pas"/>
<UnitName Value="BeepClient"/>
<CursorPos X="62" Y="106"/>
<TopLine Value="81"/>
<UsageCount Value="63"/>
</Unit18>
<Unit19>
<Filename Value="../lazbeep/beepconnection.pas"/>
<UnitName Value="BeepConnection"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="265"/>
<Bookmarks Count="3">
<Item0 X="3" Y="355" ID="1"/>
<Item1 X="3" Y="424" ID="2"/>
<Item2 X="3" Y="560" ID="3"/>
</Bookmarks>
</Unit19>
<Unit20>
<Filename Value="../lazbeep/beepcontext.pas"/>
<UnitName Value="BeepContext"/>
<CursorPos X="37" Y="31"/>
<TopLine Value="14"/>
<UsageCount Value="265"/>
</Unit20>
<Unit21>
<Filename Value="../lazbeep/beepframe.pas"/>
<UnitName Value="BeepFrame"/>
<CursorPos X="20" Y="31"/>
<TopLine Value="197"/>
<UsageCount Value="265"/>
</Unit21>
<Unit22>
<Filename Value="../lazbeep/beeplistener.pas"/>
<UnitName Value="BeepListener"/>
<CursorPos X="31" Y="475"/>
<TopLine Value="449"/>
<UsageCount Value="265"/>
</Unit22>
<Unit23>
<Filename Value="../lazbeep/beeppeer.pas"/>
<UnitName Value="BeepPeer"/>
<CursorPos X="32" Y="356"/>
<TopLine Value="346"/>
<UsageCount Value="265"/>
</Unit23>
<Unit24>
<Filename Value="../lazbeep/beepprofile.pas"/>
<UnitName Value="BeepProfile"/>
<CursorPos X="3" Y="334"/>
<TopLine Value="315"/>
<UsageCount Value="265"/>
</Unit24>
<Unit25>
<Filename Value="../lazbeep/beepserver.pas"/>
<UnitName Value="BeepServer"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="265"/>
</Unit25>
<Unit26>
<Filename Value="../axl/axl.pas"/>
<UnitName Value="axl"/>
<UsageCount Value="265"/>
</Unit26>
<Unit27>
<Filename Value="../vortex/vortex.pas"/>
<UnitName Value="Vortex"/>
<CursorPos X="18" Y="160"/>
<TopLine Value="134"/>
<UsageCount Value="265"/>
</Unit27>
<Unit28>
<Filename Value="../vortex/vortex_connection.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="30"/>
<UsageCount Value="3"/>
</Unit28>
<Unit29>
<Filename Value="../vortex/vortex_types.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="995"/>
<UsageCount Value="3"/>
</Unit29>
<Unit30>
<Filename Value="../lazbeep/beepobject.pas"/>
<UnitName Value="BeepObject"/>
<CursorPos X="1" Y="67"/>
<TopLine Value="1"/>
<UsageCount Value="64"/>
</Unit30>
<Unit31>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/packages/fcl-base/src/syncobjs.pp"/>
<UnitName Value="syncobjs"/>
<CursorPos X="3" Y="113"/>
<TopLine Value="110"/>
<UsageCount Value="6"/>
</Unit31>
<Unit32>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/linux/sysosh.inc"/>
<CursorPos X="3" Y="28"/>
<TopLine Value="1"/>
<UsageCount Value="6"/>
</Unit32>
<Unit33>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/inc/threadh.inc"/>
<CursorPos X="5" Y="71"/>
<TopLine Value="47"/>
<UsageCount Value="6"/>
</Unit33>
<Unit34>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/inc/thread.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="6"/>
</Unit34>
<Unit35>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/unix/cthreads.pp"/>
<UnitName Value="cthreads"/>
<CursorPos X="11" Y="72"/>
<TopLine Value="48"/>
<UsageCount Value="6"/>
</Unit35>
<Unit36>
<Filename Value="BEEP_Client.lrs"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit36>
<Unit37>
<Filename Value="../../../lazarus_sw/lcl/include/control.inc"/>
<CursorPos X="1" Y="2228"/>
<TopLine Value="2204"/>
<UsageCount Value="10"/>
</Unit37>
<Unit38>
<Filename Value="../../../lazarus_sw/lcl/include/buttoncontrol.inc"/>
<CursorPos X="1" Y="73"/>
<TopLine Value="49"/>
<UsageCount Value="10"/>
</Unit38>
<Unit39>
<Filename Value="../../../lazarus_sw/lcl/include/buttons.inc"/>
<CursorPos X="1" Y="332"/>
<TopLine Value="288"/>
<UsageCount Value="10"/>
</Unit39>
<Unit40>
<Filename Value="../lazbeep/beepchannelpool.pas"/>
<UnitName Value="BeepChannelPool"/>
<CursorPos X="60" Y="196"/>
<TopLine Value="171"/>
<UsageCount Value="10"/>
</Unit40>
<Unit41>
<Filename Value="../beepfp/beeputils.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beeputils"/>
<UsageCount Value="21"/>
</Unit41>
<Unit42>
<Filename Value="../beepfp/beepchannel.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beepchannel"/>
<UsageCount Value="21"/>
</Unit42>
<Unit43>
<Filename Value="../beepfp/beepchannelpool.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beepchannelpool"/>
<UsageCount Value="21"/>
</Unit43>
<Unit44>
<Filename Value="../beepfp/beepclient_old.pas"/>
<UnitName Value="beepclient_old"/>
<UsageCount Value="20"/>
</Unit44>
<Unit45>
<Filename Value="../beepfp/beepclient.pas"/>
<UnitName Value="beepclient"/>
<UsageCount Value="20"/>
</Unit45>
<Unit46>
<Filename Value="../beepfp/beepconnection.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beepconnection"/>
<UsageCount Value="21"/>
</Unit46>
<Unit47>
<Filename Value="../beepfp/beepcontext.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beepcontext"/>
<UsageCount Value="21"/>
</Unit47>
<Unit48>
<Filename Value="../beepfp/beepframe.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beepframe"/>
<UsageCount Value="21"/>
</Unit48>
<Unit49>
<Filename Value="../beepfp/beeplistener.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beeplistener"/>
<UsageCount Value="21"/>
</Unit49>
<Unit50>
<Filename Value="../beepfp/beepobject.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="beepobject"/>
<UsageCount Value="21"/>
</Unit50>
<Unit51>
<Filename Value="../beepfp/beeppeer_old.pas"/>
<UnitName Value="beeppeer_old"/>
<UsageCount Value="20"/>
</Unit51>
<Unit52>
<Filename Value="../beepfp/beeppeer.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepPeer"/>
<CursorPos X="60" Y="38"/>
<TopLine Value="417"/>
<EditorIndex Value="2"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit52>
<Unit53>
<Filename Value="../beepfp/beepprofilebase.pas"/>
<UnitName Value="beepprofilebase"/>
<UsageCount Value="20"/>
</Unit53>
<Unit54>
<Filename Value="../beepfp/beepprofile.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepProfile"/>
<CursorPos X="10" Y="266"/>
<TopLine Value="236"/>
<EditorIndex Value="3"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit54>
<Unit55>
<Filename Value="../beepfp/beepserver.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepServer"/>
<CursorPos X="9" Y="38"/>
<TopLine Value="1"/>
<EditorIndex Value="1"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit55>
</Units>
<JumpHistory Count="10" HistoryIndex="9">
<Position1>
<Filename Value="listenermain.pas"/>
<Caret Line="72" Column="1" TopLine="48"/>
</Position1>
<Position2>
<Filename Value="listenermain.pas"/>
<Caret Line="57" Column="23" TopLine="48"/>
</Position2>
<Position3>
<Filename Value="BEEP_Listen.lpr"/>
<Caret Line="7" Column="6" TopLine="1"/>
</Position3>
<Position4>
<Filename Value="listenermain.pas"/>
<Caret Line="180" Column="52" TopLine="171"/>
</Position4>
<Position5>
<Filename Value="listenermain.pas"/>
<Caret Line="97" Column="3" TopLine="88"/>
</Position5>
<Position6>
<Filename Value="listenermain.pas"/>
<Caret Line="263" Column="13" TopLine="240"/>
</Position6>
<Position7>
<Filename Value="../beepfp/beepserver.pas"/>
<Caret Line="110" Column="35" TopLine="104"/>
</Position7>
<Position8>
<Filename Value="../beepfp/beepserver.pas"/>
<Caret Line="38" Column="9" TopLine="1"/>
</Position8>
<Position9>
<Filename Value="../beepfp/beeppeer.pas"/>
<Caret Line="427" Column="22" TopLine="413"/>
</Position9>
<Position10>
<Filename Value="../beepfp/beeppeer.pas"/>
<Caret Line="38" Column="60" TopLine="1"/>
</Position10>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<Libraries Value="/home/wimpie/development/lib/lazbeep/axl/;/home/wimpie/development/lib/lazbeep/vortex/"/>
<OtherUnitFiles Value="/home/wimpie/development/lib/lazbeep/;../../lazaxl/;../../lazvortex/;/home/wimpie/development/lib/lazbeep/lazbeep/;/home/wimpie/development/lib/lazbeep/axl/;/home/wimpie/development/lib/lazbeep/vortex/;/home/wimpie/development/lib/lazbeep/beepfp/"/>
<UnitOutputDirectory Value="lib"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<CStyleOperator Value="False"/>
<IncludeAssertionCode Value="True"/>
<AllowLabel Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>
<UseHeaptrc Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,48 @@
(*******************************************************************************
* BEEP_Listen.pas: Listener test application for BeepFp
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* This is an example of using the TBeepServer class
******************************************************************************)
program BEEP_Listen;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Interfaces,
Forms, ListenerMain, LResources,
beepchannel, beepchannelpool, beepconnection, beepcontext, beepframe,
beeplistener, beepobject, beeppeer, beepprofile, beepserver, beeputils;
{$IFDEF WINDOWS}{$R BEEP_Listen.rc}{$ENDIF}
begin
{$I BEEP_Listen.lrs}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "BEEP_Listen.manifest"
MAINICON ICON "BEEP_Listen.ico"

View File

@ -0,0 +1,140 @@
object Form1: TForm1
Left = 342
Height = 300
Top = 276
Width = 400
Caption = 'Form1'
ClientHeight = 300
ClientWidth = 400
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '0.9.27'
object Label1: TLabel
Left = 8
Height = 17
Top = 8
Width = 83
Caption = 'Connection'
ParentColor = False
end
object Label2: TLabel
Left = 8
Height = 17
Top = 72
Width = 69
Caption = 'Channels'
ParentColor = False
end
object Label3: TLabel
Left = 8
Height = 17
Top = 192
Width = 106
Caption = 'Channel Pools'
ParentColor = False
end
object Button1Connect: TButton
Left = 8
Height = 25
Top = 24
Width = 75
Caption = 'Connect'
OnClick = Button1ConnectClick
TabOrder = 0
end
object ButtonDisconnect: TButton
Left = 88
Height = 25
Top = 24
Width = 95
Caption = 'Disconnect'
OnClick = ButtonDisconnectClick
TabOrder = 1
end
object CheckBoxCon: TCheckBox
Left = 192
Height = 24
Top = 24
Width = 103
Caption = 'Connected'
TabOrder = 2
end
object ButtonSend: TButton
Left = 8
Height = 25
Top = 152
Width = 75
Caption = 'Send'
OnClick = ButtonSendClick
TabOrder = 3
end
object EditChannel: TEdit
Left = 8
Height = 26
Top = 120
Width = 255
TabOrder = 4
Text = 'Channel message'
end
object ButtonOpen: TButton
Left = 8
Height = 25
Top = 88
Width = 75
Caption = 'Open'
OnClick = ButtonOpenClick
TabOrder = 5
end
object ButtonClose: TButton
Left = 88
Height = 25
Top = 88
Width = 95
Caption = 'Close'
OnClick = ButtonCloseClick
TabOrder = 6
end
object SpinEditCh: TSpinEdit
Left = 192
Height = 26
Top = 88
Width = 50
MinValue = 1
TabOrder = 7
Value = 1
end
object ButtonAddPool: TButton
Left = 8
Height = 25
Top = 208
Width = 75
Caption = 'Add'
OnClick = ButtonAddPoolClick
TabOrder = 8
end
object CheckBoxPool: TCheckBox
Left = 96
Height = 24
Top = 208
Width = 108
Caption = 'Pool Ready'
TabOrder = 9
end
object ButtonSendPool: TButton
Left = 8
Height = 25
Top = 272
Width = 75
Caption = 'Send'
OnClick = ButtonSendPoolClick
TabOrder = 10
end
object EditPool: TEdit
Left = 8
Height = 26
Top = 240
Width = 255
TabOrder = 11
Text = 'Pool Message'
end
end

View File

@ -0,0 +1,36 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'V'#1#6'Height'#3','#1#3'Top'#3#20#1#5'Wid'
+'th'#3#144#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3','#1#11'ClientWidth'#3
+#144#1#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#10'LCLVer'
+'sion'#6#6'0.9.27'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#17#3'Top'#2
+#8#5'Width'#2'S'#7'Caption'#6#10'Connection'#11'ParentColor'#8#0#0#6'TLabel'
+#6'Label2'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'H'#5'Width'#2'E'#7'Caption'#6
+#8'Channels'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#8#6'Height'
+#2#17#3'Top'#3#192#0#5'Width'#2'j'#7'Caption'#6#13'Channel Pools'#11'ParentC'
+'olor'#8#0#0#7'TButton'#14'Button1Connect'#4'Left'#2#8#6'Height'#2#25#3'Top'
+#2#24#5'Width'#2'K'#7'Caption'#6#7'Connect'#7'OnClick'#7#19'Button1ConnectCl'
+'ick'#8'TabOrder'#2#0#0#0#7'TButton'#16'ButtonDisconnect'#4'Left'#2'X'#6'Hei'
+'ght'#2#25#3'Top'#2#24#5'Width'#2'_'#7'Caption'#6#10'Disconnect'#7'OnClick'#7
+#21'ButtonDisconnectClick'#8'TabOrder'#2#1#0#0#9'TCheckBox'#11'CheckBoxCon'#4
+'Left'#3#192#0#6'Height'#2#24#3'Top'#2#24#5'Width'#2'g'#7'Caption'#6#9'Conne'
+'cted'#8'TabOrder'#2#2#0#0#7'TButton'#10'ButtonSend'#4'Left'#2#8#6'Height'#2
+#25#3'Top'#3#152#0#5'Width'#2'K'#7'Caption'#6#4'Send'#7'OnClick'#7#15'Button'
+'SendClick'#8'TabOrder'#2#3#0#0#5'TEdit'#11'EditChannel'#4'Left'#2#8#6'Heigh'
+'t'#2#26#3'Top'#2'x'#5'Width'#3#255#0#8'TabOrder'#2#4#4'Text'#6#15'Channel m'
+'essage'#0#0#7'TButton'#10'ButtonOpen'#4'Left'#2#8#6'Height'#2#25#3'Top'#2'X'
+#5'Width'#2'K'#7'Caption'#6#4'Open'#7'OnClick'#7#15'ButtonOpenClick'#8'TabOr'
+'der'#2#5#0#0#7'TButton'#11'ButtonClose'#4'Left'#2'X'#6'Height'#2#25#3'Top'#2
+'X'#5'Width'#2'_'#7'Caption'#6#5'Close'#7'OnClick'#7#16'ButtonCloseClick'#8
+'TabOrder'#2#6#0#0#9'TSpinEdit'#10'SpinEditCh'#4'Left'#3#192#0#6'Height'#2#26
+#3'Top'#2'X'#5'Width'#2'2'#8'MinValue'#2#1#8'TabOrder'#2#7#5'Value'#2#1#0#0#7
+'TButton'#13'ButtonAddPool'#4'Left'#2#8#6'Height'#2#25#3'Top'#3#208#0#5'Widt'
+'h'#2'K'#7'Caption'#6#3'Add'#7'OnClick'#7#18'ButtonAddPoolClick'#8'TabOrder'
+#2#8#0#0#9'TCheckBox'#12'CheckBoxPool'#4'Left'#2'`'#6'Height'#2#24#3'Top'#3
+#208#0#5'Width'#2'l'#7'Caption'#6#10'Pool Ready'#8'TabOrder'#2#9#0#0#7'TButt'
+'on'#14'ButtonSendPool'#4'Left'#2#8#6'Height'#2#25#3'Top'#3#16#1#5'Width'#2
+'K'#7'Caption'#6#4'Send'#7'OnClick'#7#19'ButtonSendPoolClick'#8'TabOrder'#2
+#10#0#0#5'TEdit'#8'EditPool'#4'Left'#2#8#6'Height'#2#26#3'Top'#3#240#0#5'Wid'
+'th'#3#255#0#8'TabOrder'#2#11#4'Text'#6#12'Pool Message'#0#0#0
]);

View File

@ -0,0 +1,356 @@
(*******************************************************************************
* ClientMain.pas: Client test application for BeepFp
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* This is an example of using TBeepClient class
******************************************************************************)
unit clientmain;
{$mode objfpc}{$H+}
interface
uses
Classes, Spin, StdCtrls, SysUtils, FileUtil, LResources, Forms, Controls,
Graphics, Dialogs,
BeepClient, BeepProfile, BeepConnection, BeepChannel, BeepFrame,
BeepChannelPool;
type
{ TForm1 }
TForm1 = class(TForm)
ButtonClose: TButton;
ButtonOpen: TButton;
ButtonAddPool: TButton;
ButtonSend: TButton;
ButtonDisconnect: TButton;
Button1Connect: TButton;
ButtonSendPool: TButton;
CheckBoxPool: TCheckBox;
CheckBoxCon: TCheckBox;
EditChannel: TEdit;
EditPool: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
SpinEditCh: TSpinEdit;
procedure Button1ConnectClick(Sender: TObject);
procedure ButtonAddPoolClick(Sender: TObject);
procedure ButtonCloseClick(Sender: TObject);
procedure ButtonDisconnectClick(Sender: TObject);
procedure ButtonOpenClick(Sender: TObject);
procedure ButtonSendClick(Sender: TObject);
procedure ButtonSendPoolClick(Sender: TObject);
procedure Chan1Closed(ChanNum: integer);
procedure Chan1Created(ChanNum: integer);
procedure Chan1Failed(ChanNum: integer);
procedure ChanDropped(aBeepChannel: TObject);
procedure ClientConnected(Sender: TBeepConnection);
procedure ClientConnectionFailed(Sender: TBeepConnection; Reason: string);
procedure ClientDisconnected(Sender: TBeepConnection);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure PoolCreated(Sender: TObject);
procedure ProfPlainCloseChannel(aConnection: TBeepConnection;
ChanNum: integer; var Accept: boolean);
procedure ProfPlainFrameReceive(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
procedure ProfPlainStartChannel(aConnection: TBeepConnection;
ChanNum: integer; var Accept: boolean);
procedure ProfPoolFrameReceive(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
private
Client: TBeepClient;
public
{ public declarations }
end;
const
PLAIN_PROFILE = 'http://fact.aspl.es/profiles/plain_profile';
POOL_PROFILE = 'http://lazarus/beep/Plain_Profile';
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.Button1ConnectClick(Sender: TObject);
begin
Client.Connect;
end;
procedure TForm1.ButtonAddPoolClick(Sender: TObject);
var
Pool: TBeepChannelPool;
Index: integer = 0;
begin
CheckBoxPool.Checked := false;
//Add a pool
Pool := Client.AddChannelPool(POOL_PROFILE, 3, Index);
//Add event handlers
Pool.OnPoolCreated := @PoolCreated;
//Initialise
Pool.Initialise;
end;
procedure TForm1.ButtonCloseClick(Sender: TObject);
begin
Client.CloseChannel(1);
end;
procedure TForm1.ButtonDisconnectClick(Sender: TObject);
begin
Client.Disconnect;
end;
procedure TForm1.ButtonOpenClick(Sender: TObject);
var
Chan: integer;
NewChan: TBeepChannelInitiator;
begin
Chan := SpinEditCh.Value;
//Add channel
NewChan := Client.AddChannel(Client.Connection, PLAIN_PROFILE, Chan);
//Add optional event handlers
NewChan.OnCreated := @Chan1Created;
NewChan.OnFailed := @Chan1Failed;
NewChan.OnCloseNotify := @Chan1Closed;
NewChan.OnDropped := @ChanDropped;
Client.OpenChannel(Chan);
end;
procedure TForm1.ButtonSendClick(Sender: TObject);
var
ID: integer = 0;
begin
Client.SendMSG(SpinEditCh.Value, PByte(PChar(EditChannel.Text)), length(EditChannel.Text), ID);
end;
procedure TForm1.ButtonSendPoolClick(Sender: TObject);
var
Channel: TBeepChannel;
ID: integer = 0;
begin
//Get next available channel from pool
Channel := Client.GetPoolChannel(0, false);
//Send the message
Channel.SendMSG(EditPool.Text, ID);
end;
procedure TForm1.Chan1Closed(ChanNum: integer);
begin
writeln('Closed channel ' + IntToStr(ChanNum));
end;
procedure TForm1.Chan1Created(ChanNum: integer);
begin
writeln('Opened channel ' + IntToStr(ChanNum));
end;
procedure TForm1.Chan1Failed(ChanNum: integer);
begin
writeln('Failed to open channel ' + IntToStr(ChanNum));
end;
procedure TForm1.ChanDropped(aBeepChannel: TObject);
begin
//
end;
procedure TForm1.ClientConnected(Sender: TBeepConnection);
begin
CheckBoxCon.Checked := true;
writeln('Connected to '+Sender.Host+':'+Sender.Port);
end;
procedure TForm1.ClientConnectionFailed(Sender: TBeepConnection;
Reason: string);
begin
CheckBoxCon.Checked := false;
writeln('Connection failed to '+Sender.Host+':'+Sender.Port);
end;
procedure TForm1.ClientDisconnected(Sender: TBeepConnection);
begin
CheckBoxCon.Checked := false;
writeln('Disconnected from '+Sender.Host+':'+Sender.Port);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
NewProf: TBeepProfile;
begin
{ Steps to prepare a client:
* Create client
* Set host, port
* Set (optional) OnConnected, OnDisconnected, OnConnectionFailed
* Add a profile
* Set for profile (required): OnFrameReceived
* Set for profile (optional): OnStartChannel, OnCloseChannel
* Connect
With open connection:
* Add channel(s)
* Set (optional) OnCreated, OnFailed, OnClosed
* Open channel(s)
* Send MSG, RPY, ANS, ERR
* Add channel pool(s)
* Set (optional) OnPoolCreated
* Initialise pool(s)
* Get a channel
* Send Msg
* Release channel
}
//Create a client
Client := TBeepClient.Create;
//Set host, port
Client.Host := 'localhost';
Client.Port := '44000';
//Add optional event handlers
Client.OnConnected := @ClientConnected;
Client.OnDisconnected := @ClientDisconnected;
Client.OnConnectionFailed := @ClientConnectionFailed;
//Add a profile
NewProf := Client.AddProfile(PLAIN_PROFILE);
//Add required event handler
NewProf.OnFrameReceived := @ProfPlainFrameReceive;
//Add optional event handlers
NewProf.OnStartChannelRequest := @ProfPlainStartChannel;
NewProf.OnCloseChannelRequest := @ProfPlainCloseChannel;
//Add a profile
NewProf := Client.AddProfile(POOL_PROFILE);
//Add required event handler
NewProf.OnFrameReceived := @ProfPoolFrameReceive;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Client.Free;
end;
procedure TForm1.PoolCreated(Sender: TObject);
begin
CheckBoxPool.Checked := true;
writeln('A new channel pool is ready for use');
end;
procedure TForm1.ProfPlainCloseChannel(aConnection: TBeepConnection;
ChanNum: integer; var Accept: boolean);
begin
{ Implement profile requirements to check whether the request to close the
channel should be allowed }
//MemoLog.Lines.Add
writeln
(format('Closing channel %s on connection %s:%s',
[IntToStr(ChanNum),
aConnection.Host,
aConnection.Port]));
{ To close channel, set Accept := true, := false to deny
Default behaviour when this function is not implemented, is to allow all
closure requests }
Accept := true;
end;
procedure TForm1.ProfPlainFrameReceive(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
begin
{ Implement the profile here.
This function must respond to message frames using
- SendRPy
- SendANS
- SendERR
}
//MemoLog.Lines.Add
writeln
(format('A frame received on channel: %d', [aChannel.Number] ) );
//MemoLog.Lines.Add
writeln
(format('Data received: "%s"', [aFrame.PayloadAsString] ) );
end;
procedure TForm1.ProfPlainStartChannel(aConnection: TBeepConnection;
ChanNum: integer; var Accept: boolean);
begin
{ Implement profile requirements to check whether the request for a new
channel should be allowed }
//MemoLog.Lines.Add
writeln
(format('Starting channel %s on connection %s:%s',
[IntToStr(ChanNum),
aConnection.Host,
aConnection.Port]));
{ To allow channel, set Accept := true, := false to deny
Default behaviour when this function is not implemented, is to allow all
channels }
Accept := true;
end;
procedure TForm1.ProfPoolFrameReceive(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
begin
{Profile used for the pool channels}
//MemoLog.Lines.Add
writeln
(format('A frame received on pool channel: %d', [aChannel.Number] ) );
//MemoLog.Lines.Add
writeln
(format('Data received: "%s"', [aFrame.PayloadAsString] ) );
{Release the channel back to the pool}
Client.ReleasePoolChannel(0, aChannel);
end;
initialization
{$I clientmain.lrs}
end.

View File

@ -0,0 +1,86 @@
object Form1: TForm1
Left = 330
Height = 373
Top = 409
Width = 496
Caption = 'Form1'
ClientHeight = 373
ClientWidth = 496
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '0.9.27'
object Label1: TLabel
Left = 280
Height = 17
Top = 8
Width = 136
Caption = 'Open Connections'
ParentColor = False
end
object Label2: TLabel
Left = 8
Height = 17
Top = 8
Width = 58
Caption = 'Listener'
ParentColor = False
end
object Button2: TButton
Left = 8
Height = 25
Top = 24
Width = 75
Caption = 'Start'
OnClick = Button2Click
TabOrder = 0
end
object Button3: TButton
Left = 88
Height = 25
Top = 24
Width = 75
Caption = 'Stop'
OnClick = Button3Click
TabOrder = 1
end
object EditOpen: TEdit
Left = 280
Height = 26
Top = 24
Width = 80
TabOrder = 2
Text = '0'
end
object MemoLog: TMemo
Left = 32
Height = 115
Top = 224
Width = 384
TabOrder = 3
end
object ListBox1: TListBox
Left = 288
Height = 103
Top = 104
Width = 140
ItemHeight = 0
TabOrder = 4
TopIndex = -1
end
object CheckBoxActive: TCheckBox
Left = 168
Height = 24
Top = 24
Width = 88
Caption = 'Listening'
TabOrder = 5
end
object Button1: TButton
Left = 8
Height = 25
Top = 72
Width = 104
Caption = 'Close Con 0'
TabOrder = 6
end
end

View File

@ -0,0 +1,23 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'J'#1#6'Height'#3'u'#1#3'Top'#3#153#1#5'Wi'
+'dth'#3#240#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3'u'#1#11'ClientWidth'#3
+#240#1#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#10'LCLVer'
+'sion'#6#6'0.9.27'#0#6'TLabel'#6'Label1'#4'Left'#3#24#1#6'Height'#2#17#3'Top'
+#2#8#5'Width'#3#136#0#7'Caption'#6#16'Open Connections'#11'ParentColor'#8#0#0
+#6'TLabel'#6'Label2'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#8#5'Width'#2':'#7'C'
+'aption'#6#8'Listener'#11'ParentColor'#8#0#0#7'TButton'#7'Button2'#4'Left'#2
+#8#6'Height'#2#25#3'Top'#2#24#5'Width'#2'K'#7'Caption'#6#5'Start'#7'OnClick'
+#7#12'Button2Click'#8'TabOrder'#2#0#0#0#7'TButton'#7'Button3'#4'Left'#2'X'#6
+'Height'#2#25#3'Top'#2#24#5'Width'#2'K'#7'Caption'#6#4'Stop'#7'OnClick'#7#12
+'Button3Click'#8'TabOrder'#2#1#0#0#5'TEdit'#8'EditOpen'#4'Left'#3#24#1#6'Hei'
+'ght'#2#26#3'Top'#2#24#5'Width'#2'P'#8'TabOrder'#2#2#4'Text'#6#1'0'#0#0#5'TM'
+'emo'#7'MemoLog'#4'Left'#2' '#6'Height'#2's'#3'Top'#3#224#0#5'Width'#3#128#1
+#8'TabOrder'#2#3#0#0#8'TListBox'#8'ListBox1'#4'Left'#3' '#1#6'Height'#2'g'#3
+'Top'#2'h'#5'Width'#3#140#0#10'ItemHeight'#2#0#8'TabOrder'#2#4#8'TopIndex'#2
+#255#0#0#9'TCheckBox'#14'CheckBoxActive'#4'Left'#3#168#0#6'Height'#2#24#3'To'
+'p'#2#24#5'Width'#2'X'#7'Caption'#6#9'Listening'#8'TabOrder'#2#5#0#0#7'TButt'
+'on'#7'Button1'#4'Left'#2#8#6'Height'#2#25#3'Top'#2'H'#5'Width'#2'h'#7'Capti'
+'on'#6#11'Close Con 0'#8'TabOrder'#2#6#0#0#0
]);

View File

@ -0,0 +1,289 @@
(*******************************************************************************
* ListenerMain.pas: Listener test application for BeepFp
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* This is an example of using the TBeepServer class
******************************************************************************)
unit ListenerMain;
{$mode objfpc}{$H+}
interface
uses
Classes, StdCtrls, SysUtils, FileUtil, LResources, Forms, Controls, Graphics,
Dialogs,
BeepProfile, BeepListener, BeepConnection, BeepChannel,
BeepServer, BeepFrame;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
CheckBoxActive: TCheckBox;
EditOpen: TEdit;
Label1: TLabel;
Label2: TLabel;
ListBox1: TListBox;
MemoLog: TMemo;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Prof1CloseChannelRequest(aConnection: TBeepConnection; ChanNum: integer;
var Accept: boolean);
procedure Prof1FrameReceive(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
procedure Prof1StartChannelRequest(aConnection: TBeepConnection; ChanNum: integer;
var Accept: boolean);
procedure Prof2FrameReceive(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
procedure ServerConnectionAccept(aConnection: TBeepConnectionListener;
var Accept: boolean);
procedure ServerConnectionClose(aConnection: TBeepConnection);
procedure ServerListenerFailed(aListener: TBeepListener;
const ErrMsg: string);
procedure ServerListenerReady(aListener: TBeepListener);
procedure ServerListenerStop(aListener: TBeepListener);
private
Server: TBeepServer;
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
const
PLAIN_PROFILE = 'http://fact.aspl.es/profiles/plain_profile';
{ TForm1 }
procedure TForm1.Button2Click(Sender: TObject);
begin
Server.StartAll;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Server.StopAll;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
NewProf: TBeepProfile;
begin
{ Steps to prepare a server:
* Create server object
* Add profile(s)
* Set for profile (required): OnFrameReceived
* Set for profile (optional): OnStartChannel, OnCloseChannel
* Add port listener
* Set (optional): OnListenerReady, OnListenerFailed, OnListenerStop
* Set (optional): OnConnectionAccept, OnConnectionClose
* Start server
}
//Create server
Server := TBeepServer.Create;
//Add profile 1
NewProf := Server.AddProfile('http://lazarus/beep/Plain_Profile');
//Set required handlers for profile 1
NewProf.OnFrameReceived := @Prof1FrameReceive;
//Set optional handlers for profile 1
NewProf.OnStartChannelRequest := @Prof1StartChannelRequest;
NewProf.OnCloseChannelRequest := @Prof1CloseChannelRequest;
//Add profile 2
NewProf := Server.AddProfile(PLAIN_PROFILE);
//Set required handlers for profile 2
NewProf.OnFrameReceived := @Prof2FrameReceive;
//Add port listener
Server.AddListener('localhost', '44000');
//Set optional handlers
Server.OnListenerReady := @ServerListenerReady;
Server.OnListenerFailed := @ServerListenerFailed;
Server.OnListenerStop := @ServerListenerStop;
Server.OnConnectionAccept := @ServerConnectionAccept;
Server.OnConnectionClose := @ServerConnectionClose;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Server.Free;
end;
procedure TForm1.Prof1CloseChannelRequest(aConnection: TBeepConnection;
ChanNum: integer; var Accept: boolean);
begin
{ Implement profile requirements to check whether the request to close the
channel should be allowed }
//MemoLog.Lines.Add
writeln
(format('Closing channel %s on connection %s:%s',
[IntToStr(ChanNum),
aConnection.Host,
aConnection.Port]));
{ To close channel, set Accept := true, := false to deny
Default behaviour when this function is not implemented, is to allow all
closure requests }
Accept := true;
end;
procedure TForm1.Prof1FrameReceive(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
var
Reply: string;
begin
{ Implement the profile here.
This function must respond to message frames using
- aChannel.SendRPY
- aChannel.SendERR
- aChannel.SendANS
- aChannel.SendANSFinal
For meaning and usage of these functions, see:
http://www.aspl.es/fact/files/af-arch/vortex-1.1/html/starting_to_program.html#vortex_manual_sending_frames
}
//MemoLog.Lines.Add
writeln
(format('A frame received on channel: %d', [aChannel.Number] ) );
MemoLog.Lines.Add
//writeln
(format('Data received: "%s"', [aFrame.PayloadAsString] ) );
{ reply the peer client with the same content }
Reply := Format('Received Ok: %s', [aFrame.PayloadAsString]);
aChannel.SendRPY(PByte(PChar(Reply)), length(Reply), aFrame.MsgNum);
end;
procedure TForm1.Prof1StartChannelRequest(aConnection: TBeepConnection;
ChanNum: integer; var Accept: boolean);
begin
{ Implement profile requirements to check whether the request for a new
channel should be allowed }
//MemoLog.Lines.Add
writeln
(format('Starting channel %s on connection %s:%s',
[IntToStr(ChanNum),
aConnection.Host,
aConnection.Port]));
{ To allow channel, set Accept := true, := false to deny
Default behaviour when this function is not implemented, is to allow all
channels }
Accept := true;
end;
procedure TForm1.Prof2FrameReceive(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
var
Reply: string;
begin
//MemoLog.Lines.Add
writeln
(format('A frame received on channel: %d', [aChannel.Number] ) );
//MemoLog.Lines.Add
writeln
(format('Data received: "%s"', [aFrame.PayloadAsString] ) );
{ reply the peer client with the same content }
Reply := Format('Received Ok: %s', [aFrame.PayloadAsString]);
aChannel.SendRPY(PByte(PChar(Reply)), length(Reply), aFrame.MsgNum);
end;
procedure TForm1.ServerConnectionAccept(aConnection: TBeepConnectionListener;
var Accept: boolean);
begin
{ Implement requirements to check whether the connection should be accepted.}
//EditOpen.Text := IntToStr( StrToInt(EditOpen.Text)+1);
//MemoLog.Lines.Add
writeln
(format('New connection accepted from: %s:%s',
[aConnection.Host, aConnection.Port]));
{ To accept the connection, set Action:=true. Otherwise action:=false.
Default behaviour when this function is not implemented is to allow all
connection requests}
Accept := true;
end;
procedure TForm1.ServerConnectionClose(aConnection: TBeepConnection);
begin
{ This function is for information purpose only. It gets called when either
the listener or the client actively closes a connection (and all contained
channels) and when the listener realises that the connection was broken for
another reason.}
//EditOpen.Text := IntToStr( StrToInt(EditOpen.Text)-1);
//MemoLog.Lines.Add
writeln
(format('Connection closed: %s:%s', [aConnection.Host, aConnection.Port]));
end;
procedure TForm1.ServerListenerFailed(aListener: TBeepListener;
const ErrMsg: string);
begin
CheckBoxActive.Checked := false;
writeln('Listener creation failed for '+aListener.Host+':'+aListener.Port);
writeln('Vortex reason: '+ ErrMsg);
end;
procedure TForm1.ServerListenerReady(aListener: TBeepListener);
begin
CheckBoxActive.Checked := true;
writeln('Listener ready on '+aListener.Host+':'+aListener.Port);
end;
procedure TForm1.ServerListenerStop(aListener: TBeepListener);
begin
CheckBoxActive.Checked := false;
writeln('Listener stopping on '+aListener.Host+':'+aListener.Port);
end;
initialization
{$I listenermain.lrs}
end.

View File

@ -0,0 +1,9 @@
#! /bin/bash
FN="cache"
[ ! -d $FN ] && mkdir $FN
naturaldocs -i axl -i vortex -i beepfp \
-o HTML doc \
-p cache \
-t 2

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,226 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="2"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="8">
<Unit0>
<Filename Value="TestLIbAxl.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestLIbAxl"/>
<CursorPos X="26" Y="46"/>
<TopLine Value="26"/>
<EditorIndex Value="0"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../axl.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="axl"/>
<CursorPos X="21" Y="89"/>
<TopLine Value="51"/>
<EditorIndex Value="1"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../axl_doc.inc"/>
<CursorPos X="1" Y="54"/>
<TopLine Value="30"/>
<EditorIndex Value="3"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="../axl_doc_imp.inc"/>
<CursorPos X="72" Y="49"/>
<TopLine Value="6"/>
<EditorIndex Value="2"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="../axl_node.inc"/>
<CursorPos X="93" Y="245"/>
<TopLine Value="227"/>
<EditorIndex Value="6"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="../axl_node_imp.inc"/>
<CursorPos X="93" Y="73"/>
<TopLine Value="34"/>
<EditorIndex Value="7"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="../axl_stream_imp.inc"/>
<CursorPos X="29" Y="23"/>
<TopLine Value="8"/>
<EditorIndex Value="4"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="../axl_stream.inc"/>
<CursorPos X="1" Y="541"/>
<TopLine Value="496"/>
<EditorIndex Value="5"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit7>
</Units>
<JumpHistory Count="25" HistoryIndex="24">
<Position1>
<Filename Value="../axl_doc.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position1>
<Position2>
<Filename Value="../axl_doc.inc"/>
<Caret Line="54" Column="1" TopLine="29"/>
</Position2>
<Position3>
<Filename Value="../axl_doc.inc"/>
<Caret Line="197" Column="36" TopLine="188"/>
</Position3>
<Position4>
<Filename Value="../axl_doc.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position4>
<Position5>
<Filename Value="../axl_doc.inc"/>
<Caret Line="140" Column="29" TopLine="116"/>
</Position5>
<Position6>
<Filename Value="../axl_doc.inc"/>
<Caret Line="49" Column="1" TopLine="140"/>
</Position6>
<Position7>
<Filename Value="../axl_node.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position7>
<Position8>
<Filename Value="../axl_node_imp.inc"/>
<Caret Line="51" Column="20" TopLine="33"/>
</Position8>
<Position9>
<Filename Value="../axl_node.inc"/>
<Caret Line="146" Column="69" TopLine="126"/>
</Position9>
<Position10>
<Filename Value="../axl_node.inc"/>
<Caret Line="178" Column="66" TopLine="159"/>
</Position10>
<Position11>
<Filename Value="../axl_node.inc"/>
<Caret Line="205" Column="72" TopLine="186"/>
</Position11>
<Position12>
<Filename Value="../axl_node.inc"/>
<Caret Line="230" Column="74" TopLine="211"/>
</Position12>
<Position13>
<Filename Value="../axl_doc.inc"/>
<Caret Line="40" Column="47" TopLine="253"/>
</Position13>
<Position14>
<Filename Value="../axl_stream_imp.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position14>
<Position15>
<Filename Value="../axl_node_imp.inc"/>
<Caret Line="51" Column="20" TopLine="33"/>
</Position15>
<Position16>
<Filename Value="../axl_node_imp.inc"/>
<Caret Line="49" Column="68" TopLine="25"/>
</Position16>
<Position17>
<Filename Value="../axl_node_imp.inc"/>
<Caret Line="55" Column="66" TopLine="31"/>
</Position17>
<Position18>
<Filename Value="../axl_node_imp.inc"/>
<Caret Line="61" Column="72" TopLine="34"/>
</Position18>
<Position19>
<Filename Value="../axl_node_imp.inc"/>
<Caret Line="67" Column="74" TopLine="34"/>
</Position19>
<Position20>
<Filename Value="../axl_stream.inc"/>
<Caret Line="542" Column="10" TopLine="498"/>
</Position20>
<Position21>
<Filename Value="../axl_doc.inc"/>
<Caret Line="54" Column="1" TopLine="34"/>
</Position21>
<Position22>
<Filename Value="../axl_doc.inc"/>
<Caret Line="42" Column="38" TopLine="30"/>
</Position22>
<Position23>
<Filename Value="../axl_stream_imp.inc"/>
<Caret Line="50" Column="3" TopLine="8"/>
</Position23>
<Position24>
<Filename Value="../axl.pas"/>
<Caret Line="89" Column="21" TopLine="51"/>
</Position24>
<Position25>
<Filename Value="../axl_doc_imp.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position25>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Target>
<Filename Value="testaxl"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<OtherUnitFiles Value="/home/wimpie/development/lib/lazaxl/"/>
</SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,106 @@
(* *****************************************************************************
* TestLibAxl.pas: Compilation test for Axl.pas
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TestLibAxl is only used to check if the Axl.h translation compiles
* correctly. The program does not do anything useful
******************************************************************************)
program TestLibAxl;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
axl, Classes, SysUtils, CustApp;
type
{ TTestAxl }
TTestAxl = class(TCustomApplication)
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;
{ TTestAxl }
procedure TTestAxl.DoRun;
var
ErrorMsg: String;
begin
// quick check parameters
ErrorMsg:=CheckOptions('h','help');
if ErrorMsg<>'' then begin
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
// parse parameters
if HasOption('h','help') then begin
WriteHelp;
Terminate;
Exit;
end;
{ add your program here }
writeln('Hallo world');
// stop program loop
Terminate;
end;
constructor TTestAxl.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException:=True;
end;
destructor TTestAxl.Destroy;
begin
inherited Destroy;
end;
procedure TTestAxl.WriteHelp;
begin
{ add your help code here }
writeln('Usage: ',ExeName,' -h');
end;
var
Application: TTestAxl;
{$IFDEF WINDOWS}{$R TestLIbAxl.rc}{$ENDIF}
begin
Application:=TTestAxl.Create(nil);
Application.Run;
Application.Free;
end.

View File

@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "TestLIbAxl.manifest"
MAINICON ICON "TestLIbAxl.ico"

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,579 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="1"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="78">
<Unit0>
<Filename Value="TestVortex.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestVortex"/>
<CursorPos X="1" Y="80"/>
<TopLine Value="33"/>
<UsageCount Value="35"/>
</Unit0>
<Unit1>
<Filename Value="../vortex.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Vortex"/>
<CursorPos X="4" Y="5"/>
<TopLine Value="1"/>
<EditorIndex Value="1"/>
<UsageCount Value="35"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../../lazaxl/axl.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="axl"/>
<CursorPos X="17" Y="63"/>
<TopLine Value="48"/>
<EditorIndex Value="0"/>
<UsageCount Value="35"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="../vortex_types.inc"/>
<CursorPos X="37" Y="389"/>
<TopLine Value="365"/>
<UsageCount Value="10"/>
</Unit3>
<Unit4>
<Filename Value="../vortex_support.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit4>
<Unit5>
<Filename Value="../vortex_handlers.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit5>
<Unit6>
<Filename Value="../vortex_ctx.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit6>
<Unit7>
<Filename Value="../vortex_thread.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit7>
<Unit8>
<Filename Value="../vortex_thread_pool.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit8>
<Unit9>
<Filename Value="../vortex_queue.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit9>
<Unit10>
<Filename Value="../vortex_hash.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit10>
<Unit11>
<Filename Value="../vortex_connection.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit11>
<Unit12>
<Filename Value="../vortex_listener.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit12>
<Unit13>
<Filename Value="../vortex_frame_factory.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit13>
<Unit14>
<Filename Value="../vortex_greetings.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit14>
<Unit15>
<Filename Value="../vortex_profiles.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit15>
<Unit16>
<Filename Value="../vortex_channel.inc"/>
<CursorPos X="22" Y="413"/>
<TopLine Value="389"/>
<UsageCount Value="9"/>
</Unit16>
<Unit17>
<Filename Value="../vortex_channel_pool.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit17>
<Unit18>
<Filename Value="../vortex_io.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit18>
<Unit19>
<Filename Value="../vortex_reader.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit19>
<Unit20>
<Filename Value="../vortex_dtds.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit20>
<Unit21>
<Filename Value="../vortex_sequencer.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit21>
<Unit22>
<Filename Value="../vortex_errno.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit22>
<Unit23>
<Filename Value="../../lazaxl/axl_dtd.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit23>
<Unit24>
<Filename Value="../../lazaxl/axl_error.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit24>
<Unit25>
<Filename Value="../../lazaxl/axl_log.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit25>
<Unit26>
<Filename Value="../../lazaxl/axl_factory.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit26>
<Unit27>
<Filename Value="../../lazaxl/axl_decl_imp.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="9"/>
<UsageCount Value="9"/>
</Unit27>
<Unit28>
<Filename Value="../../lazaxl/axl_doc_imp.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="6"/>
<UsageCount Value="9"/>
</Unit28>
<Unit29>
<Filename Value="../../lazaxl/axl_node_imp.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="34"/>
<UsageCount Value="9"/>
</Unit29>
<Unit30>
<Filename Value="../../lazaxl/axl_decl.inc"/>
<CursorPos X="28" Y="911"/>
<TopLine Value="864"/>
<UsageCount Value="9"/>
</Unit30>
<Unit31>
<Filename Value="../../lazaxl/axl_list.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit31>
<Unit32>
<Filename Value="../../lazaxl/axl_stack.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit32>
<Unit33>
<Filename Value="../../lazaxl/axl_hash.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit33>
<Unit34>
<Filename Value="../../lazaxl/axl_stream.inc"/>
<CursorPos X="9" Y="544"/>
<TopLine Value="499"/>
<UsageCount Value="9"/>
</Unit34>
<Unit35>
<Filename Value="../../lazaxl/axl_doc.inc"/>
<CursorPos X="1" Y="183"/>
<TopLine Value="159"/>
<UsageCount Value="9"/>
</Unit35>
<Unit36>
<Filename Value="../../lazaxl/axl_node.inc"/>
<CursorPos X="5" Y="254"/>
<TopLine Value="229"/>
<UsageCount Value="9"/>
</Unit36>
<Unit37>
<Filename Value="../../lazaxl/axl_stream_imp.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="8"/>
<UsageCount Value="9"/>
</Unit37>
<Unit38>
<Filename Value="../../lazaxl/axl_config.h"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit38>
<Unit39>
<Filename Value="../../../laz_conv/libvortex/vortex_http.tmp.h"/>
<CursorPos X="1" Y="55"/>
<TopLine Value="31"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit39>
<Unit40>
<Filename Value="../../vortex_http.tmp.h"/>
<CursorPos X="1" Y="55"/>
<TopLine Value="31"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit40>
<Unit41>
<Filename Value="../../vortex_pull.tmp.h"/>
<CursorPos X="1" Y="61"/>
<TopLine Value="36"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit41>
<Unit42>
<Filename Value="../../vortex_sasl.tmp.h"/>
<CursorPos X="1" Y="56"/>
<TopLine Value="31"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit42>
<Unit43>
<Filename Value="../../vortex_tls.tmp.h"/>
<CursorPos X="1" Y="53"/>
<TopLine Value="28"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit43>
<Unit44>
<Filename Value="../../vortex_tunnel.tmp.h"/>
<CursorPos X="1" Y="61"/>
<TopLine Value="36"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit44>
<Unit45>
<Filename Value="../../vortex_xml_rpc.tmp.h"/>
<CursorPos X="1" Y="48"/>
<TopLine Value="23"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit45>
<Unit46>
<Filename Value="../../vortex_xml_rpc_types.tmp.h"/>
<CursorPos X="1" Y="797"/>
<TopLine Value="772"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit46>
<Unit47>
<Filename Value="../../vortex_http.apas"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="None"/>
</Unit47>
<Unit48>
<Filename Value="../../vortex_http.a.pas"/>
<CursorPos X="1" Y="135"/>
<TopLine Value="90"/>
<UsageCount Value="9"/>
</Unit48>
<Unit49>
<Filename Value="../../vortex_http.pas"/>
<UnitName Value="vortex_http"/>
<CursorPos X="1" Y="7"/>
<TopLine Value="22"/>
<UsageCount Value="9"/>
</Unit49>
<Unit50>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/aliasctp.inc"/>
<CursorPos X="79" Y="21"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit50>
<Unit51>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/inc/ctypes.pp"/>
<UnitName Value="ctypes"/>
<CursorPos X="6" Y="23"/>
<TopLine Value="20"/>
<UsageCount Value="9"/>
</Unit51>
<Unit52>
<Filename Value="../vortex_http.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="vortex_http"/>
<CursorPos X="1" Y="57"/>
<TopLine Value="41"/>
<UsageCount Value="34"/>
</Unit52>
<Unit53>
<Filename Value="../../vortex_pull.apas"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="None"/>
</Unit53>
<Unit54>
<Filename Value="../../vortex_pull.a.pas"/>
<UnitName Value="vortex_pull"/>
<CursorPos X="5" Y="306"/>
<TopLine Value="168"/>
<UsageCount Value="9"/>
</Unit54>
<Unit55>
<Filename Value="../../vortex_pull.pas"/>
<UnitName Value="vortex_pull"/>
<CursorPos X="1" Y="71"/>
<TopLine Value="21"/>
<UsageCount Value="9"/>
<Bookmarks Count="1">
<Item0 X="63" Y="277" ID="1"/>
</Bookmarks>
</Unit55>
<Unit56>
<Filename Value="../vortex_pull.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="vortex_pull"/>
<CursorPos X="1" Y="57"/>
<TopLine Value="36"/>
<UsageCount Value="33"/>
</Unit56>
<Unit57>
<Filename Value="../../vortex_sasl.a.pas"/>
<UnitName Value="vortex_sasl"/>
<CursorPos X="5" Y="638"/>
<TopLine Value="589"/>
<UsageCount Value="9"/>
</Unit57>
<Unit58>
<Filename Value="../../vortex_sasl.pas"/>
<UnitName Value="vortex_sasl"/>
<CursorPos X="55" Y="212"/>
<TopLine Value="216"/>
<UsageCount Value="9"/>
</Unit58>
<Unit59>
<Filename Value="../vortex_sasl.pas"/>
<UnitName Value="vortex_sasl"/>
<CursorPos X="22" Y="598"/>
<TopLine Value="574"/>
<UsageCount Value="21"/>
</Unit59>
<Unit60>
<Filename Value="../../vortex_tls.pas"/>
<UnitName Value="vortex_tls"/>
<CursorPos X="1" Y="195"/>
<TopLine Value="52"/>
<UsageCount Value="9"/>
</Unit60>
<Unit61>
<Filename Value="../../vortex_tls.apas"/>
<CursorPos X="17" Y="2"/>
<TopLine Value="74"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="None"/>
</Unit61>
<Unit62>
<Filename Value="../../vortex_tls.a.pas"/>
<CursorPos X="5" Y="105"/>
<TopLine Value="88"/>
<UsageCount Value="9"/>
</Unit62>
<Unit63>
<Filename Value="../vortex_tls.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="vortex_tls"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="31"/>
</Unit63>
<Unit64>
<Filename Value="../../vortex_tunnel.h"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit64>
<Unit65>
<Filename Value="../../vortex_tunnel.pas"/>
<UnitName Value="vortex_tunnel"/>
<CursorPos X="37" Y="162"/>
<TopLine Value="154"/>
<UsageCount Value="9"/>
</Unit65>
<Unit66>
<Filename Value="../../vortex_tunnel.a.pas"/>
<CursorPos X="1" Y="208"/>
<TopLine Value="190"/>
<UsageCount Value="9"/>
</Unit66>
<Unit67>
<Filename Value="../vortex_tunnel.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="vortex_tunnel"/>
<CursorPos X="9" Y="56"/>
<TopLine Value="54"/>
<UsageCount Value="29"/>
</Unit67>
<Unit68>
<Filename Value="../../vortex_xml_rpc.pas"/>
<UnitName Value="vortex_xml_rpc"/>
<CursorPos X="1" Y="319"/>
<TopLine Value="291"/>
<UsageCount Value="10"/>
</Unit68>
<Unit69>
<Filename Value="../../vortex_xml_rpc.a.pas"/>
<CursorPos X="1" Y="386"/>
<TopLine Value="348"/>
<UsageCount Value="10"/>
</Unit69>
<Unit70>
<Filename Value="../vortex_xml_rpc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="vortex_xml_rpc"/>
<CursorPos X="1" Y="523"/>
<TopLine Value="486"/>
<UsageCount Value="28"/>
</Unit70>
<Unit71>
<Filename Value="../../vortex_xml_rpc_types.apas"/>
<CursorPos X="5" Y="5"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="None"/>
</Unit71>
<Unit72>
<Filename Value="../../vortex_xml_rpc_types.pas"/>
<UnitName Value="vortex_xml_rpc_types"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit72>
<Unit73>
<Filename Value="../../vortex_xml_rpc_types.inc"/>
<CursorPos X="48" Y="1207"/>
<TopLine Value="1164"/>
<UsageCount Value="9"/>
</Unit73>
<Unit74>
<Filename Value="../../vortex_xml_rpc_types_imp.inc"/>
<CursorPos X="1" Y="44"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit74>
<Unit75>
<Filename Value="../../vortex_xml_rpc_types.a.pas"/>
<UnitName Value="vortex_xml_rpc_types"/>
<CursorPos X="110" Y="1048"/>
<TopLine Value="1015"/>
<UsageCount Value="11"/>
</Unit75>
<Unit76>
<Filename Value="../vortex_xml_rpc_types.inc"/>
<CursorPos X="20" Y="227"/>
<TopLine Value="188"/>
<UsageCount Value="12"/>
<Bookmarks Count="2">
<Item0 X="1" Y="885" ID="1"/>
<Item1 X="1" Y="592" ID="2"/>
</Bookmarks>
</Unit76>
<Unit77>
<Filename Value="../vortex_xml_rpc_types_imp.inc"/>
<CursorPos X="1" Y="45"/>
<TopLine Value="1"/>
<UsageCount Value="12"/>
</Unit77>
</Units>
<JumpHistory Count="0" HistoryIndex="-1"/>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Target>
<Filename Value="testvortex"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<OtherUnitFiles Value="/home/wimpie/development/lib/lazvortex/;/home/wimpie/development/lib/lazaxl/"/>
<UnitOutputDirectory Value="lib"/>
</SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,108 @@
(* *****************************************************************************
* TestVortex.pas: Compilation test for Vortex.pas
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TestLibVortex is only used to check if the Vortex.h translation compiles
* correctly. The program does not do anything useful
******************************************************************************)
program TestVortex;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
axl, Classes, SysUtils, CustApp, vortex, vortex_http, vortex_pull, vortex_tls,
vortex_tunnel, vortex_xml_rpc;
type
{ TTestVortex }
TTestVortex = class(TCustomApplication)
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;
{ TTestVortex }
procedure TTestVortex.DoRun;
var
ErrorMsg: String;
begin
// quick check parameters
ErrorMsg:=CheckOptions('h','help');
if ErrorMsg<>'' then begin
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
// parse parameters
if HasOption('h','help') then begin
WriteHelp;
Terminate;
Exit;
end;
{ add your program here }
writeln('Hello Vortex');
// stop program loop
Terminate;
end;
constructor TTestVortex.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException:=True;
end;
destructor TTestVortex.Destroy;
begin
inherited Destroy;
end;
procedure TTestVortex.WriteHelp;
begin
{ add your help code here }
writeln('Usage: ',ExeName,' -h');
end;
var
Application: TTestVortex;
{$IFDEF WINDOWS}{$R TestVortex.rc}{$ENDIF}
begin
Application:=TTestVortex.Create(nil);
Application.Title := 'project1';
Application.Run;
Application.Free;
end.

View File

@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "TestVortex.manifest"
MAINICON ICON "TestVortex.ico"

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,411 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Title Value="test_client"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="1"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="36">
<Unit0>
<Filename Value="test_client.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_client"/>
<CursorPos X="115" Y="7"/>
<TopLine Value="1"/>
<EditorIndex Value="3"/>
<UsageCount Value="107"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="newclientmain.pas"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="NewClientMain"/>
<CursorPos X="31" Y="133"/>
<TopLine Value="123"/>
<UsageCount Value="101"/>
</Unit1>
<Unit2>
<Filename Value="../beepcontext.pas"/>
<UnitName Value="BeepContext"/>
<CursorPos X="1" Y="93"/>
<TopLine Value="56"/>
<UsageCount Value="15"/>
</Unit2>
<Unit3>
<Filename Value="../beepconnection.pas"/>
<UnitName Value="BeepConnection"/>
<CursorPos X="1" Y="365"/>
<TopLine Value="328"/>
<UsageCount Value="101"/>
</Unit3>
<Unit4>
<Filename Value="../beepclient.pas"/>
<UnitName Value="BeepClient"/>
<CursorPos X="17" Y="201"/>
<TopLine Value="176"/>
<UsageCount Value="26"/>
</Unit4>
<Unit5>
<Filename Value="../beeppeer.pas"/>
<UnitName Value="BeepPeer"/>
<CursorPos X="32" Y="175"/>
<TopLine Value="168"/>
<UsageCount Value="23"/>
</Unit5>
<Unit6>
<Filename Value="../beepchannelpool.pas"/>
<UnitName Value="BeepChannelPool"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="101"/>
</Unit6>
<Unit7>
<Filename Value="../../lazvortex/vortex.pas"/>
<UnitName Value="Vortex"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="50"/>
</Unit7>
<Unit8>
<Filename Value="../../lazvortex/vortex_channel_pool.inc"/>
<CursorPos X="100" Y="61"/>
<TopLine Value="20"/>
<UsageCount Value="2"/>
</Unit8>
<Unit9>
<Filename Value="../beepprofile.pas"/>
<UnitName Value="BeepProfile"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="50"/>
</Unit9>
<Unit10>
<Filename Value="../beepprofilebase.pas"/>
<UnitName Value="BeepProfileBase"/>
<CursorPos X="69" Y="18"/>
<TopLine Value="1"/>
<UsageCount Value="50"/>
</Unit10>
<Unit11>
<Filename Value="../../lazvortex/vortex_handlers.inc"/>
<CursorPos X="58" Y="340"/>
<TopLine Value="315"/>
<UsageCount Value="2"/>
</Unit11>
<Unit12>
<Filename Value="../beeputils.pas"/>
<UnitName Value="BeepUtils"/>
<CursorPos X="69" Y="18"/>
<TopLine Value="1"/>
<UsageCount Value="50"/>
</Unit12>
<Unit13>
<Filename Value="../../lazvortex/vortex_profiles.inc"/>
<CursorPos X="120" Y="190"/>
<TopLine Value="142"/>
<UsageCount Value="2"/>
</Unit13>
<Unit14>
<Filename Value="../beepchannel.pas"/>
<UnitName Value="BeepChannel"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="101"/>
<Bookmarks Count="2">
<Item0 X="102" Y="58" ID="1"/>
<Item1 X="30" Y="288" ID="2"/>
</Bookmarks>
</Unit14>
<Unit15>
<Filename Value="../../lazvortex/vortex_channel.inc"/>
<CursorPos X="98" Y="76"/>
<TopLine Value="49"/>
<UsageCount Value="4"/>
</Unit15>
<Unit16>
<Filename Value="../beepframe.pas"/>
<UnitName Value="BeepFrame"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="60"/>
</Unit16>
<Unit17>
<Filename Value="../../lazvortex/vortex_frame_factory.inc"/>
<CursorPos X="1" Y="468"/>
<TopLine Value="423"/>
<UsageCount Value="9"/>
</Unit17>
<Unit18>
<Filename Value="TestClient.lpi"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
<SyntaxHighlighter Value="XML"/>
</Unit18>
<Unit19>
<Filename Value="TestClient.lpr"/>
<UnitName Value="TestClient"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit19>
<Unit20>
<Filename Value="clientmain.pas"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="clientmain"/>
<CursorPos X="84" Y="18"/>
<TopLine Value="129"/>
<UsageCount Value="10"/>
</Unit20>
<Unit21>
<Filename Value="testclientmain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestClientMain"/>
<CursorPos X="39" Y="39"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/>
<UsageCount Value="26"/>
<Loaded Value="True"/>
</Unit21>
<Unit22>
<Filename Value="../../../lazarus_sw/lcl/include/control.inc"/>
<CursorPos X="77" Y="2218"/>
<TopLine Value="2204"/>
<UsageCount Value="10"/>
</Unit22>
<Unit23>
<Filename Value="../lazbeep/beepchannel.pas"/>
<UnitName Value="BeepChannel"/>
<CursorPos X="41" Y="526"/>
<TopLine Value="507"/>
<UsageCount Value="25"/>
</Unit23>
<Unit24>
<Filename Value="../lazbeep/beepconnection.pas"/>
<UnitName Value="beepconnection"/>
<UsageCount Value="25"/>
</Unit24>
<Unit25>
<Filename Value="../lazbeep/beepcontext.pas"/>
<UnitName Value="beepcontext"/>
<UsageCount Value="25"/>
</Unit25>
<Unit26>
<Filename Value="../lazbeep/beepframe.pas"/>
<UnitName Value="beepframe"/>
<UsageCount Value="25"/>
</Unit26>
<Unit27>
<Filename Value="../lazbeep/beepprofile.pas"/>
<UnitName Value="BeepProfile"/>
<CursorPos X="3" Y="43"/>
<TopLine Value="36"/>
<UsageCount Value="25"/>
</Unit27>
<Unit28>
<Filename Value="../axl/axl.pas"/>
<UnitName Value="axl"/>
<UsageCount Value="20"/>
</Unit28>
<Unit29>
<Filename Value="../lazbeep/beepchannelpool.pas"/>
<UnitName Value="BeepChannelPool"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="25"/>
</Unit29>
<Unit30>
<Filename Value="../lazbeep/beeputils.pas"/>
<UnitName Value="BeepUtils"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="13"/>
</Unit30>
<Unit31>
<Filename Value="../lazbeep/beepprofilebase.pas"/>
<UnitName Value="BeepProfileBase"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="13"/>
</Unit31>
<Unit32>
<Filename Value="../lazbeep/beepobject.pas"/>
<UnitName Value="BeepObject"/>
<CursorPos X="1" Y="50"/>
<TopLine Value="23"/>
<UsageCount Value="10"/>
</Unit32>
<Unit33>
<Filename Value="../lazbeep/beeppeer.pas"/>
<UnitName Value="BeepPeer"/>
<CursorPos X="46" Y="360"/>
<TopLine Value="346"/>
<UsageCount Value="10"/>
</Unit33>
<Unit34>
<Filename Value="../beepfp/beepchannelpool.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepChannelPool"/>
<CursorPos X="24" Y="145"/>
<TopLine Value="142"/>
<EditorIndex Value="1"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit34>
<Unit35>
<Filename Value="../beepfp/beepchannel.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepChannel"/>
<CursorPos X="81" Y="524"/>
<TopLine Value="521"/>
<EditorIndex Value="2"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit35>
</Units>
<JumpHistory Count="20" HistoryIndex="19">
<Position1>
<Filename Value="testclientmain.pas"/>
<Caret Line="146" Column="50" TopLine="33"/>
</Position1>
<Position2>
<Filename Value="testclientmain.pas"/>
<Caret Line="55" Column="51" TopLine="33"/>
</Position2>
<Position3>
<Filename Value="testclientmain.pas"/>
<Caret Line="114" Column="19" TopLine="112"/>
</Position3>
<Position4>
<Filename Value="testclientmain.pas"/>
<Caret Line="57" Column="53" TopLine="41"/>
</Position4>
<Position5>
<Filename Value="testclientmain.pas"/>
<Caret Line="121" Column="43" TopLine="119"/>
</Position5>
<Position6>
<Filename Value="testclientmain.pas"/>
<Caret Line="49" Column="22" TopLine="49"/>
</Position6>
<Position7>
<Filename Value="testclientmain.pas"/>
<Caret Line="62" Column="55" TopLine="62"/>
</Position7>
<Position8>
<Filename Value="testclientmain.pas"/>
<Caret Line="69" Column="44" TopLine="69"/>
</Position8>
<Position9>
<Filename Value="testclientmain.pas"/>
<Caret Line="76" Column="44" TopLine="68"/>
</Position9>
<Position10>
<Filename Value="testclientmain.pas"/>
<Caret Line="58" Column="49" TopLine="41"/>
</Position10>
<Position11>
<Filename Value="testclientmain.pas"/>
<Caret Line="124" Column="48" TopLine="114"/>
</Position11>
<Position12>
<Filename Value="test_client.lpr"/>
<Caret Line="31" Column="11" TopLine="1"/>
</Position12>
<Position13>
<Filename Value="testclientmain.pas"/>
<Caret Line="158" Column="46" TopLine="147"/>
</Position13>
<Position14>
<Filename Value="testclientmain.pas"/>
<Caret Line="39" Column="39" TopLine="1"/>
</Position14>
<Position15>
<Filename Value="../beepfp/beepchannelpool.pas"/>
<Caret Line="343" Column="40" TopLine="327"/>
</Position15>
<Position16>
<Filename Value="../beepfp/beepchannelpool.pas"/>
<Caret Line="121" Column="35" TopLine="98"/>
</Position16>
<Position17>
<Filename Value="../beepfp/beepchannelpool.pas"/>
<Caret Line="356" Column="29" TopLine="328"/>
</Position17>
<Position18>
<Filename Value="../beepfp/beepchannelpool.pas"/>
<Caret Line="36" Column="59" TopLine="1"/>
</Position18>
<Position19>
<Filename Value="../beepfp/beepchannelpool.pas"/>
<Caret Line="227" Column="5" TopLine="179"/>
</Position19>
<Position20>
<Filename Value="../beepfp/beepchannelpool.pas"/>
<Caret Line="344" Column="5" TopLine="296"/>
</Position20>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<OtherUnitFiles Value="../axl/;../vortex/;../beepfp/"/>
<UnitOutputDirectory Value="lib"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,49 @@
(*******************************************************************************
* test_client.pas: App to test BeepFp classes
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* test_client is an application used to test the BeepFp classes, mainly
* used during development. To see how to use the classes in a real application,
* see BEEP_Client and BEEP_Listen
******************************************************************************)
program test_client;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, LResources, TestClientMain,
BeepChannel, BeepChannelPool;
{$IFDEF WINDOWS}{$R test_client.rc}{$ENDIF}
begin
{$I test_client.lrs}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "test_client.manifest"
MAINICON ICON "test_client.ico"

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,558 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Title Value="test_listener"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="7"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="54">
<Unit0>
<Filename Value="test_listener.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_listener"/>
<CursorPos X="22" Y="39"/>
<TopLine Value="9"/>
<EditorIndex Value="5"/>
<UsageCount Value="181"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="newclientmain.pas"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="NewClientMain"/>
<CursorPos X="31" Y="133"/>
<TopLine Value="123"/>
<UsageCount Value="94"/>
</Unit1>
<Unit2>
<Filename Value="../beepcontext.pas"/>
<UnitName Value="BeepContext"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="45"/>
</Unit2>
<Unit3>
<Filename Value="../beepconnection.pas"/>
<UnitName Value="BeepConnection"/>
<CursorPos X="47" Y="463"/>
<TopLine Value="456"/>
<UsageCount Value="140"/>
</Unit3>
<Unit4>
<Filename Value="../beepclient.pas"/>
<UnitName Value="BeepClient"/>
<CursorPos X="17" Y="201"/>
<TopLine Value="176"/>
<UsageCount Value="27"/>
</Unit4>
<Unit5>
<Filename Value="../beeppeer.pas"/>
<UnitName Value="BeepPeer"/>
<CursorPos X="32" Y="175"/>
<TopLine Value="168"/>
<UsageCount Value="24"/>
</Unit5>
<Unit6>
<Filename Value="../beepchannelpool.pas"/>
<UnitName Value="BeepChannelPool"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="94"/>
</Unit6>
<Unit7>
<Filename Value="../../lazvortex/vortex.pas"/>
<UnitName Value="Vortex"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="51"/>
</Unit7>
<Unit8>
<Filename Value="../beepprofile.pas"/>
<UnitName Value="BeepProfile"/>
<CursorPos X="34" Y="218"/>
<TopLine Value="212"/>
<UsageCount Value="82"/>
</Unit8>
<Unit9>
<Filename Value="../beepprofilebase.pas"/>
<UnitName Value="BeepProfileBase"/>
<CursorPos X="69" Y="18"/>
<TopLine Value="1"/>
<UsageCount Value="68"/>
</Unit9>
<Unit10>
<Filename Value="../../lazvortex/vortex_handlers.inc"/>
<CursorPos X="130" Y="74"/>
<TopLine Value="50"/>
<UsageCount Value="4"/>
</Unit10>
<Unit11>
<Filename Value="../beeputils.pas"/>
<UnitName Value="BeepUtils"/>
<CursorPos X="3" Y="62"/>
<TopLine Value="33"/>
<UsageCount Value="81"/>
</Unit11>
<Unit12>
<Filename Value="../beepchannel.pas"/>
<UnitName Value="BeepChannel"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="140"/>
<Bookmarks Count="2">
<Item0 X="102" Y="58" ID="1"/>
<Item1 X="30" Y="288" ID="2"/>
</Bookmarks>
</Unit12>
<Unit13>
<Filename Value="../../lazvortex/vortex_channel.inc"/>
<CursorPos X="98" Y="76"/>
<TopLine Value="49"/>
<UsageCount Value="7"/>
</Unit13>
<Unit14>
<Filename Value="../beepframe.pas"/>
<UnitName Value="BeepFrame"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="99"/>
</Unit14>
<Unit15>
<Filename Value="../../lazvortex/vortex_frame_factory.inc"/>
<CursorPos X="1" Y="468"/>
<TopLine Value="423"/>
<UsageCount Value="2"/>
</Unit15>
<Unit16>
<Filename Value="TestClient.lpi"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="3"/>
<SyntaxHighlighter Value="XML"/>
</Unit16>
<Unit17>
<Filename Value="TestClient.lpr"/>
<UnitName Value="TestClient"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="3"/>
</Unit17>
<Unit18>
<Filename Value="clientmain.pas"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="clientmain"/>
<CursorPos X="84" Y="18"/>
<TopLine Value="129"/>
<UsageCount Value="3"/>
</Unit18>
<Unit19>
<Filename Value="testclientmain.pas"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestClientMain"/>
<CursorPos X="66" Y="25"/>
<TopLine Value="1"/>
<UsageCount Value="13"/>
</Unit19>
<Unit20>
<Filename Value="testlistenmain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestListenMain"/>
<CursorPos X="21" Y="45"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/>
<UsageCount Value="100"/>
<Loaded Value="True"/>
</Unit20>
<Unit21>
<Filename Value="../beeplistener.pas"/>
<UnitName Value="BeepListener"/>
<CursorPos X="5" Y="210"/>
<TopLine Value="179"/>
<UsageCount Value="45"/>
</Unit21>
<Unit22>
<Filename Value="../beepserver.pas"/>
<UnitName Value="BeepServer"/>
<CursorPos X="5" Y="65"/>
<TopLine Value="26"/>
<UsageCount Value="11"/>
</Unit22>
<Unit23>
<Filename Value="../../lazvortex/vortex_listener.inc"/>
<CursorPos X="17" Y="156"/>
<TopLine Value="112"/>
<UsageCount Value="4"/>
</Unit23>
<Unit24>
<Filename Value="../../lazvortex/vortex_types.inc"/>
<CursorPos X="3" Y="359"/>
<TopLine Value="335"/>
<UsageCount Value="4"/>
</Unit24>
<Unit25>
<Filename Value="../../lazaxl/axl_decl.inc"/>
<CursorPos X="3" Y="658"/>
<TopLine Value="634"/>
<UsageCount Value="19"/>
</Unit25>
<Unit26>
<Filename Value="../../../lazarus_sw/lcl/include/control.inc"/>
<CursorPos X="1" Y="1594"/>
<TopLine Value="1570"/>
<UsageCount Value="5"/>
</Unit26>
<Unit27>
<Filename Value="../../../lazarus_sw/lcl/include/buttoncontrol.inc"/>
<CursorPos X="1" Y="27"/>
<TopLine Value="3"/>
<UsageCount Value="5"/>
</Unit27>
<Unit28>
<Filename Value="../../../lazarus_sw/lcl/include/buttons.inc"/>
<CursorPos X="1" Y="332"/>
<TopLine Value="288"/>
<UsageCount Value="5"/>
</Unit28>
<Unit29>
<Filename Value="../../../lazarus_sw/lcl/include/wincontrol.inc"/>
<CursorPos X="1" Y="4915"/>
<TopLine Value="4891"/>
<UsageCount Value="5"/>
</Unit29>
<Unit30>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/packages/fcl-db/src/memds/memds.pp"/>
<UnitName Value="memds"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="14"/>
<UsageCount Value="5"/>
</Unit30>
<Unit31>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/packages/fv/src/memory.pas"/>
<UnitName Value="Memory"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="226"/>
<UsageCount Value="5"/>
</Unit31>
<Unit32>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/inc/cmem.pp"/>
<UnitName Value="cmem"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="7"/>
</Unit32>
<Unit33>
<Filename Value="../lazbeep/beepprofile.pas"/>
<UnitName Value="BeepProfile"/>
<CursorPos X="59" Y="271"/>
<TopLine Value="246"/>
<UsageCount Value="21"/>
</Unit33>
<Unit34>
<Filename Value="../lazbeep/beepchannel.pas"/>
<UnitName Value="BeepChannel"/>
<CursorPos X="48" Y="17"/>
<TopLine Value="110"/>
<UsageCount Value="21"/>
</Unit34>
<Unit35>
<Filename Value="../lazbeep/beepconnection.pas"/>
<UnitName Value="BeepConnection"/>
<CursorPos X="9" Y="475"/>
<TopLine Value="466"/>
<UsageCount Value="21"/>
</Unit35>
<Unit36>
<Filename Value="../lazbeep/beepcontext.pas"/>
<UnitName Value="BeepContext"/>
<CursorPos X="3" Y="39"/>
<TopLine Value="39"/>
<UsageCount Value="21"/>
</Unit36>
<Unit37>
<Filename Value="../lazbeep/beepframe.pas"/>
<UnitName Value="beepframe"/>
<UsageCount Value="21"/>
</Unit37>
<Unit38>
<Filename Value="../lazbeep/beeplistener.pas"/>
<UnitName Value="BeepListener"/>
<CursorPos X="53" Y="331"/>
<TopLine Value="292"/>
<UsageCount Value="21"/>
</Unit38>
<Unit39>
<Filename Value="../axl/axl.pas"/>
<UnitName Value="axl"/>
<UsageCount Value="21"/>
</Unit39>
<Unit40>
<Filename Value="test_listener.lrs"/>
<CursorPos X="17" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="8"/>
</Unit40>
<Unit41>
<Filename Value="../lazbeep/beeputils.pas"/>
<UnitName Value="BeepUtils"/>
<CursorPos X="3" Y="46"/>
<TopLine Value="31"/>
<UsageCount Value="7"/>
</Unit41>
<Unit42>
<Filename Value="../vortex/vortex.pas"/>
<UnitName Value="LibVortex"/>
<CursorPos X="6" Y="5"/>
<TopLine Value="1"/>
<UsageCount Value="18"/>
</Unit42>
<Unit43>
<Filename Value="../../libvortex-1.1/dev/src/vortex_listener.c"/>
<CursorPos X="1" Y="1418"/>
<TopLine Value="1380"/>
<UsageCount Value="7"/>
<SyntaxHighlighter Value="C++"/>
</Unit43>
<Unit44>
<Filename Value="../beepfp/beepcontext.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepContext"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<EditorIndex Value="7"/>
<UsageCount Value="54"/>
<Loaded Value="True"/>
</Unit44>
<Unit45>
<Filename Value="../beepfp/beeplistener.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepListener"/>
<CursorPos X="57" Y="17"/>
<TopLine Value="1"/>
<EditorIndex Value="6"/>
<UsageCount Value="54"/>
<Loaded Value="True"/>
</Unit45>
<Unit46>
<Filename Value="../beepfp/beepconnection.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepConnection"/>
<CursorPos X="41" Y="21"/>
<TopLine Value="1"/>
<EditorIndex Value="4"/>
<UsageCount Value="54"/>
<Loaded Value="True"/>
</Unit46>
<Unit47>
<Filename Value="../beepfp/beepprofile.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepProfile"/>
<CursorPos X="12" Y="36"/>
<TopLine Value="1"/>
<EditorIndex Value="3"/>
<UsageCount Value="54"/>
<Loaded Value="True"/>
</Unit47>
<Unit48>
<Filename Value="../beepfp/beepchannel.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepChannel"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<EditorIndex Value="2"/>
<UsageCount Value="54"/>
<Loaded Value="True"/>
</Unit48>
<Unit49>
<Filename Value="../beepfp/beepframe.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BeepFrame"/>
<CursorPos X="86" Y="25"/>
<TopLine Value="1"/>
<EditorIndex Value="1"/>
<UsageCount Value="54"/>
<Loaded Value="True"/>
</Unit49>
<Unit50>
<Filename Value="../beepfp.pas"/>
<UnitName Value="BeepFp"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="7"/>
</Unit50>
<Unit51>
<Filename Value="../../../lazarus_sw/debugger/cmdlinedebugger.pp"/>
<UnitName Value="CmdLineDebugger"/>
<CursorPos X="102" Y="376"/>
<TopLine Value="356"/>
<UsageCount Value="7"/>
</Unit51>
<Unit52>
<Filename Value="../axl/axl_stream.inc"/>
<CursorPos X="95" Y="76"/>
<TopLine Value="51"/>
<UsageCount Value="10"/>
</Unit52>
<Unit53>
<Filename Value="../vortex/vortex1_1.pas"/>
<UnitName Value="vortex1_1"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit53>
</Units>
<JumpHistory Count="18" HistoryIndex="17">
<Position1>
<Filename Value="testlistenmain.pas"/>
<Caret Line="191" Column="39" TopLine="185"/>
</Position1>
<Position2>
<Filename Value="testlistenmain.pas"/>
<Caret Line="103" Column="34" TopLine="79"/>
</Position2>
<Position3>
<Filename Value="testlistenmain.pas"/>
<Caret Line="218" Column="90" TopLine="186"/>
</Position3>
<Position4>
<Filename Value="testlistenmain.pas"/>
<Caret Line="103" Column="8" TopLine="80"/>
</Position4>
<Position5>
<Filename Value="testlistenmain.pas"/>
<Caret Line="82" Column="35" TopLine="58"/>
</Position5>
<Position6>
<Filename Value="testlistenmain.pas"/>
<Caret Line="104" Column="20" TopLine="82"/>
</Position6>
<Position7>
<Filename Value="testlistenmain.pas"/>
<Caret Line="158" Column="48" TopLine="134"/>
</Position7>
<Position8>
<Filename Value="testlistenmain.pas"/>
<Caret Line="68" Column="15" TopLine="44"/>
</Position8>
<Position9>
<Filename Value="testlistenmain.pas"/>
<Caret Line="158" Column="39" TopLine="134"/>
</Position9>
<Position10>
<Filename Value="testlistenmain.pas"/>
<Caret Line="68" Column="1" TopLine="44"/>
</Position10>
<Position11>
<Filename Value="testlistenmain.pas"/>
<Caret Line="69" Column="28" TopLine="69"/>
</Position11>
<Position12>
<Filename Value="testlistenmain.pas"/>
<Caret Line="191" Column="25" TopLine="184"/>
</Position12>
<Position13>
<Filename Value="testlistenmain.pas"/>
<Caret Line="44" Column="53" TopLine="1"/>
</Position13>
<Position14>
<Filename Value="testlistenmain.pas"/>
<Caret Line="45" Column="21" TopLine="1"/>
</Position14>
<Position15>
<Filename Value="../beepfp/beepprofile.pas"/>
<Caret Line="36" Column="12" TopLine="1"/>
</Position15>
<Position16>
<Filename Value="../beepfp/beepconnection.pas"/>
<Caret Line="52" Column="59" TopLine="30"/>
</Position16>
<Position17>
<Filename Value="test_listener.lpr"/>
<Caret Line="39" Column="49" TopLine="4"/>
</Position17>
<Position18>
<Filename Value="test_listener.lpr"/>
<Caret Line="15" Column="47" TopLine="9"/>
</Position18>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<Libraries Value="../axl/"/>
<OtherUnitFiles Value="../axl/;../vortex/;../beepfp/"/>
<UnitOutputDirectory Value="lib"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<CStyleOperator Value="False"/>
<AllowLabel Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dDBG_BEEP"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,60 @@
(*******************************************************************************
* test_client.pas: App to test BeepFp classes
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* test_client is an application used to test the BeepFp classes, mainly
* used during development. To see how to use the classes in a real application,
* see BEEP_Client and BEEP_Listen
******************************************************************************)
program test_listener;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
//{$IFDEF UseCThreads}
cthreads,
//{$ENDIF}
{$ENDIF}
Forms, LResources, Interfaces, TestListenMain,
BeepChannel, BeepConnection, BeepContext, BeepFrame, BeepListener,
BeepProfile;
{
cthread cmem stack crash
N N N N
N N Y Y sodra listen
Y N Y Y sodra listen
N Y Y Y sodra listen
Y Y Y Y sodra listen
}
{$IFDEF WINDOWS}{$R test_listener.rc}{$ENDIF}
begin
{$I test_listener.lrs}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "test_listener.manifest"
MAINICON ICON "test_listener.ico"

View File

@ -0,0 +1,133 @@
object Form1: TForm1
Left = 446
Height = 300
Top = 171
Width = 400
Caption = 'Form1'
ClientHeight = 300
ClientWidth = 400
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '0.9.27'
object ButtonCon: TButton
Left = 8
Height = 25
Top = 8
Width = 75
Caption = 'Connect'
OnClick = ButtonConClick
TabOrder = 0
end
object ButtonDiscon: TButton
Left = 96
Height = 25
Top = 8
Width = 96
Caption = 'Disconnect'
OnClick = ButtonDisconClick
TabOrder = 1
end
object CheckBoxCon: TCheckBox
Left = 208
Height = 24
Top = 8
Width = 103
Caption = 'Connected'
TabOrder = 2
end
object ButtonPoolNew: TButton
Left = 8
Height = 25
Top = 80
Width = 96
Caption = 'Create Pool'
OnClick = ButtonPoolNewClick
TabOrder = 3
end
object EditPoolSize: TEdit
Left = 312
Height = 26
Top = 80
Width = 80
TabOrder = 4
end
object ButtonChanNew: TButton
Left = 8
Height = 25
Top = 216
Width = 120
Caption = 'Open Channel'
OnClick = ButtonChanNewClick
TabOrder = 5
end
object ButtonChanClose: TButton
Left = 136
Height = 25
Top = 216
Width = 120
Caption = 'Close Channel'
OnClick = ButtonChanCloseClick
TabOrder = 6
end
object ButtonSendMsg: TButton
Left = 8
Height = 25
Top = 248
Width = 120
Caption = 'Send MSG'
OnClick = ButtonSendMsgClick
TabOrder = 7
end
object Edit1: TEdit
Left = 136
Height = 26
Top = 248
Width = 240
TabOrder = 8
Text = 'MSG Hallo'
end
object ButtonPoolAdd: TButton
Left = 117
Height = 25
Top = 56
Width = 75
Caption = 'Add 2 Ch'
OnClick = ButtonPoolAddClick
TabOrder = 9
end
object ButtonPoolCount: TButton
Left = 200
Height = 25
Top = 81
Width = 75
Caption = 'Count'
OnClick = ButtonPoolCountClick
TabOrder = 10
end
object ButtonSendMsgPool: TButton
Left = 8
Height = 25
Top = 112
Width = 120
Caption = 'Send MSG'
OnClick = ButtonSendMsgPoolClick
TabOrder = 11
end
object Edit2: TEdit
Left = 136
Height = 26
Top = 112
Width = 240
TabOrder = 12
Text = 'MSG Hallo'
end
object ButtonDelCh: TButton
Left = 117
Height = 25
Top = 81
Width = 75
Caption = 'Del 1 Ch'
OnClick = ButtonDelChClick
TabOrder = 13
end
end

View File

@ -0,0 +1,36 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#190#1#6'Height'#3','#1#3'Top'#3#171#0#5'W'
+'idth'#3#144#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3','#1#11'ClientWidth'
+#3#144#1#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#10'LCLV'
+'ersion'#6#6'0.9.27'#0#7'TButton'#9'ButtonCon'#4'Left'#2#8#6'Height'#2#25#3
+'Top'#2#8#5'Width'#2'K'#7'Caption'#6#7'Connect'#7'OnClick'#7#14'ButtonConCli'
+'ck'#8'TabOrder'#2#0#0#0#7'TButton'#12'ButtonDiscon'#4'Left'#2'`'#6'Height'#2
+#25#3'Top'#2#8#5'Width'#2'`'#7'Caption'#6#10'Disconnect'#7'OnClick'#7#17'But'
+'tonDisconClick'#8'TabOrder'#2#1#0#0#9'TCheckBox'#11'CheckBoxCon'#4'Left'#3
+#208#0#6'Height'#2#24#3'Top'#2#8#5'Width'#2'g'#7'Caption'#6#9'Connected'#8'T'
+'abOrder'#2#2#0#0#7'TButton'#13'ButtonPoolNew'#4'Left'#2#8#6'Height'#2#25#3
+'Top'#2'P'#5'Width'#2'`'#7'Caption'#6#11'Create Pool'#7'OnClick'#7#18'Button'
+'PoolNewClick'#8'TabOrder'#2#3#0#0#5'TEdit'#12'EditPoolSize'#4'Left'#3'8'#1#6
+'Height'#2#26#3'Top'#2'P'#5'Width'#2'P'#8'TabOrder'#2#4#0#0#7'TButton'#13'Bu'
+'ttonChanNew'#4'Left'#2#8#6'Height'#2#25#3'Top'#3#216#0#5'Width'#2'x'#7'Capt'
+'ion'#6#12'Open Channel'#7'OnClick'#7#18'ButtonChanNewClick'#8'TabOrder'#2#5
+#0#0#7'TButton'#15'ButtonChanClose'#4'Left'#3#136#0#6'Height'#2#25#3'Top'#3
+#216#0#5'Width'#2'x'#7'Caption'#6#13'Close Channel'#7'OnClick'#7#20'ButtonCh'
+'anCloseClick'#8'TabOrder'#2#6#0#0#7'TButton'#13'ButtonSendMsg'#4'Left'#2#8#6
+'Height'#2#25#3'Top'#3#248#0#5'Width'#2'x'#7'Caption'#6#8'Send MSG'#7'OnClic'
+'k'#7#18'ButtonSendMsgClick'#8'TabOrder'#2#7#0#0#5'TEdit'#5'Edit1'#4'Left'#3
+#136#0#6'Height'#2#26#3'Top'#3#248#0#5'Width'#3#240#0#8'TabOrder'#2#8#4'Text'
+#6#9'MSG Hallo'#0#0#7'TButton'#13'ButtonPoolAdd'#4'Left'#2'u'#6'Height'#2#25
+#3'Top'#2'8'#5'Width'#2'K'#7'Caption'#6#8'Add 2 Ch'#7'OnClick'#7#18'ButtonPo'
+'olAddClick'#8'TabOrder'#2#9#0#0#7'TButton'#15'ButtonPoolCount'#4'Left'#3#200
+#0#6'Height'#2#25#3'Top'#2'Q'#5'Width'#2'K'#7'Caption'#6#5'Count'#7'OnClick'
+#7#20'ButtonPoolCountClick'#8'TabOrder'#2#10#0#0#7'TButton'#17'ButtonSendMsg'
+'Pool'#4'Left'#2#8#6'Height'#2#25#3'Top'#2'p'#5'Width'#2'x'#7'Caption'#6#8'S'
+'end MSG'#7'OnClick'#7#22'ButtonSendMsgPoolClick'#8'TabOrder'#2#11#0#0#5'TEd'
+'it'#5'Edit2'#4'Left'#3#136#0#6'Height'#2#26#3'Top'#2'p'#5'Width'#3#240#0#8
+'TabOrder'#2#12#4'Text'#6#9'MSG Hallo'#0#0#7'TButton'#11'ButtonDelCh'#4'Left'
+#2'u'#6'Height'#2#25#3'Top'#2'Q'#5'Width'#2'K'#7'Caption'#6#8'Del 1 Ch'#7'On'
+'Click'#7#16'ButtonDelChClick'#8'TabOrder'#2#13#0#0#0
]);

View File

@ -0,0 +1,238 @@
(*******************************************************************************
* TestClientMain.pas: Program to test BeepFp classes
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TestClientMain is an application used to test the BeepFp classes, mainly
* used during development. To see how to use the classes in a real application,
* see BEEP_Client and BEEP_Listen
******************************************************************************)
unit TestClientMain;
{$mode objfpc}{$H+}
interface
uses
Classes, StdCtrls, SysUtils, FileUtil, LResources, Forms, Controls, Graphics,
Dialogs,
Vortex, BeepContext, BeepConnection, BeepProfile,
BeepChannel, BeepFrame, BeepChannelPool;
type
{ TForm1 }
TForm1 = class(TForm)
ButtonDelCh: TButton;
ButtonPoolCount: TButton;
ButtonPoolAdd: TButton;
ButtonSendMsg: TButton;
ButtonChanClose: TButton;
ButtonChanNew: TButton;
ButtonPoolNew: TButton;
ButtonCon: TButton;
ButtonDiscon: TButton;
ButtonSendMsgPool: TButton;
CheckBoxCon: TCheckBox;
Edit1: TEdit;
Edit2: TEdit;
EditPoolSize: TEdit;
procedure ButtonChanCloseClick(Sender: TObject);
procedure ButtonChanNewClick(Sender: TObject);
procedure ButtonConClick(Sender: TObject);
procedure ButtonDelChClick(Sender: TObject);
procedure ButtonDisconClick(Sender: TObject);
procedure ButtonPoolAddClick(Sender: TObject);
procedure ButtonPoolCountClick(Sender: TObject);
procedure ButtonPoolNewClick(Sender: TObject);
procedure ButtonSendMsgClick(Sender: TObject);
procedure ButtonSendMsgPoolClick(Sender: TObject);
procedure ChannelClose(ChanNum: integer);
procedure ChannelCreated(ChanNum: integer);
procedure ChannelFailed(ChanNum: integer);
procedure ConnectionConnected(Sender: TObject);
procedure ConnectionConnectionFailed(Sender: TObject);
procedure ConnectionDisconnected(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure PoolPoolCreated(Sender: TObject);
procedure ProfileFrameReceived(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
private
Ctx: TBeepContext;
Connection: TBeepConnectionInitiator;
Profile: TBeepProfile;
Pool: TBeepChannelPool;
Channel: TBeepChannelInitiator;
public
{ public declarations }
end;
const
PLAIN_PROFILE = 'http://fact.aspl.es/profiles/plain_profile';
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.ButtonChanCloseClick(Sender: TObject);
begin
Channel.Free;
end;
procedure TForm1.ButtonChanNewClick(Sender: TObject);
begin
Channel := TBeepChannelInitiator.Create(Connection, Profile.Name, 1);
Channel.OnCloseNotify := @ChannelCreated;
Channel.OnFailed := @ChannelFailed;
Channel.OnCloseNotify := @ChannelClose;
Channel.OpenChannel;
end;
procedure TForm1.ButtonConClick(Sender: TObject);
begin
Connection.Connect;
end;
procedure TForm1.ButtonDelChClick(Sender: TObject);
begin
Pool.RemoveChannels(1);
end;
procedure TForm1.ButtonDisconClick(Sender: TObject);
begin
Connection.Disconnect;
end;
procedure TForm1.ButtonPoolAddClick(Sender: TObject);
begin
Pool.AddChannels(2);
end;
procedure TForm1.ButtonPoolCountClick(Sender: TObject);
begin
EditPoolSize.Text := IntToStr(Pool.Count);
end;
procedure TForm1.ButtonPoolNewClick(Sender: TObject);
begin
EditPoolSize.Text := '';
Pool.Initialise;
end;
procedure TForm1.ButtonSendMsgClick(Sender: TObject);
var
MsgID: integer = 0;
begin
Channel.SendMSG(PByte(PChar(Edit1.Text)), length(Edit1.Text), MsgID);
end;
procedure TForm1.ButtonSendMsgPoolClick(Sender: TObject);
var
Chan: TBeepChannel;
ID: integer = 0;
begin
Chan := Pool.GetNextReady(false);
writeln(Format('Got channel %d from pool', [Chan.Number]));
Chan.SendMSG(Edit2.Text, ID);
Pool.ReleaseChannel(Chan);
end;
procedure TForm1.ChannelClose(ChanNum: integer);
begin
writeln('Closed channel '+IntToStr(ChanNum));
end;
procedure TForm1.ChannelCreated(ChanNum: integer);
begin
writeln('Created channel '+inttostr(ChanNum));
end;
procedure TForm1.ChannelFailed(ChanNum: integer);
begin
writeln('Failed to create channel '+IntToStr(ChanNum));
end;
procedure TForm1.ConnectionConnected(Sender: TObject);
begin
CheckBoxCon.Checked := true;
end;
procedure TForm1.ConnectionConnectionFailed(Sender: TObject);
begin
CheckBoxCon.Checked := false;
end;
procedure TForm1.ConnectionDisconnected(Sender: TObject);
begin
CheckBoxCon.Checked := false;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Ctx := TBeepContext.Create;
Connection := TBeepConnectionInitiator.Create(Ctx, 'localhost', '44000');
Connection.OnConnected := @ConnectionConnected;
// Connection.OnConnectionFailed := @ConnectionConnectionFailed;
Connection.OnDisconnected := @ConnectionDisconnected;
Profile := TBeepProfile.Create(Ctx, PLAIN_PROFILE, nil, nil);
Profile.OnFrameReceived := @ProfileFrameReceived;
Profile.RegisterProfile;
Pool := TBeepChannelPool.Create(Connection, Profile.Name, 3);
Pool.OnPoolCreated := @PoolPoolCreated;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Pool.Free;
Profile.Free;
Connection.Free;
Ctx.Free;
end;
procedure TForm1.PoolPoolCreated(Sender: TObject);
begin
EditPoolSize.Text := IntToStr(Pool.Count);
end;
procedure TForm1.ProfileFrameReceived(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
begin
writeln(aConnection.Host+':'+aConnection.Port+
' Channel '+IntToStr( aChannel.Number)+
' Message: ' + string(PCHar(aFrame.PayloadAsByteArray)) );
end;
initialization
{$I testclientmain.lrs}
end.

View File

@ -0,0 +1,97 @@
object Form1: TForm1
Left = 376
Height = 300
Top = 232
Width = 400
Caption = 'Form1'
ClientHeight = 300
ClientWidth = 400
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '0.9.27'
object ButtonStart: TButton
Left = 8
Height = 25
Top = 8
Width = 75
Caption = 'Listen'
OnClick = ButtonStartClick
TabOrder = 0
end
object ButtonStop: TButton
Left = 96
Height = 25
Top = 8
Width = 96
Caption = 'Stop'
OnClick = ButtonStopClick
TabOrder = 1
end
object CheckBoxListen: TCheckBox
Left = 208
Height = 24
Top = 8
Width = 88
Caption = 'Listening'
TabOrder = 2
end
object ButtonPoolNew: TButton
Left = 8
Height = 25
Top = 80
Width = 96
Caption = 'Create Pool'
OnClick = ButtonPoolNewClick
TabOrder = 3
end
object ButtonPoolClose: TButton
Left = 112
Height = 25
Top = 80
Width = 96
Caption = 'Close pool'
TabOrder = 4
end
object EditPoolSize: TEdit
Left = 232
Height = 26
Top = 80
Width = 80
TabOrder = 5
end
object ButtonChanNew: TButton
Left = 8
Height = 25
Top = 128
Width = 120
Caption = 'Open Channel'
OnClick = ButtonChanNewClick
TabOrder = 6
end
object ButtonChanClose: TButton
Left = 136
Height = 25
Top = 128
Width = 120
Caption = 'Close Channel'
OnClick = ButtonChanCloseClick
TabOrder = 7
end
object ButtonSendMsg: TButton
Left = 8
Height = 25
Top = 160
Width = 120
Caption = 'Send MSG'
OnClick = ButtonSendMsgClick
TabOrder = 8
end
object Edit1: TEdit
Left = 136
Height = 26
Top = 160
Width = 240
TabOrder = 9
Text = 'MSG Hallo'
end
end

View File

@ -0,0 +1,27 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'x'#1#6'Height'#3','#1#3'Top'#3#232#0#5'Wi'
+'dth'#3#144#1#7'Caption'#6#5'Form1'#12'ClientHeight'#3','#1#11'ClientWidth'#3
+#144#1#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#10'LCLVer'
+'sion'#6#6'0.9.27'#0#7'TButton'#11'ButtonStart'#4'Left'#2#8#6'Height'#2#25#3
+'Top'#2#8#5'Width'#2'K'#7'Caption'#6#6'Listen'#7'OnClick'#7#16'ButtonStartCl'
+'ick'#8'TabOrder'#2#0#0#0#7'TButton'#10'ButtonStop'#4'Left'#2'`'#6'Height'#2
+#25#3'Top'#2#8#5'Width'#2'`'#7'Caption'#6#4'Stop'#7'OnClick'#7#15'ButtonStop'
+'Click'#8'TabOrder'#2#1#0#0#9'TCheckBox'#14'CheckBoxListen'#4'Left'#3#208#0#6
+'Height'#2#24#3'Top'#2#8#5'Width'#2'X'#7'Caption'#6#9'Listening'#8'TabOrder'
+#2#2#0#0#7'TButton'#13'ButtonPoolNew'#4'Left'#2#8#6'Height'#2#25#3'Top'#2'P'
+#5'Width'#2'`'#7'Caption'#6#11'Create Pool'#7'OnClick'#7#18'ButtonPoolNewCli'
+'ck'#8'TabOrder'#2#3#0#0#7'TButton'#15'ButtonPoolClose'#4'Left'#2'p'#6'Heigh'
+'t'#2#25#3'Top'#2'P'#5'Width'#2'`'#7'Caption'#6#10'Close pool'#8'TabOrder'#2
+#4#0#0#5'TEdit'#12'EditPoolSize'#4'Left'#3#232#0#6'Height'#2#26#3'Top'#2'P'#5
+'Width'#2'P'#8'TabOrder'#2#5#0#0#7'TButton'#13'ButtonChanNew'#4'Left'#2#8#6
+'Height'#2#25#3'Top'#3#128#0#5'Width'#2'x'#7'Caption'#6#12'Open Channel'#7'O'
+'nClick'#7#18'ButtonChanNewClick'#8'TabOrder'#2#6#0#0#7'TButton'#15'ButtonCh'
+'anClose'#4'Left'#3#136#0#6'Height'#2#25#3'Top'#3#128#0#5'Width'#2'x'#7'Capt'
+'ion'#6#13'Close Channel'#7'OnClick'#7#20'ButtonChanCloseClick'#8'TabOrder'#2
+#7#0#0#7'TButton'#13'ButtonSendMsg'#4'Left'#2#8#6'Height'#2#25#3'Top'#3#160#0
+#5'Width'#2'x'#7'Caption'#6#8'Send MSG'#7'OnClick'#7#18'ButtonSendMsgClick'#8
+'TabOrder'#2#8#0#0#5'TEdit'#5'Edit1'#4'Left'#3#136#0#6'Height'#2#26#3'Top'#3
+#160#0#5'Width'#3#240#0#8'TabOrder'#2#9#4'Text'#6#9'MSG Hallo'#0#0#0
]);

View File

@ -0,0 +1,242 @@
(*******************************************************************************
* TestListenMain.pas: Program to test BeepFp classes
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*
* This file is part of BeepFp.
*
* BeepFp is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* BeepFp 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 Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with BeepFp. If not, see <http://www.gnu.org/licenses/>.
*
* BeepFp is further covered by a special exception as described in the file
* COPYING.modifiedLGPL.txt which should have been included in the
* distribution. If not, see
* <http://svn.freepascal.org/svn/lazarus/trunk/COPYING.modifiedLGPL.txt>
*******************************************************************************
* TestListenMain is an application used to test the BeepFp classes, mainly
* used during development. To see how to use the classes in a real application,
* see BEEP_Client and BEEP_Listen
******************************************************************************)
unit TestListenMain;
{$mode objfpc}{$H+}
{TODO: list of remaining library problems}
{
- Valgrind report reachable memory. Find out where that is, maybe in LCL.
- Reachable memory because threading doesn't clear all at program stop.
}
interface
uses
Classes, StdCtrls, SysUtils, FileUtil, LResources, Forms, Controls, Graphics,
Dialogs,
BeepContext, BeepListener, BeepConnection, BeepProfile,
BeepChannel, BeepFrame;
type
{ TForm1 }
TForm1 = class(TForm)
ButtonSendMsg: TButton;
ButtonChanClose: TButton;
ButtonChanNew: TButton;
ButtonPoolNew: TButton;
ButtonPoolClose: TButton;
ButtonStart: TButton;
ButtonStop: TButton;
CheckBoxListen: TCheckBox;
Edit1: TEdit;
EditPoolSize: TEdit;
procedure ButtonChanCloseClick(Sender: TObject);
procedure ButtonChanNewClick(Sender: TObject);
procedure ButtonStartClick(Sender: TObject);
procedure ButtonStopClick(Sender: TObject);
procedure ButtonPoolNewClick(Sender: TObject);
procedure ButtonSendMsgClick(Sender: TObject);
procedure ChannelClose(ChanNum: integer);
procedure ChannelCreated(ChanNum: integer);
procedure ChannelFailed(ChanNum: integer);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ListenAcceptConnection(aConnection: TBeepConnectionListener;
var Accept: boolean);
procedure ListenConnectionClose(aConnection: TBeepConnection);
procedure ListenFailed(aListener: TObject; const ErrMsg: string);
procedure ListenReady(aListener: TObject);
procedure ListenStop(aListener: TObject);
procedure PoolPoolCreated(Sender: TObject);
procedure ProfileFrameReceived(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
private
Ctx: TBeepContext;
Listen: TBeepListener;
Connection: TBeepConnection;
Profile: TBeepProfile;
//Pool: TBeepChannelPool;
Channel: TBeepChannelInitiator;
public
{ public declarations }
end;
const
PLAIN_PROFILE = 'http://fact.aspl.es/profiles/plain_profile';
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.ButtonChanCloseClick(Sender: TObject);
begin
Channel.Free;
end;
procedure TForm1.ButtonChanNewClick(Sender: TObject);
begin
Channel := TBeepChannelInitiator.Create(Connection, Profile.Name, 1);
Channel.OnCreated := @ChannelCreated;
Channel.OnFailed := @ChannelFailed;
Channel.OnCloseNotify := @ChannelClose;
Channel.OpenChannel;
end;
procedure TForm1.ButtonStartClick(Sender: TObject);
begin
Listen.Start;
//Connection.Connect;
end;
procedure TForm1.ButtonStopClick(Sender: TObject);
begin
Listen.Stop;
end;
procedure TForm1.ButtonPoolNewClick(Sender: TObject);
begin
EditPoolSize.Text := '';
//Pool.Initialise;
end;
procedure TForm1.ButtonSendMsgClick(Sender: TObject);
var
MsgID: integer = 0;
begin
Channel.SendMSG(PByte(PChar(Edit1.Text)), length(Edit1.Text), MsgID);
end;
procedure TForm1.ChannelClose(ChanNum: integer);
begin
writeln('Closed channel '+IntToStr(ChanNum));
end;
procedure TForm1.ChannelCreated(ChanNum: integer);
begin
writeln('Created channel '+inttostr(ChanNum));
end;
procedure TForm1.ChannelFailed(ChanNum: integer);
begin
writeln('Failed to create channel '+IntToStr(ChanNum));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Ctx := TBeepContext.Create;
Listen := TBeepListener.Create(Ctx);
Listen.Port := '3000';
Listen.OnReady := @ListenReady;
Listen.OnFailed := @ListenFailed;
Listen.OnStop := @ListenStop;
Listen.OnConnectionAccept := @ListenAcceptConnection;
Listen.OnConnectionClose := @ListenConnectionClose;
// Connection := TBeepConnection.Create(Ctx, 'localhost', '3000');
// Connection.OnConnected := @ConnectionConnected;
//// Connection.OnConnectionFailed := @ConnectionConnectionFailed;
// Connection.OnDisconnected := @ConnectionDisconnected;
//Profile := TBeepProfile.Create(Ctx, PLAIN_PROFILE);
//Profile.OnFrameReceived := @ProfileFrameReceived;
//Profile.RegisterProfile;
//Pool := TBeepChannelPool.Create(Connection, Profile, 3);
//Pool.OnPoolCreated := @PoolPoolCreated;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
//Pool.Free;
//Profile.Free;
//Connection.Free;
Listen.Free;
Ctx.Free;
end;
procedure TForm1.ListenAcceptConnection(aConnection: TBeepConnectionListener;
var Accept: boolean);
begin
//writeln('Accepted connection from: '+aConnection.Host+':'+aConnection.Port);
end;
procedure TForm1.ListenConnectionClose(aConnection: TBeepConnection);
begin
//writeln('Disconnected connection from: '+aConnection.Host+':'+aConnection.Port);
end;
procedure TForm1.ListenFailed(aListener: TObject; const ErrMsg: string);
begin
//writeln('Listener creation failed. Reason: '+ErrMsg);
CheckBoxListen.Checked := false;
end;
procedure TForm1.ListenReady(aListener: TObject);
//var
// Listener: TBeepListener;
begin
//Listener := TBeepListener(aListener);
//writeln('Listener ready on '+Listener.Host+':'+Listener.Port);
CheckBoxListen.Checked := true;
end;
procedure TForm1.ListenStop(aListener: TObject);
//var
// Listener: TBeepListener;
begin
//Listener := TBeepListener(aListener);
//writeln('Listener stopped on '+Listener.Host+':'+Listener.Port);
CheckBoxListen.Checked := false;
end;
procedure TForm1.PoolPoolCreated(Sender: TObject);
begin
//EditPoolSize.Text := IntToStr(Pool.Count);
end;
procedure TForm1.ProfileFrameReceived(aConnection: TBeepConnection;
aChannel: TBeepChannel; aFrame: TBeepFrame);
begin
writeln(aConnection.Host+':'+aConnection.Port+
' Channel '+IntToStr( aChannel.Number)+
' Message: ' + string(PCHar(aFrame.PayloadAsByteArray)) );
end;
initialization
{$I testlistenmain.lrs}
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,705 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Title Value="vortex_simple_client"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<Language Value=""/>
<CharSet Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="80">
<Unit0>
<Filename Value="vortex_simple_client.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="vortex_simple_client"/>
<CursorPos X="36" Y="53"/>
<TopLine Value="76"/>
<EditorIndex Value="0"/>
<UsageCount Value="36"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../vortex.pas"/>
<UnitName Value="Vortex"/>
<CursorPos X="14" Y="207"/>
<TopLine Value="167"/>
<UsageCount Value="33"/>
<Bookmarks Count="1">
<Item0 X="1" Y="88" ID="1"/>
</Bookmarks>
</Unit1>
<Unit2>
<Filename Value="../../lazaxl/axl.pas"/>
<UnitName Value="axl"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="33"/>
</Unit2>
<Unit3>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/baseunix.pp"/>
<UnitName Value="BaseUnix"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit3>
<Unit4>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/packages/fcl-process/src/process.pp"/>
<UnitName Value="process"/>
<CursorPos X="34" Y="37"/>
<TopLine Value="54"/>
<UsageCount Value="9"/>
</Unit4>
<Unit5>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/sysutils.pp"/>
<UnitName Value="sysutils"/>
<CursorPos X="6" Y="239"/>
<TopLine Value="212"/>
<UsageCount Value="9"/>
</Unit5>
<Unit6>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/objpas/sysutils/sysutilh.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit6>
<Unit7>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/packages/fcl-process/src/pipes.pp"/>
<UnitName Value="Pipes"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit7>
<Unit8>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/ipc.pp"/>
<UnitName Value="ipc"/>
<CursorPos X="11" Y="334"/>
<TopLine Value="292"/>
<UsageCount Value="9"/>
</Unit8>
<Unit9>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/packages/fv/src/app.pas"/>
<UnitName Value="App"/>
<CursorPos X="61" Y="20"/>
<TopLine Value="10"/>
<UsageCount Value="9"/>
</Unit9>
<Unit10>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/packages/httpd20/src/aprutil/aprutil.pas"/>
<UnitName Value="aprutil"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit10>
<Unit11>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/inc/systemh.inc"/>
<CursorPos X="3" Y="356"/>
<TopLine Value="332"/>
<UsageCount Value="9"/>
</Unit11>
<Unit12>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/bunxh.inc"/>
<CursorPos X="108" Y="84"/>
<TopLine Value="55"/>
<UsageCount Value="9"/>
</Unit12>
<Unit13>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/linux/system.pp"/>
<UnitName Value="System"/>
<CursorPos X="10" Y="38"/>
<TopLine Value="30"/>
<UsageCount Value="9"/>
</Unit13>
<Unit14>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/linux/osdefs.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit14>
<Unit15>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/sysunixh.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit15>
<Unit16>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/sockets.pp"/>
<UnitName Value="Sockets"/>
<CursorPos X="9" Y="28"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit16>
<Unit17>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/inc/socketsh.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="190"/>
<UsageCount Value="9"/>
</Unit17>
<Unit18>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/inc/sockovl.inc"/>
<CursorPos X="1" Y="194"/>
<TopLine Value="153"/>
<UsageCount Value="9"/>
</Unit18>
<Unit19>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/linux/unxsockh.inc"/>
<CursorPos X="18" Y="97"/>
<TopLine Value="73"/>
<UsageCount Value="9"/>
</Unit19>
<Unit20>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/linux/errno.inc"/>
<CursorPos X="3" Y="159"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit20>
<Unit21>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/errors.pp"/>
<UnitName Value="errors"/>
<CursorPos X="11" Y="18"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit21>
<Unit22>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/linux/errnostr.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit22>
<Unit23>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/unix/unixtype.pp"/>
<UnitName Value="unixtype"/>
<CursorPos X="9" Y="21"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit23>
<Unit24>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/linux/ptypes.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit24>
<Unit25>
<Filename Value="../vortex_thread_pool.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit25>
<Unit26>
<Filename Value="../vortex_win32.inc"/>
<CursorPos X="1" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit26>
<Unit27>
<Filename Value="../../../Pudu/ATM_sw/tripwire/src/server/asoundlib/asoundlib.pas"/>
<UnitName Value="asoundlib"/>
<CursorPos X="1" Y="42"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit27>
<Unit28>
<Filename Value="../../../Pudu/ATM_sw/tripwire/src/server/asoundlib/asoundefh.inc"/>
<CursorPos X="1" Y="13"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
</Unit28>
<Unit29>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.2/rtl/inc/system.inc"/>
<CursorPos X="10" Y="903"/>
<TopLine Value="901"/>
<UsageCount Value="9"/>
</Unit29>
<Unit30>
<Filename Value="../vortex_handlers.inc"/>
<CursorPos X="1" Y="1246"/>
<TopLine Value="1221"/>
<UsageCount Value="10"/>
</Unit30>
<Unit31>
<Filename Value="../vortex_types.inc"/>
<CursorPos X="27" Y="801"/>
<TopLine Value="792"/>
<UsageCount Value="10"/>
</Unit31>
<Unit32>
<Filename Value="../vortex_support.inc"/>
<CursorPos X="1" Y="2"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit32>
<Unit33>
<Filename Value="../vortex_ctx.inc"/>
<CursorPos X="1" Y="2"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit33>
<Unit34>
<Filename Value="../vortex_thread.inc"/>
<CursorPos X="40" Y="8"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit34>
<Unit35>
<Filename Value="../vortex_queue.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit35>
<Unit36>
<Filename Value="../vortex_hash.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit36>
<Unit37>
<Filename Value="../vortex_connection.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit37>
<Unit38>
<Filename Value="../vortex_listener.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit38>
<Unit39>
<Filename Value="../vortex_frame_factory.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit39>
<Unit40>
<Filename Value="../vortex_greetings.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit40>
<Unit41>
<Filename Value="../vortex_profiles.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit41>
<Unit42>
<Filename Value="../vortex_channel.inc"/>
<CursorPos X="2" Y="6"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit42>
<Unit43>
<Filename Value="../vortex_channel_pool.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit43>
<Unit44>
<Filename Value="../vortex_io.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit44>
<Unit45>
<Filename Value="../vortex_reader.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit45>
<Unit46>
<Filename Value="../vortex_dtds.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit46>
<Unit47>
<Filename Value="../vortex_sequencer.inc"/>
<CursorPos X="4" Y="43"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit47>
<Unit48>
<Filename Value="../vortex_errno.inc"/>
<CursorPos X="1" Y="2"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit48>
<Unit49>
<Filename Value="../../../Libs/vortex/test/service_dispatch.c"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit49>
<Unit50>
<Filename Value="../../../Libs/vortex/test/vortex-simple-client.c"/>
<CursorPos X="1" Y="88"/>
<TopLine Value="40"/>
<UsageCount Value="9"/>
<SyntaxHighlighter Value="C++"/>
</Unit50>
<Unit51>
<Filename Value="../../lazaxl/axl_doc.inc"/>
<CursorPos X="1" Y="54"/>
<TopLine Value="30"/>
<UsageCount Value="9"/>
</Unit51>
<Unit52>
<Filename Value="../../lazaxl/axl_doc_imp.inc"/>
<CursorPos X="3" Y="51"/>
<TopLine Value="6"/>
<UsageCount Value="9"/>
</Unit52>
<Unit53>
<Filename Value="../../lazaxl/axl_node.inc"/>
<CursorPos X="1" Y="245"/>
<TopLine Value="227"/>
<UsageCount Value="9"/>
</Unit53>
<Unit54>
<Filename Value="../../lazaxl/axl_node_imp.inc"/>
<CursorPos X="1" Y="65"/>
<TopLine Value="33"/>
<UsageCount Value="9"/>
</Unit54>
<Unit55>
<Filename Value="../vortex_xml_rpc_types.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit55>
<Unit56>
<Filename Value="../COPYING"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
<SyntaxHighlighter Value="None"/>
</Unit56>
<Unit57>
<Filename Value="../README"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
<SyntaxHighlighter Value="None"/>
</Unit57>
<Unit58>
<Filename Value="../README~"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
<SyntaxHighlighter Value="None"/>
</Unit58>
<Unit59>
<Filename Value="../vortex.h"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
<SyntaxHighlighter Value="C++"/>
</Unit59>
<Unit60>
<Filename Value="../vortex_http.pas"/>
<UnitName Value="vortex_http"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit60>
<Unit61>
<Filename Value="../vortex_pull.pas"/>
<UnitName Value="vortex_pull"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit61>
<Unit62>
<Filename Value="../vortex_sasl.pas"/>
<UnitName Value="vortex_sasl"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit62>
<Unit63>
<Filename Value="../vortex_tls.pas"/>
<UnitName Value="vortex_tls"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit63>
<Unit64>
<Filename Value="../vortex_tunnel.pas"/>
<UnitName Value="vortex_tunnel"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit64>
<Unit65>
<Filename Value="../vortex_xml_rpc.pas"/>
<UnitName Value="vortex_xml_rpc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit65>
<Unit66>
<Filename Value="../vortex_xml_rpc_types_imp.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit66>
<Unit67>
<Filename Value="vortex_simple_listener.lpr"/>
<UnitName Value="vortex_simple_listener"/>
<CursorPos X="55" Y="103"/>
<TopLine Value="89"/>
<UsageCount Value="12"/>
</Unit67>
<Unit68>
<Filename Value="../axl/axl.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="axl"/>
<UsageCount Value="23"/>
</Unit68>
<Unit69>
<Filename Value="../vortex/vortex.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Vortex"/>
<CursorPos X="22" Y="420"/>
<TopLine Value="413"/>
<EditorIndex Value="1"/>
<UsageCount Value="23"/>
<Loaded Value="True"/>
</Unit69>
<Unit70>
<Filename Value="../../libvortex-1.1/dev/src/vortex.c"/>
<CursorPos X="1" Y="951"/>
<TopLine Value="922"/>
<UsageCount Value="10"/>
<SyntaxHighlighter Value="C++"/>
</Unit70>
<Unit71>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<CursorPos X="47" Y="58"/>
<TopLine Value="58"/>
<EditorIndex Value="2"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit71>
<Unit72>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/inc/threadh.inc"/>
<CursorPos X="11" Y="109"/>
<TopLine Value="85"/>
<UsageCount Value="11"/>
</Unit72>
<Unit73>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/inc/thread.inc"/>
<CursorPos X="1" Y="47"/>
<TopLine Value="45"/>
<UsageCount Value="11"/>
</Unit73>
<Unit74>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/unix/cthreads.pp"/>
<UnitName Value="cthreads"/>
<CursorPos X="10" Y="246"/>
<TopLine Value="218"/>
<UsageCount Value="11"/>
</Unit74>
<Unit75>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/linux/sysosh.inc"/>
<CursorPos X="3" Y="24"/>
<TopLine Value="1"/>
<UsageCount Value="11"/>
</Unit75>
<Unit76>
<Filename Value="../vortex/vortex_handlers.inc"/>
<CursorPos X="14" Y="1312"/>
<TopLine Value="1264"/>
<EditorIndex Value="4"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit76>
<Unit77>
<Filename Value="../vortex/vortex_types.inc"/>
<CursorPos X="3" Y="894"/>
<TopLine Value="870"/>
<EditorIndex Value="3"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit77>
<Unit78>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/objpas/classes/classesh.inc"/>
<CursorPos X="19" Y="1398"/>
<TopLine Value="1358"/>
<UsageCount Value="10"/>
</Unit78>
<Unit79>
<Filename Value="../../../../../../usr/share/fpcsrc/2.2.4/rtl/unix/tthread.inc"/>
<CursorPos X="11" Y="58"/>
<TopLine Value="38"/>
<UsageCount Value="10"/>
</Unit79>
</Units>
<JumpHistory Count="26" HistoryIndex="25">
<Position1>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="121" Column="45" TopLine="84"/>
</Position1>
<Position2>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="110" Column="46" TopLine="68"/>
</Position2>
<Position3>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="120" Column="5" TopLine="85"/>
</Position3>
<Position4>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="91" Column="41" TopLine="66"/>
</Position4>
<Position5>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="93" Column="65" TopLine="69"/>
</Position5>
<Position6>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="91" Column="104" TopLine="67"/>
</Position6>
<Position7>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="93" Column="55" TopLine="84"/>
</Position7>
<Position8>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="132" Column="37" TopLine="94"/>
</Position8>
<Position9>
<Filename Value="../vortex/vortex_handlers.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position9>
<Position10>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="122" Column="1" TopLine="84"/>
</Position10>
<Position11>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="105" Column="14" TopLine="68"/>
</Position11>
<Position12>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="76" Column="35" TopLine="52"/>
</Position12>
<Position13>
<Filename Value="../vortex/vortex_handlers.inc"/>
<Caret Line="1293" Column="14" TopLine="1263"/>
</Position13>
<Position14>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="66" Column="13" TopLine="42"/>
</Position14>
<Position15>
<Filename Value="../vortex/vortex_thread_imp.inc"/>
<Caret Line="49" Column="20" TopLine="38"/>
</Position15>
<Position16>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="64" Column="11" TopLine="46"/>
</Position16>
<Position17>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="36" Column="32" TopLine="1"/>
</Position17>
<Position18>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="147" Column="14" TopLine="99"/>
</Position18>
<Position19>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="119" Column="48" TopLine="99"/>
</Position19>
<Position20>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="50" Column="9" TopLine="10"/>
</Position20>
<Position21>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="50" Column="9" TopLine="10"/>
</Position21>
<Position22>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="77" Column="29" TopLine="62"/>
</Position22>
<Position23>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="52" Column="4" TopLine="14"/>
</Position23>
<Position24>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="53" Column="11" TopLine="30"/>
</Position24>
<Position25>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="69" Column="2" TopLine="44"/>
</Position25>
<Position26>
<Filename Value="vortex_simple_client.lpr"/>
<Caret Line="147" Column="24" TopLine="101"/>
</Position26>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<OtherUnitFiles Value="/home/wimpie/development/lib/lazvortex/;/home/wimpie/development/lib/lazaxl/;/home/wimpie/development/lib/lazbeep/axl/;/home/wimpie/development/lib/lazbeep/vortex/"/>
<UnitOutputDirectory Value="lib"/>
</SearchPaths>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Watches Count="2">
<Item1>
<Expression Value="thread_def"/>
</Item1>
<Item2>
<Expression Value="pinteger(thread_def)"/>
</Item2>
</Watches>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,149 @@
program vortex_simple_client;
(*
* vortex_simple_listener: C to Free Pascal translation.
* Copyright (C) 2009, Wimpie Nortje <wimpienortje@gmail.com>
*)
(*
* LibVortex: A BEEP (RFC3080/RFC3081) implementation.
* Copyright (C) 2008 Advanced Software Production Line, S.L.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
* You may find a copy of the license under this software is released
* at COPYING file. This is LGPL software: you are welcome to develop
* proprietary applications using this library without any royalty or
* fee but returning back any change, improvement or addition in the
* form of source code, project image, documentation patches, etc.
*
* For commercial support on build BEEP enabled solutions contact us:
*
* Postal address:
* Advanced Software Production Line, S.L.
* C/ Antonio Suarez Nº 10,
* Edificio Alius A, Despacho 102
* Alcalá de Henares 28802 (Madrid)
* Spain
*
* Email address:
* info@aspl.es - http://www.aspl.es/vortex
*)
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
sysutils,
axl, vortex;
const
PLAIN_PROFILE = 'http://fact.aspl.es/profiles/plain_profile';
var
connection : PVortexConnection = nil;
channel : PVortexChannel = nil;
frame : PVortexFrame = nil;
wait_reply : PWaitReplyData = nil;
ctx : PVortexCtx = nil;
msg_no : longint = 0;
{$IFDEF WINDOWS}{$R vortex_simple_client.rc}{$ENDIF}
{$goto on}
label
_end;
begin
{ init vortex library }
ctx := vortex_ctx_new ();
if (axl_false = vortex_init_ctx (ctx)) then
begin
{ unable to init vortex }
vortex_ctx_free (ctx);
RunError(1);
end; { end if }
{ creates a new connection against localhost:44000 }
writeln ('connecting to localhost:44000...');
connection := vortex_connection_new (ctx, 'localhost', '44000', nil, nil);
if (axl_false = vortex_connection_is_ok (connection, axl_false)) then
begin
writeln('Unable to connect remote server, error was: ',
vortex_connection_get_message (connection));
goto _end;
end;
writeln('ok');
{* create a new channel (by chosing 0 as channel number the
* Vortex Library will automatically assign the new channel
* number free. *}
channel := vortex_channel_new (connection, 0,
PLAIN_PROFILE,
{ no close handling }
nil, nil,
{* no frame receive async
* handling *}
nil, nil,
{* no async channel creation *}
nil, nil);
if (channel = nil) then
begin
writeln('Unable to create the channel..');
goto _end;
end;
{ create a wait reply }
wait_reply := vortex_channel_create_wait_reply ();
{ now send the message using msg_and_wait/v }
if (axl_false = vortex_channel_send_msg_and_wait (channel, PChar('my message'), strlen ('my message'), msg_no, wait_reply)) then
begin
writeln('Unable to send my message');
vortex_channel_free_wait_reply (wait_reply);
vortex_channel_close (channel, nil);
goto _end;
end;
{* get blocked until the reply arrives, the wait_reply object
* must not be freed after this function because it already
* free it. *}
frame := vortex_channel_wait_reply (channel, msg_no, wait_reply);
if (frame = nil) then
begin
writeln('there was an error while receiving the reply or a timeout have occur');
vortex_channel_close (channel, nil);
goto _end;
end;
writeln('my reply have arrived: (size: ',vortex_frame_get_payload_size (frame),'):');
writeln( Pchar( vortex_frame_get_payload (frame) ) );
_end:
vortex_connection_close (connection);
{ terminate execution context }
vortex_exit_ctx (ctx, axl_false);
{ free ctx }
vortex_ctx_free (ctx);
end.

View File

@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "vortex_simple_client.manifest"
MAINICON ICON "vortex_simple_client.ico"

Some files were not shown because too many files have changed in this diff Show More