Compare commits

..

1 Commits
1.0.3 ... v0.2

Author SHA1 Message Date
Jocelyn Fiat
5ac47fff05 updated README.md 2013-01-31 16:34:43 +01:00
1406 changed files with 33699 additions and 110420 deletions

3
.gitignore vendored
View File

@@ -2,6 +2,3 @@ EIFGENs
tests/temp/
.svn/
*.swp
*~
*.scm
*#

View File

@@ -1,7 +1,38 @@
History for Eiffel-Web-Framework
[2015-06-10]
* Updated EWF design to better support concurrency, including SCOOP via
the new standalone connector.
[2011-09-23] Jocelyn
* library "ewsgi":
- NEW simple autotest cases using Nino web server
-fixed issue with RAW_POST_DATA being added in form_data_parameters
instead of meta_variables ...
- Implemented WGI_VALUE for parameter's type (query_parameter,
form_data_parameter, item ...)
* Nino connector: added feature to shutdown the server from the WGI application
* NEW library "http_client": a new library to perform simple http requests
such as get, head, post, put, ... (currently implemented with Eiffel cURL)
* NEW library "http_authorization": added simple library to support
HTTP_AUTHORIZATION. For now only "Basic" auth type is supported ..
[2011-09-22] Javier
* NEW Example: added partial Restbuck example
[2011-09-21] Jocelyn
* Nino connector: fixed an issue with missing value for Content-Type and Content-Length
[2011-09-13] Jocelyn
* library "router": now using a generic design to allow customization of
request handler context class.
* NEW library "server/request/rest": first attempt to provide a library to
help building RESTful application (the interfaces are likely to change
soon) EXPERIMENTAL
[2011-09-09] Jocelyn
* library "uri-template": better support for {/vars} and {?vars}
[2011-09-07] Jocelyn
* library "router": now routing depends on uri (or uri template) and request methods
* Nino connector: Fixed issue where HTTP_ prefix were missing for header meta variable.
[2011-09-07] Jocelyn
* changelog: starting to write down changelogs file
[Previous ] Many significant changes in v0

View File

@@ -1,142 +0,0 @@
# Contributing to this project
Please take a moment to review this document in order to make the contribution
process easy and effective for everyone involved.
Following these guidelines helps to communicate that you respect the time of
the developers managing and developing this open source project. In return,
they should reciprocate that respect in addressing your issue or assessing
patches and features.
## Using the issue tracker
The issue tracker is the preferred channel for [bug reports](#bugs),
[features requests](#features) and [submitting pull
requests](#pull-requests), but please respect the following restrictions:
* Please **do not** use the issue tracker for personal support requests (use
[Stack Overflow](http://stackoverflow.com) or IRC).
* Please **do not** derail or troll issues. Keep the discussion on topic and
respect the opinions of others.
<a name="bugs"></a>
## Bug reports
A bug is a _demonstrable problem_ that is caused by the code in the repository.
Good bug reports are extremely helpful - thank you!
Guidelines for bug reports:
1. **Use the GitHub issue search** &mdash; check if the issue has already been
reported.
2. **Check if the issue has been fixed** &mdash; try to reproduce it using the
latest `master` or development branch in the repository.
3. **Isolate the problem** &mdash; ideally create a [reduced test
case](http://css-tricks.com/6263-reduced-test-cases/) and a live example.
A good bug report shouldn't leave others needing to chase you up for more
information. Please try to be as detailed as possible in your report. What is
your environment? What steps will reproduce the issue? What browser(s) and OS
experience the problem? What would you expect to be the outcome? All these
details will help people to fix any potential bugs.
Example:
> Short and descriptive example bug report title
>
> A summary of the issue and the browser/OS environment in which it occurs. If
> suitable, include the steps required to reproduce the bug.
>
> 1. This is the first step
> 2. This is the second step
> 3. Further steps, etc.
>
> `<url>` - a link to the reduced test case
>
> Any other information you want to share that is relevant to the issue being
> reported. This might include the lines of code that you have identified as
> causing the bug, and potential solutions (and your opinions on their
> merits).
<a name="features"></a>
## Feature requests
Feature requests are welcome. But take a moment to find out whether your idea
fits with the scope and aims of the project. It's up to *you* to make a strong
case to convince the project's developers of the merits of this feature. Please
provide as much detail and context as possible.
<a name="pull-requests"></a>
## Pull requests
Good pull requests - patches, improvements, new features - are a fantastic
help. They should remain focused in scope and avoid containing unrelated
commits.
**Please ask first** before embarking on any significant pull request (e.g.
implementing features, refactoring code, porting to a different language),
otherwise you risk spending a lot of time working on something that the
project's developers might not want to merge into the project.
Please adhere to the coding conventions used throughout a project (indentation,
accurate comments, etc.) and any other requirements (such as test coverage).
Adhering to the following this process is the best way to get your work
included in the project:
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
and configure the remotes:
```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/<repo-name>
# Navigate to the newly cloned directory
cd <repo-name>
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/<upstream-owner>/<repo-name>
```
2. If you cloned a while ago, get the latest changes from upstream:
```bash
git checkout <dev-branch>
git pull upstream <dev-branch>
```
3. Create a new topic branch (off the main project development branch) to
contain your feature, change, or fix:
```bash
git checkout -b <topic-branch-name>
```
4. Commit your changes in logical chunks. Please adhere to these [git commit
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
or your code is unlikely be merged into the main project. Use Git's
[interactive rebase](https://help.github.com/articles/interactive-rebase)
feature to tidy up your commits before making them public.
5. Locally merge (or rebase) the upstream development branch into your topic branch:
```bash
git pull [--rebase] upstream <dev-branch>
```
6. Push your topic branch up to your fork:
```bash
git push origin <topic-branch-name>
```
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
with a clear title and description.
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
license your work under the same license as that used by the project.

3138
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@@ -1,121 +0,0 @@
Date: 2015-june
# Goal:
=======
- support safe concurrency with EWF
- provide a concurrent standalone connector
# Status:
=========
- The version v0 of EWF has mainly 3 connectors: CGI, libFCGI, and nino.
- CGI and libFCGI connectors does not need any concurrency support.
- But the nino connector had a pseudo concurrency support with Thread, however one could do write code that result in hasardeous concurrency execution.
So, it was decided to provide an improved Eiffel web nino connector, and update EWF design to make it concurrency compliant.
# Decisions:
============
- instead of updating current nino library, we now have a new "standalone" connector which is inspired by nino, but have support for the 3 concurrency modes: none, thread and SCOOP.
# Overview
==========
Adding support for SCOOP concurrency mode add constraints to the design, but also helps ensuring the concurrency design of EWF is correct.
As a consequence, we had to introduce a new interface WSF_EXECUTION which is instantiated for each incoming request. See its simplified interface :
<code lang="eiffel">
deferred class WSF_EXECUTION
feature -- Initialization
make (req: WGI_REQUEST; res: WGI_RESPONSE)
do
...
īnitialize
end
initialize
-- Initialize Current object.
--| To be redefined if needed.
do
end
feature -- Access
request: WSF_REQUEST
-- Access to request data.
-- Header, Query, Post, Input data..
response: WSF_RESPONSE
-- Access to output stream, back to the client.
feature -- Execution
execute
-- Execute Current `request',
-- getting data from `request'
-- and response to client via `response'.
deferred
ensure
is_valid_end_of_execution: is_valid_end_of_execution
end
end
</code>
And the related request execution routines are extracted from WSF_SERVICE which becomes almost useless. The "service" part is not mostly responsible of launching the expected connector and set optional options, and declare the type of "execution" interface.
As a result, the well known WSF_DEFAULT_SERVICE has now a formal generic that should conform to WSF_EXECUTION with a `make' creation procedure. See update code:
<code lang="eiffel">
class
APPLICATION
inherit
WSF_DEFAULT_SERVICE [APPLICATION_EXECUTION]
redefine
initialize
end
create
make_and_launch
feature {NONE} -- Initialization
initialize
-- Initialize current service.
do
set_service_option ("port", 9090)
end
end
</code>
Where APPLICATION_EXECUTION is an implementation of the WSF_EXECUTION interface (with the `make' creation procedure).
In addition to add better and safer concurrency support, there are other advantages:
- we now have a clear separation between the service launcher, and the request execution itself.
- the WSF_EXECUTION is created per request, with two main attributes <code>request: WSF_REQUEST</code> and <code>response: WSF_RESPONSE</code>.
# How to migrate to new design
- you can check the various example from the EWF repository, there should all be migrated to new design and comparing previous and new code, this will show you how the migration was done.
- a frequent process:
- identify the root class of your service, (the class implementing the WSF_SERVICE), let us name it APPLICATION_SERVICE
- copy the APPLICATION_SERVICE file to APPLICATION_EXECUTION file.
- change the class name to be APPLICATION_EXECUTION, and replace _SERVICE occurences by _EXECUTION (note the new WSF_ROUTED_EXECUTION and so on, which are mainly migration from previous WSF_ROUTED_SERVICE .., and also WSF_FILTERED_ROUTED_EXECUTION which is new.
- replace "make_and_launch" by "make", remove the initialize redefinition if any.
- in the APPLICATION_SERVICE class, remove most of the ROUTED, FILTERED ... inheritance, and keep WSF_DEFAULT_SERVICE, with a new formal generic i.e WSF_DEFAULT_SERVICE [APPLICATION_EXECUTION].
- in the eventual redefined initialize, remove code related to routers, filters, ...
- remove all the execution related code.
- And you should be done.
- To be short, this is mostly creating a new _EXECUTION class, and move the execution related code into this class from the _SERVICE class.
- Then, you can replace the usage of nino connector by using the new "Standalone" connector, and switch to SCOOP concurrency mode, to ensure you are not messing up with concurrency. Your own code/libraris may not be SCOOP compliant, we recommend to migrate to SCOOP, but as an intermediate solutioņ, you can use the other concurrency mode (none or thread).
Note: the new design impacts the _SERVICE classes, connectors, but WSF_REQUEST, WSF_RESPONSE , WSF_ROUTER are compatible, so the migration is really easy.
We may take the opportunity to update the design deeper according to user feedback, and eventually "wsf" library will be renamed "wsf2".
This is work in progress, all comments , feedback, suggestions, bug report are welcome.
Hopefully before the final version of the new design is out.

View File

@@ -1,29 +1,10 @@
# Eiffel Web Framework
* version: v0.2
## Overview
The Eiffel Web Framework (EWF) provides Eiffel users with a layer to build anything on top of the http protocol such as websites, web API/services.
This layer is multi-platform: it can be set on Windows, Linux operating systems, and in addition it can run on top of any httpd servers such as Apache2, IIS, nginx, lighttpd. EWF includes as well a standalone httpd web server component, written in Eiffel, which enables users to run easily a web server on their machine, or even embed this component in any application written with Eiffel.
Currently EWF offers a collection of Eiffel libraries designed to be integrated with each others, and among other functionalities, it give simple access to the request data, to handle content negotiation, url dispatcher, integrate with openid system, and so on.
There is a growing ecosystem around EWF, that provides useful components:
* OpenID and OAuth consumer library
* Various hypermedia format such as HAL, Collection+json, …
* Websocket server and client
* Template engine
* API Auto-documentation with swagger
* A simple experimental CMS.
* ...
So if you want to build a website, a web api, RESTful service, …or even if you want to consume other web api, EWF is a solution.
EWF brings with it all the advantages of the Eiffel technology and tools with its powerful features such as Design by Contract, debugging, testing tools which enable to build efficient systems expected to be repeatedly refined, extended, and improved in a predictable and controllable way so as to become with time bugfree systems. Enjoy the full power of debugging your web server application from the IDE.
## Project
Official project site for Eiffel Web Framework:
* http://eiffelwebframework.github.com/EWF/
@@ -35,21 +16,20 @@ For more information please have a look at the related wiki:
For download, check
* https://github.com/EiffelWebFramework/EWF/downloads
Tasks and issues are managed with github issue system
* See https://github.com/EiffelWebFramework/EWF/issues
* And visual dashboard: https://waffle.io/eiffelwebframework/ewf
* Forum/group post: https://groups.google.com/forum/#!forum/eiffel-web-framework
## Requirements
* Compiling from EiffelStudio 13.11 to 15.05 and more recent version of the compiler.
* Currently being developped using EiffelStudio 15.01 (on Windows, Linux)
* Tested using EiffelStudio 15.01 with "jenkins" CI server (not anymore compatible with 6.8 due to use of `TABLE_ITERABLE')
* Compiling from EiffelStudio 7.0
* Developped using EiffelStudio 7.1 and 7.2 (on Windows, Linux)
* Tested using EiffelStudio 7.1 with "jenkins" CI server (not compatible with 6.8 due to use of `TABLE_ITERABLE')
* The code have to allow __void-safe__ compilation and non void-safe system (see [more about void-safety](http://docs.eiffel.com/book/method/void-safe-programming-eiffel) )
## How to get the source code?
Using git
* git clone https://github.com/EiffelWebFramework/EWF.git
* svn checkout https://github.com/EiffelWebFramework/EWF/trunk
* Notes:
** It does not use submodule anymore due to recurrent trouble for users.
** EWF is also provided by delivery of EiffelStudio (starting from version 7.1 shipping v0.1, and 7.2 that ships v0.2)
* And to build the required and related Clibs
* cd contrib/ise_library/cURL
@@ -67,7 +47,7 @@ Using git
### protocol
* __http__: HTTP related classes, constants for status code, content types, ... [read more](library/protocol/http)
* __uri_template__: URI Template library (parsing and expander) [read more](library/protocol/uri_template)
* __CONNEG__: Content negotiation library (Content-type Negociation) [read more](library/protocol/content_negotiation)
*not yet released: __CONNEG__: CONNEG library (Content-type Negociation) [read more](library/protocol/CONNEG)
### client
* __http_client__: simple HTTP client based on cURL [read more](library/client/http_client)
@@ -75,6 +55,10 @@ Using git
### text
* __encoder__: Various simpler encoders: base64, url-encoder, xml entities, html entities [read more](library/text/encoder)
### crypto
* eel
* eapml
### Others
* error: very simple/basic library to handle error
@@ -87,24 +71,6 @@ Using git
## Examples
..
## Contributing to this project
Anyone and everyone is welcome to contribute. Please take a moment to
review the [guidelines for contributing](CONTRIBUTING.md).
* [Bug reports](CONTRIBUTING.md#bugs)
* [Feature requests](CONTRIBUTING.md#features)
* [Pull requests](CONTRIBUTING.md#pull-requests)
## Community
Keep track of development and community news.
* Follow [@EiffelWeb](https://twitter.com/EiffelWeb) on Twitter
* [Forum](https://groups.google.com/forum/#!forum/eiffel-web-framework) on Google groups.
* Follow our [page](https://plus.google.com/u/0/110650349519032194479) and [community](https://plus.google.com/communities/110457383244374256721) on Google+
* Have a question that's not a feature request or bug report? [Ask on the mailing list](http://groups.google.com/group/eiffel-web-framework)
For more information please have a look at the related wiki:
* https://github.com/EiffelWebFramework/EWF/wiki

View File

@@ -29,9 +29,7 @@
<target name="_build_tpl_" >
<argument name="_target_name" />
<!--
<geant target="${_target_name}" dir="library" file="build.eant" reuse_variables="true" />
-->
<geant target="${_target_name}" dir="ise_library" file="build.eant" reuse_variables="true" />
</target>
</project>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<project name="build_library" default="help">
<description>
description: "Compile Eiffel Web Framework / Contrib / ISE library"
</description>
<target name="help">
<echo message="usage:"/>
<echo message=" geant compile"/>
<echo message=" geant clean"/>
<echo message=" geant clobber"/>
</target>
<target name="compile" >
<echo message="- Compile ise_library" />
<geant target="_build_tpl_" arguments="compile" />
</target>
<target name="clean" >
<echo message="- Clean ise_library" />
<geant target="_build_tpl_" arguments="clean" />
</target>
<target name="clobber" >
<echo message="- Clobber ise_library" />
<geant target="_build_tpl_" arguments="clobber" />
</target>
<target name="_build_tpl_" >
<argument name="_target_name" />
<geant target="${_target_name}" dir="cURL" file="build.eant" reuse_variables="true" />
</target>
</project>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
<target name="curl">
<description>cURL: libcURL wrapper library for Eiffel.
Copyright (c) 1984-2006, Eiffel Software and others.
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
<root all_classes="true"/>
<file_rule>
<exclude>/\.svn$</exclude>
<exclude>/EIFGEN.{0,1}$</exclude>
<exclude>/temp$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" void_safety="all" namespace="EiffelSoftware.Library">
</option>
<setting name="dotnet_naming_convention" value="true"/>
<external_include location="$(ECF_CONFIG_PATH)\cURL\spec\include">
<condition>
<platform value="windows"/>
</condition>
</external_include>
<external_include location="$(ECF_CONFIG_PATH)/cURL/spec/include">
<condition>
<platform excluded_value="windows"/>
</condition>
</external_include>
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="true"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="false"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="true"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
<condition>
<platform value="windows"/>
<dotnet value="true"/>
</condition>
</external_object>
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper-safe.ecf"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<cluster name="curl" location=".\cURL" recursive="true">
<file_rule>
<exclude>/spec$</exclude>
<exclude>/Clib$</exclude>
</file_rule>
<file_rule>
<exclude>/gtk$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform value="windows"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/gtk$</exclude>
<condition>
<platform value="macintosh"/>
<custom name="vision_implementation" value="cocoa"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform excluded_value="windows"/>
<custom name="vision_implementation" excluded_value="cocoa"/>
</condition>
</file_rule>
</cluster>
</target>
<target name="curl_dotnet" extends="curl">
<setting name="msil_generation" value="true"/>
</target>
</system>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
<target name="curl">
<description>cURL: libcURL wrapper library for Eiffel.
Copyright (c) 1984-2006, Eiffel Software and others.
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
<root all_classes="true"/>
<file_rule>
<exclude>/\.svn$</exclude>
<exclude>/EIFGEN.{0,1}$</exclude>
<exclude>/temp$</exclude>
</file_rule>
<option warning="true" namespace="EiffelSoftware.Library">
</option>
<setting name="dotnet_naming_convention" value="true"/>
<external_include location="$(ECF_CONFIG_PATH)\cURL\spec\include">
<condition>
<platform value="windows"/>
</condition>
</external_include>
<external_include location="$(ECF_CONFIG_PATH)/cURL/spec/include">
<condition>
<platform excluded_value="windows"/>
</condition>
</external_include>
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="true"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="false"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="true"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
<condition>
<platform value="windows"/>
<dotnet value="true"/>
</condition>
</external_object>
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<cluster name="curl" location=".\cURL" recursive="true">
<file_rule>
<exclude>/spec$</exclude>
<exclude>/Clib$</exclude>
</file_rule>
<file_rule>
<exclude>/gtk$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform value="windows"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/gtk$</exclude>
<condition>
<platform value="macintosh"/>
<custom name="vision_implementation" value="cocoa"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform excluded_value="windows"/>
<custom name="vision_implementation" excluded_value="cocoa"/>
</condition>
</file_rule>
</cluster>
</target>
<target name="curl_dotnet" extends="curl">
<setting name="msil_generation" value="true"/>
</target>
</system>

View File

@@ -0,0 +1,58 @@
TOP = ..
DIR = $dir_sep
OUTDIR= .
INDIR= .
CC = $cc
OUTPUT_CMD = $output_cmd
CFLAGS = -I"$rt_include" -I..$(DIR)spec$(DIR)include -I. \
-I..$(DIR)..$(DIR)..$(DIR)C_library$(DIR)libpng -I..$(DIR)..$(DIR)..$(DIR)C_library$(DIR)zlib
JCFLAGS = $(CFLAGS) $ccflags $optimize
JMTCFLAGS = $(CFLAGS) $mtccflags $optimize
JILCFLAGS = $(CFLAGS) $mtccflags $optimize -DEIF_IL_DLL
LN = copy
MV = $mv
RM = $del
MAKE = $make
MKDIR = $mkdir
LINK = $link32
DLL_FLAGS = $dll_flags
DLL_LIBS = $dll_libs
OBJECTS = eiffel_curl.$obj
MT_OBJECTS = MTeiffel_curl.$obj
IL_OBJECTS = ILeiffel_curl.$obj
.c.$obj:
$(CC) -c $(JCFLAGS) $<
all:: $output_libraries
$(MAKE) clean
standard:: eiffel_curl.lib ileiffel_curl.lib
mtstandard:: mteiffel_curl.lib
clean:
$(RM) *.$obj
$(RM) *.lib
eiffel_curl.lib: $(OBJECTS)
$alib_line
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
mteiffel_curl.lib: $(MT_OBJECTS)
$alib_line
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
ileiffel_curl.lib: $(IL_OBJECTS)
$alib_line
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
#Multithreaded targets.
MTeiffel_curl.$obj: eiffel_curl.c
$(CC) $(JMTCFLAGS) $(OUTPUT_CMD)$@ -c $?
#.NET targets.
ILeiffel_curl.$obj: eiffel_curl.c
$(CC) $(JILCFLAGS) $(OUTPUT_CMD)$@ -c $?

View File

@@ -0,0 +1,92 @@
case $CONFIG in
'')
if test ! -f config.sh; then
(echo "Can't find config.sh."; exit 1)
fi 2>/dev/null
. ./config.sh
;;
esac
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac
echo "Extracting "."/Makefile (with variable substitutions)"
$spitshell >Makefile <<!GROK!THIS!
########################################################################
# Makefile generated from Makefile.SH on $DATE
SHELL = /bin/sh
AR = ar rc
CC = $cc
CTAGS = ctags
INCLUDE = -I$rt_include -I../spec/include -I../../../C_library/libpng -I../../../C_library/zlib
CFLAGS = $optimize $ccflags $large -g \$(INCLUDE)
MTCFLAGS = $optimize $mtccflags $large -g \$(INCLUDE)
SHAREDLINK = $sharedlink
LDSHAREDFLAGS = $ldsharedflags
LN = $ln
MAKE = $make
MKDEP = $mkdep \$(DPFLAGS) --
RANLIB = $ranlib
RM = $rm -f
MV = $mv
MKDIR = $mkdir -p
PLATFORM = $ISE_PLATFORM
########################################################################
# New suffixes and associated building rules -- edit with care
!GROK!THIS!
$spitshell >>Makefile <<'!NO!SUBS!'
MT_OBJECTS = MTeiffel_curl.o
OBJECTS = eiffel_curl.o
ALL_OBJECTS = $(OBJECTS) $(MT_OBJECTS)
all: $(ALL_OBJECTS)
$(MKDIR) ../spec/$(PLATFORM)/lib
$(MV) $? ../spec/$(PLATFORM)/lib
$(MAKE) clobber
MTeiffel_curl.o: eiffel_curl.c
$(CC) -c $(MTCFLAGS) $? -o $@
########################################################################
# Common rules for all Makefiles -- do not edit
emptyrule::
clean: local_clean
realclean: local_realclean
clobber: local_clobber
local_clean::
$(RM) core *~ *.o *.so *.a
local_realclean:: local_clean
local_clobber:: local_realclean
$(RM) Makefile config.sh
Makefile: Makefile.SH
/bin/sh Makefile.SH
tags::
$(CTAGS) -w *.[ch]
$(CTAGS) -xw *.[ch] > tags
local_clobber::
$(RM) tags
########################################################################
# Dependencies generated by make depend
# DO NOT DELETE THIS LINE -- make depend relies on it
# Put nothing here or make depend will gobble it up
.FORCE_DEPEND::
@echo "You must run 'make depend' in $(TOP) first."; exit 1
!NO!SUBS!
chmod 644 Makefile
$eunicefix Makefile

View File

@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<project name="build_curl_clib" default="help">
<description>
description: "cURL Clib library compilation"
</description>
<target name="help">
<echo message="usage:"/>
<echo message=" geant compile"/>
<echo message=" geant clean"/>
<echo message=" geant clobber"/>
</target>
<target name="compile" >
<exec executable="finish_freezing -library" />
</target>
<target name="clean" >
</target>
<target name="clobber" depend="clean" />
</project>

View File

@@ -0,0 +1,188 @@
/*
indexing
description: "Functions used by the class CURL_FUNCTION."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
*/
#include "eiffel_curl.h"
typedef EIF_INTEGER (* EIF_CURL_PROGRESS_PROC) (
#ifndef EIF_IL_DLL
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
#endif
EIF_POINTER, /* a_user_pointer */
EIF_REAL_64, /* a_dltotal */
EIF_REAL_64, /* a_dlnow */
EIF_REAL_64, /* a_ultotal */
EIF_REAL_64 /* a_ulnow */
);
typedef EIF_INTEGER (* EIF_CURL_WRITE_PROC) (
#ifndef EIF_IL_DLL
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
#endif
EIF_POINTER, /* a_data_pointer */
EIF_INTEGER, /* a_size */
EIF_INTEGER, /* a_nmemb */
EIF_POINTER /* a_write_pointer */
);
typedef EIF_INTEGER (* EIF_CURL_READ_PROC) (
#ifndef EIF_IL_DLL
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
#endif
EIF_POINTER, /* a_data_pointer */
EIF_INTEGER, /* a_size */
EIF_INTEGER, /* a_nmemb */
EIF_POINTER /* a_write_pointer */
);
typedef EIF_INTEGER (* EIF_CURL_DEBUG_PROC) (
#ifndef EIF_IL_DLL
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
#endif
EIF_POINTER, /* a_curl_handle */
EIF_INTEGER, /* a_curl_infotype */
EIF_POINTER, /* a_char_pointer */
EIF_INTEGER, /* a_size */
EIF_POINTER /* a_user_pointer */
);
static EIF_OBJECT eiffel_function_object = NULL;
/* Address of Eiffel object CURL_FUNCTION */
static EIF_CURL_PROGRESS_PROC eiffel_progress_function = NULL;
/* Address of Eiffel CURL_FUNCTION.progress_function */
static EIF_CURL_WRITE_PROC eiffel_write_function = NULL;
/* Address of Eiffel CURL_FUNCTION.write_function */
static EIF_CURL_READ_PROC eiffel_read_function = NULL;
/* Address of Eiffel CURL_FUNCTION.read_function */
static EIF_CURL_DEBUG_PROC eiffel_debug_function = NULL;
/* Address of Eiffel CURL_FUNCTION.debug_function */
/* Set Eiffel CURL_FUNCTION object address */
void c_set_object(EIF_REFERENCE a_address)
{
if (a_address) {
eiffel_function_object = eif_protect (a_address);
} else {
eiffel_function_object = NULL;
}
}
/* Release Eiffel CURL_FUNCTION object address */
void c_release_object()
{
eif_wean (eiffel_function_object);
}
/* Set CURL_FUNCTOIN.progress_function address */
void c_set_progress_function_address( EIF_POINTER a_address)
{
eiffel_progress_function = (EIF_CURL_PROGRESS_PROC) a_address;
}
/* Set CURL_FUNCTOIN.write_function address */
void c_set_write_function_address( EIF_POINTER a_address)
{
eiffel_write_function = (EIF_CURL_WRITE_PROC) a_address;
}
/* Set CURL_FUNCTOIN.read_function address */
void c_set_read_function_address( EIF_POINTER a_address)
{
eiffel_read_function = (EIF_CURL_READ_PROC) a_address;
}
/* Set CURL_FUNCTOIN.debug_function address */
void c_set_debug_function_address (EIF_POINTER a_address)
{
eiffel_debug_function = (EIF_CURL_DEBUG_PROC) a_address;
}
/* Eiffel adapter function for CURLOPT_WRITEFUNCTION
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
size_t curl_write_function (void *ptr, size_t size, size_t nmemb, void *data)
{
if (eiffel_function_object) {
return (size_t) ((eiffel_write_function) (
#ifndef EIF_IL_DLL
(EIF_REFERENCE) eif_access (eiffel_function_object),
#endif
(EIF_POINTER) ptr,
(EIF_INTEGER) size,
(EIF_INTEGER) nmemb,
(EIF_POINTER) data));
} else {
return 0;
}
}
/* Eiffel adapter function for CURLOPT_READFUNCTION
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
size_t curl_read_function (void *ptr, size_t size, size_t nmemb, void *data)
{
if (eiffel_function_object) {
return (size_t) ((eiffel_read_function) (
#ifndef EIF_IL_DLL
(EIF_REFERENCE) eif_access (eiffel_function_object),
#endif
(EIF_POINTER) ptr,
(EIF_INTEGER) size,
(EIF_INTEGER) nmemb,
(EIF_POINTER) data));
} else {
return 0;
}
}
/* Eiffel adapter function for CURLOPT_PROGRESSFUNCTION
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
size_t curl_progress_function (void * a_object_id, double a_dltotal, double a_dlnow, double a_ultotal, double a_ulnow)
{
if (eiffel_function_object) {
return (size_t) ((eiffel_progress_function) (
#ifndef EIF_IL_DLL
(EIF_REFERENCE) eif_access (eiffel_function_object),
#endif
(EIF_POINTER) a_object_id,
(EIF_REAL_64) a_dltotal,
(EIF_REAL_64) a_dlnow,
(EIF_REAL_64) a_ultotal,
(EIF_REAL_64) a_ulnow));
} else {
return 0;
}
}
/* Eiffel adapter function for CURLOPT_DEBUGFUNCTION
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
size_t curl_debug_function (CURL * a_curl_handle, curl_infotype a_curl_infotype, unsigned char * a_char_pointer, size_t a_size, void * a_object_id)
{
if (eiffel_function_object) {
return (size_t) ((eiffel_debug_function) (
#ifndef EIF_IL_DLL
(EIF_REFERENCE) eif_access (eiffel_function_object),
#endif
(EIF_POINTER) a_curl_handle,
(EIF_INTEGER) a_curl_infotype,
(EIF_POINTER) a_char_pointer,
(EIF_INTEGER) a_size,
(EIF_POINTER) a_object_id));
} else {
return 0;
}
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<project name="build_curl" default="help">
<description>
description: "cURL library compilation"
</description>
<target name="help">
<echo message="usage:"/>
<echo message=" geant compile"/>
<echo message=" geant clean"/>
<echo message=" geant clobber"/>
</target>
<target name="compile">
<echo message="- Compile [cURL]" />
<geant target="compile" file="build.eant" dir="Clib"
reuse_variables="true" />
</target>
<target name="clean">
<echo message="- Clean [cURL]" />
<delete directory="spec\${ISE_C_COMPILER}\${ISE_PLATFORM}" />
</target>
<target name="clobber" depend="clean" />
</project>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
<target name="curl">
<description>cURL: libcURL wrapper library for Eiffel.
Copyright (c) 1984-2006, Eiffel Software and others.
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
<root all_classes="true"/>
<file_rule>
<exclude>/\.svn$</exclude>
<exclude>/EIFGEN.{0,1}$</exclude>
<exclude>/temp$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" void_safety="all" namespace="EiffelSoftware.Library">
</option>
<setting name="dotnet_naming_convention" value="true"/>
<external_include location="$(ISE_LIBRARY)\library\cURL\spec\include">
<condition>
<platform value="windows"/>
</condition>
</external_include>
<external_include location="$(ISE_LIBRARY)/library/cURL/spec/include">
<condition>
<platform excluded_value="windows"/>
</condition>
</external_include>
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="true"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="false"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="true"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
<condition>
<platform value="windows"/>
<dotnet value="true"/>
</condition>
</external_object>
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper-safe.ecf"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<cluster name="curl" location=".\" recursive="true">
<file_rule>
<exclude>/spec$</exclude>
<exclude>/Clib$</exclude>
</file_rule>
<file_rule>
<exclude>/gtk$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform value="windows"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/gtk$</exclude>
<condition>
<platform value="macintosh"/>
<custom name="vision_implementation" value="cocoa"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform excluded_value="windows"/>
<custom name="vision_implementation" excluded_value="cocoa"/>
</condition>
</file_rule>
</cluster>
</target>
<target name="curl_dotnet" extends="curl">
<setting name="msil_generation" value="true"/>
</target>
</system>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
<target name="curl">
<description>cURL: libcURL wrapper library for Eiffel.
Copyright (c) 1984-2006, Eiffel Software and others.
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
<root all_classes="true"/>
<file_rule>
<exclude>/\.svn$</exclude>
<exclude>/EIFGEN.{0,1}$</exclude>
<exclude>/temp$</exclude>
</file_rule>
<option warning="true" namespace="EiffelSoftware.Library">
</option>
<setting name="dotnet_naming_convention" value="true"/>
<external_include location="$(ISE_LIBRARY)\library\cURL\spec\include">
<condition>
<platform value="windows"/>
</condition>
</external_include>
<external_include location="$(ISE_LIBRARY)/library/cURL/spec/include">
<condition>
<platform excluded_value="windows"/>
</condition>
</external_include>
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
<condition>
<platform excluded_value="windows"/>
<multithreaded value="true"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="false"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
<condition>
<platform value="windows"/>
<multithreaded value="true"/>
<dotnet value="false"/>
</condition>
</external_object>
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
<condition>
<platform value="windows"/>
<dotnet value="true"/>
</condition>
</external_object>
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<cluster name="curl" location=".\" recursive="true">
<file_rule>
<exclude>/spec$</exclude>
<exclude>/Clib$</exclude>
</file_rule>
<file_rule>
<exclude>/gtk$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform value="windows"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/gtk$</exclude>
<condition>
<platform value="macintosh"/>
<custom name="vision_implementation" value="cocoa"/>
</condition>
</file_rule>
<file_rule>
<exclude>/mswin$</exclude>
<exclude>/mac$</exclude>
<condition>
<platform excluded_value="windows"/>
<custom name="vision_implementation" excluded_value="cocoa"/>
</condition>
</file_rule>
</cluster>
</target>
<target name="curl_dotnet" extends="curl">
<setting name="msil_generation" value="true"/>
</target>
</system>

View File

@@ -0,0 +1,336 @@
note
description: "[
All possible error codes from all sorts of curl functions.
Future versions may return other values, stay prepared.
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_CODES
feature -- Eiffel cURL: Constants
eiffelcurle_error_occurred: INTEGER = -1
-- Error occurred in Eiffel cURL internals
feature -- Constants
curle_ok: INTEGER = 0
-- Declared as CURLE_OK
curle_unsupported_protocol: INTEGER = 1
-- Declared as CURLE_UNSUPPORTED_PROTOCOL
curle_failed_init: INTEGER = 2
-- Declared as CURLE_FAILED_INIT
curle_url_malformat: INTEGER = 3
-- Declared as CURLE_URL_MALFORMAT
curle_obsolete4: INTEGER = 4
-- Declared as CURLE_OBSOLETE4
-- NOT USED
curle_couldnt_resolve_proxy: INTEGER = 5
-- Declared as CURLE_COULDNT_RESOLVE_PROXY
curle_couldnt_resolve_host: INTEGER = 6
-- Declared as CURLE_COULDNT_RESOLVE_HOST
curle_couldnt_connect: INTEGER = 7
-- Declared as CURLE_COULDNT_CONNECT
curle_ftp_weird_server_reply: INTEGER = 8
-- Declared as CURLE_FTP_WEIRD_SERVER_REPLY
curle_remote_access_denied: INTEGER = 9
-- Declared as CURLE_REMOTE_ACCESS_DENIED
-- A service was denied by the server due to lack of access
-- when login fails this is not returned.
curle_obsolete10: INTEGER = 10
-- Declared as CURLE_OBSOLETE10 NOT USED
curle_ftp_weird_pass_reply: INTEGER = 11
-- Declared as CURLE_FTP_WEIRD_PASS_REPLY
curle_obsolete12: INTEGER = 12
-- Declared as CURLE_OBSOLETE12 NOT USED
curle_ftp_weird_pasv_reply: INTEGER = 13
-- Declared as CURLE_FTP_WEIRD_PASV_REPLY
curle_ftp_weird_227_format: INTEGER = 14
-- Declared as CURLE_FTP_WEIRD_227_FORMAT
curle_ftp_cant_get_host: INTEGER = 15
-- Declared as CURLE_FTP_CANT_GET_HOST
curle_obsolete16: INTEGER = 16
-- Declared as CURLE_OBSOLETE16
-- NOT USED
curle_ftp_couldnt_set_type: INTEGER = 17
-- Declared as CURLE_FTP_COULDNT_SET_TYPE
curle_partial_file: INTEGER = 18
-- Declared as CURLE_PARTIAL_FILE
curle_ftp_couldnt_retr_file: INTEGER = 19
-- Declared as CURLE_FTP_COULDNT_RETR_FILE
curle_obsolete20: INTEGER = 20
-- Declared as CURLE_OBSOLETE20
-- NOT USED
curle_quote_error: INTEGER = 21
-- Declared as CURLE_QUOTE_ERROR
-- quote command failure
curle_http_returned_error: INTEGER = 22
-- Declared as CURLE_HTTP_RETURNED_ERROR
curle_write_error: INTEGER = 23
-- Declared as CURLE_WRITE_ERROR
curle_obsolete24: INTEGER = 24
-- Declared as CURLE_OBSOLETE24 NOT USED
curle_upload_failed: INTEGER = 25
-- Declared as CURLE_UPLOAD_FAILED
-- failed upload "command"
curle_read_error: INTEGER = 26
-- Declared as CURLE_READ_ERROR
-- couldn't open/read from file
curle_out_of_memory: INTEGER = 27
-- Declared as CURLE_OUT_OF_MEMORY
-- Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
-- instead of a memory allocation error if CURL_DOES_CONVERSIONS
-- is defined
curle_operation_timedout: INTEGER = 28
-- Declared as CURLE_OPERATION_TIMEDOUT
-- the timeout time was reached
curle_obsolete29: INTEGER = 29
-- Declared as CURLE_OBSOLETE29
-- NOT USED
curle_ftp_port_failed: INTEGER = 30
-- Declared as CURLE_FTP_PORT_FAILED
-- FTP PORT operation failed
curle_ftp_couldnt_use_rest: INTEGER = 31
-- Declared as CURLE_FTP_COULDNT_USE_REST
-- the REST command failed
curle_obsolete32: INTEGER = 32
-- Declared as CURLE_OBSOLETE32
-- NOT USED
curle_range_error: INTEGER = 33
-- Declared as CURLE_RANGE_ERROR
-- RANGE "command" didn't work
curle_http_post_error: INTEGER = 34
-- Declared as CURLE_HTTP_POST_ERROR
curle_ssl_connect_error: INTEGER = 35
-- Declared CURLE_SSL_CONNECT_ERROR
-- wrong when connecting with SSL
curle_bad_download_resume: INTEGER = 36
-- Declared as CURLE_BAD_DOWNLOAD_RESUME
-- couldn't resume download
curle_file_couldnt_read_file: INTEGER = 37
-- Declared as CURLE_FILE_COULDNT_READ_FILE
curle_ldap_cannot_bind: INTEGER = 38
-- Declared as CURLE_LDAP_CANNOT_BIND
curle_ldap_search_failed: INTEGER = 39
-- Declared as CURLE_LDAP_SEARCH_FAILED
curle_obsolete40: INTEGER = 40
-- Declared as CURLE_OBSOLETE40
-- NOT USED
curle_function_not_found: INTEGER = 41
-- Declared as CURLE_FUNCTION_NOT_FOUND
curle_aborted_by_callback: INTEGER = 42
-- Declared as CURLE_ABORTED_BY_CALLBACK
curle_bad_function_argument: INTEGER = 43
-- Declared as CURLE_BAD_FUNCTION_ARGUMENT
curle_obsolete44: INTEGER = 44
-- Declared as CURLE_OBSOLETE44
-- NOT USED
curle_interface_failed: INTEGER = 45
-- Declared as CURLE_INTERFACE_FAILED
-- CURLOPT_INTERFACE failed
curle_obsolete46: INTEGER = 46
-- Declared as CURLE_OBSOLETE46
-- NOT USED
curle_too_many_redirects: INTEGER = 47
-- Declared as CURLE_TOO_MANY_REDIRECTS
-- catch endless re-direct loops
curle_unknown_telnet_option: INTEGER = 48
-- Declared as CURLE_UNKNOWN_TELNET_OPTION
-- User specified an unknown option
curle_telnet_option_syntax: INTEGER = 49
-- Declared as CURLE_TELNET_OPTION_SYNTAX
-- Malformed telnet option
curle_obsolete50: INTEGER = 50
-- Declared as CURLE_OBSOLETE50
-- NOT USED
curle_ssl_peer_certificate: INTEGER = 51
-- Declared as CURLE_SSL_PEER_CERTIFICATE
-- peer's certificate wasn't ok
curle_got_nothing: INTEGER = 52
-- Declared as CURLE_GOT_NOTHING
-- when this is a specific error
curle_ssl_engine_notfound: INTEGER = 53
-- Declared as CURLE_SSL_ENGINE_NOTFOUND
-- SSL crypto engine not found */
curle_ssl_engine_setfailed: INTEGER = 54
-- Declared as CURLE_SSL_ENGINE_SETFAILED
-- can not set SSL crypto engine as default
curle_send_error: INTEGER = 55
-- Declared as CURLE_SEND_ERROR
-- failed sending network data
curle_recv_error: INTEGER = 56
-- Declared as CURLE_RECV_ERROR
-- failure in receiving network data
curle_obsolete57: INTEGER = 57
-- Declared as CURLE_OBSOLETE57
-- NOT IN USE
curle_ssl_certproblem: INTEGER = 58
-- Declared as CURLE_SSL_CERTPROBLEM
-- problem with the local certificate
curle_ssl_cipher: INTEGER = 59
-- Declared as CURLE_SSL_CIPHER
-- couldn't use specified cipher
curle_ssl_cacert: INTEGER = 60
-- Declared as CURLE_SSL_CACERT
-- problem with the CA cert (path?)
curle_bad_content_encoding: INTEGER = 61
-- Declared as CURLE_BAD_CONTENT_ENCODING
-- Unrecognized transfer encoding
curle_ldap_invalid_url: INTEGER = 62
-- Declared as CURLE_LDAP_INVALID_URL
-- Invalid LDAP URL
curle_filesize_exceeded: INTEGER = 63
-- Declared as CURLE_FILESIZE_EXCEEDED
-- Maximum file size exceeded
curle_use_ssl_failed: INTEGER = 64
-- Declared as CURLE_USE_SSL_FAILED
-- Requested FTP SSL level failed
curle_send_fail_rewind: INTEGER = 65
-- Declared as CURLE_SEND_FAIL_REWIND
-- Sending the data requires a rewind that failed
curle_ssl_engine_initfailed: INTEGER = 66
-- Declared as CURLE_SSL_ENGINE_INITFAILED
-- failed to initialise ENGINE
curle_login_denied: INTEGER = 67
-- Declared as CURLE_LOGIN_DENIED
-- user, password or similar was not accepted and we failed to login
curle_tftp_notfound: INTEGER = 68
-- Declared as CURLE_TFTP_NOTFOUND
-- file not found on server
curle_tftp_perm: INTEGER = 69
-- Declared as CURLE_TFTP_PERM
-- permission problem on server
curle_remote_disk_full: INTEGER = 70
-- Declared as CURLE_REMOTE_DISK_FULL
-- out of disk space on server
curle_tftp_illegal: INTEGER = 71
-- Declared as CURLE_TFTP_ILLEGAL
-- Illegal TFTP operation
curle_tftp_unknownid: INTEGER = 72
-- Declared as CURLE_TFTP_UNKNOWNID
-- Unknown transfer ID
curle_remote_file_exists: INTEGER = 73
-- Declared as CURLE_REMOTE_FILE_EXISTS
-- File already exists
curle_tftp_nosuchuser: INTEGER = 74
-- Declared as CURLE_TFTP_NOSUCHUSER
-- No such user
curle_conv_failed: INTEGER = 75
-- Declared as CURLE_CONV_FAILED
-- conversion failed
curle_conv_reqd: INTEGER = 76
-- Declared as CURLE_CONV_REQD
-- caller must register conversion callbacks using curl_easy_setopt options
-- CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPT_CONV_TO_NETWORK_FUNCTION, and
-- CURLOPT_CONV_FROM_UTF8_FUNCTION
curle_ssl_cacert_badfile: INTEGER = 77
-- Declared as CURLE_SSL_CACERT_BADFILE
-- could not load CACERT file, missing or wrong format
curle_remote_file_not_found: INTEGER = 78
-- Declared as CURLE_REMOTE_FILE_NOT_FOUND
-- remote file not found
curle_ssh: INTEGER = 79
-- Declared as CURLE_SSH
-- error from the SSH layer, somewhat generic so the error message will be of
-- interest when this has happened
curle_ssl_shutdown_failed: INTEGER = 80;
-- Declared as CURLE_SSL_SHUTDOWN_FAILED
-- Failed to shut down the SSL connection
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,104 @@
note
description: "[
Default implementation of CURL_FUNCTION.
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_DEFAULT_FUNCTION
inherit
CURL_FUNCTION
create
make
feature {NONE} -- Initialization
make
-- Creation method
do
set_object_and_function_address
end
feature -- Command
progress_function (a_object_id: POINTER; a_download_total, a_download_now, a_upload_total, a_upload_now: REAL_64): INTEGER
do
end
write_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
local
l_c_string: C_STRING
do
-- Returns the number of bytes actually saved into object identified by `a_object_id'
Result := a_size * a_nmemb
create l_c_string.make_shared_from_pointer_and_count (a_data_pointer, Result)
check attached {CURL_STRING} (create {IDENTIFIED}).id_object (a_object_id.to_integer_32) as l_string then
l_string.append (l_c_string.substring (1, Result))
end
end
read_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
-- A callback readfunction
do
end
debug_function (a_curl_handle: POINTER; a_curl_infotype: INTEGER; a_char_pointer: POINTER; a_size: INTEGER; a_object_id: POINTER): INTEGER
local
l_c_string: C_STRING
do
inspect
a_curl_infotype
when {CURL_INFO_TYPE}.curlinfo_data_in then
dump ("<= Recv data", a_char_pointer, a_size)
when {CURL_INFO_TYPE}.curlinfo_data_out then
dump ("=> Send data", a_char_pointer, a_size)
when {CURL_INFO_TYPE}.curlinfo_header_in then
dump ("<= Recv header", a_char_pointer, a_size)
when {CURL_INFO_TYPE}.curlinfo_header_out then
dump ("=> Send header", a_char_pointer, a_size)
when {CURL_INFO_TYPE}.curlinfo_ssl_data_in then
dump ("<= Recv SSL data", a_char_pointer, a_size)
when {CURL_INFO_TYPE}.curlinfo_ssl_data_out then
dump ("=> Send SSL data", a_char_pointer, a_size)
when {CURL_INFO_TYPE}.curlinfo_text then
create l_c_string.make_by_pointer_and_count (a_char_pointer, a_size)
print ("%N== Info: " + l_c_string.string)
else
check type_unknow: False end
end
end
feature {NONE} -- Implementation
dump (a_text: STRING; a_char_pointer: POINTER; a_size: INTEGER)
-- Dump debug information
require
not_void: a_text /= Void
exists: a_char_pointer /= default_pointer
non_negative: a_size >= 0
local
l_c_string: C_STRING
do
create l_c_string.make_shared_from_pointer_and_count (a_char_pointer, a_size)
print ("%N" + a_text + "%N" + l_c_string.string)
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,409 @@
note
description: "[
cURL easy externals.
For more informaton see:
http://curl.haxx.se/libcurl/c/
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_EASY_EXTERNALS
feature -- Command
init: POINTER
-- Declared as curl_easy_init().
require
dynamic_library_exists: is_dynamic_library_exists
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_init")
if l_api /= default_pointer then
Result := c_init (l_api)
end
ensure
exists: Result /= default_pointer
end
setopt_string (a_curl_handle: POINTER; a_opt: INTEGER; a_string: READABLE_STRING_GENERAL)
-- Declared as curl_easy_setopt().
require
exists: a_curl_handle /= default_pointer
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
not_void: a_string /= Void
local
l_api: POINTER
l_c_str: C_STRING
do
l_api := api_loader.api_pointer ("curl_easy_setopt")
if l_api /= default_pointer then
create l_c_str.make (a_string)
c_setopt (l_api, a_curl_handle, a_opt, l_c_str.item)
end
end
setopt_form (a_curl_handle: POINTER; a_opt: INTEGER; a_form: CURL_FORM)
-- Declared as curl_easy_setopt().
require
exists: a_curl_handle /= default_pointer
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
not_void: a_form /= Void and then a_form.is_exists
do
setopt_void_star (a_curl_handle, a_opt, a_form.item)
end
setopt_slist (a_curl_handle: POINTER; a_opt: INTEGER; a_curl_slist: POINTER)
-- Declared as curl_easy_setopt().
require
exists: a_curl_handle /= default_pointer
valid: a_opt = {CURL_OPT_CONSTANTS}.curlopt_httpheader
exists: a_curl_slist /= default_pointer
do
setopt_void_star (a_curl_handle, a_opt, a_curl_slist)
end
setopt_curl_string (a_curl_handle: POINTER; a_opt: INTEGER; a_curl_string: CURL_STRING)
-- Declared as curl_easy_setopt().
require
exists: a_curl_handle /= default_pointer
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
not_void: a_curl_string /= Void
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_setopt")
if l_api /= default_pointer then
c_setopt_int (l_api, a_curl_handle, a_opt, a_curl_string.object_id)
end
end
setopt_integer (a_curl_handle: POINTER; a_opt: INTEGER; a_integer: INTEGER)
-- Declared as curl_easy_setopt().
require
exists: a_curl_handle /= default_pointer
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_setopt")
if l_api /= default_pointer then
c_setopt_int (l_api, a_curl_handle, a_opt, a_integer)
end
end
setopt_file (a_curl_handle: POINTER; a_opt: INTEGER; a_file: FILE)
-- Declared as curl_easy_setopt().
require
exists: a_curl_handle /= default_pointer
valid: a_opt = {CURL_OPT_CONSTANTS}.curlopt_readdata
readable: a_file /= Void and then a_file.file_readable
do
setopt_void_star (a_curl_handle, a_opt, a_file.file_pointer)
end
perform (a_curl_handle: POINTER): INTEGER
-- Declared as curl_easy_perform().
-- Result is one value from {CURL_CODES}
require
exists: a_curl_handle /= default_pointer
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_perform")
if l_api /= default_pointer then
Result := c_perform (l_api, a_curl_handle)
else
Result := {CURL_CODES}.eiffelcurle_error_occurred
end
end
cleanup (a_curl_handle: POINTER)
-- Declared as curl_easy_cleanup().
require
exists: a_curl_handle /= default_pointer
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_cleanup")
if l_api /= default_pointer then
c_cleanup (l_api, a_curl_handle)
end
end
feature -- Query
getinfo (a_curl_handle: POINTER; a_info: INTEGER; a_data: CELL [detachable ANY]): INTEGER
-- `curl_getinfo
--|* Request internal information from the curl session with this function. The
--|* third argument MUST be a pointer to a long, a pointer to a char * or a
--|* pointer to a double (as the documentation describes elsewhere). The data
--|* pointed to will be filled in accordingly and can be relied upon only if the
--|* function returns CURLE_OK. This function is intended to get used *AFTER* a
--|* performed transfer, all results from this function are undefined until the
--|* transfer is completed.
require
exists: a_curl_handle /= default_pointer
valid: (create {CURL_INFO_CONSTANTS}).is_valid (a_info)
local
l_api: POINTER
mp: detachable MANAGED_POINTER
l: INTEGER
cs: C_STRING
d: REAL_64
do
a_data.replace (Void)
l_api := api_loader.api_pointer ("curl_easy_getinfo")
if l_api /= default_pointer then
if a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
create mp.make ({PLATFORM}.integer_32_bytes)
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_string /= 0 then
create mp.make ({PLATFORM}.pointer_bytes)
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_double /= 0 then
create mp.make ({PLATFORM}.real_64_bytes)
end
if mp /= Void then
Result := c_getinfo (l_api, a_curl_handle, a_info, mp.item)
if Result = {CURL_CODES}.curle_ok then
if a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
l := mp.read_integer_32 (0)
a_data.put (l)
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_string /= 0 then
create cs.make_shared_from_pointer (mp.read_pointer (0))
a_data.put (cs.string)
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_double /= 0 then
d := mp.read_real_64 (0)
a_data.put (d)
end
end
end
end
end
is_dynamic_library_exists: BOOLEAN
-- If dll/so files exist?
do
Result := api_loader.is_interface_usable
end
feature -- Special setting
set_curl_function (a_curl_function: CURL_FUNCTION)
-- Set `curl_function' with `a_curl_function'
do
internal_curl_function := a_curl_function
ensure
set: a_curl_function /= Void implies curl_function = a_curl_function
end
curl_function: CURL_FUNCTION
-- cURL functions in curl_easy_setopt.
do
if attached internal_curl_function as l_curl_function then
Result := l_curl_function
else
create {CURL_DEFAULT_FUNCTION} Result.make
internal_curl_function := Result
end
ensure
not_void: Result /= Void
end
set_write_function (a_curl_handle: POINTER)
-- Set cURL write function
-- Set cURL write function with Eiffel default write function.
-- So we can use CURL_STRING as parameter in {CURL_EASY_EXTERNALS}.setopt_curl_string when the option is {CURL_OPT_CONSTANTS}.curlopt_writedata
require
exists: a_curl_handle /= default_pointer
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_setopt")
if l_api /= default_pointer then
curl_function.c_set_write_function (l_api, a_curl_handle)
end
end
set_read_function (a_curl_handle: POINTER)
-- Set cURL read function
-- Set cURL read function with Eiffel default read function.
-- So we can use a c file pointer as parameter in {CURL_EASY_EXTERNALS}.setopt_file_pointer when the option is {CURL_OPT_CONSTANTS}.curlopt_readdata
require
exists: a_curl_handle /= default_pointer
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_setopt")
if l_api /= default_pointer then
curl_function.c_set_read_function (l_api, a_curl_handle)
end
end
set_progress_function (a_curl_handle: POINTER)
-- Set cURL progress function for upload/download progress.
require
exists: a_curl_handle /= default_pointer
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_setopt")
if l_api /= default_pointer then
curl_function.c_set_progress_function (l_api, a_curl_handle)
end
end
set_debug_function (a_curl_handle: POINTER)
-- Set cURL debug function
require
exists: a_curl_handle /= default_pointer
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_setopt")
if l_api /= default_pointer then
curl_function.c_set_debug_function (l_api, a_curl_handle)
end
end
feature {NONE} -- Implementation
internal_curl_function: detachable CURL_FUNCTION
-- cURL functions.
api_loader: DYNAMIC_MODULE
-- Module name.
local
l_utility: CURL_UTILITY
once
create l_utility
Result := l_utility.api_loader
end
setopt_void_star (a_curl_handle: POINTER; a_opt: INTEGER; a_data:POINTER)
-- Declared as curl_easy_setopt().
require
exists: a_curl_handle /= default_pointer
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_easy_setopt")
if l_api /= default_pointer then
c_setopt (l_api, a_curl_handle, a_opt, a_data)
end
end
feature {NONE} -- C externals
c_init (a_api: POINTER): POINTER
-- Declared curl_easy_init ().
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
return (FUNCTION_CAST(CURL *, ()) $a_api)();
]"
end
c_cleanup (a_api: POINTER; a_curl_handle: POINTER)
-- Decalred as curl_easy_cleanup ().
require
exists: a_api /= default_pointer
exists: a_curl_handle /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
(FUNCTION_CAST(void, (CURL *)) $a_api)((CURL *)$a_curl_handle);
]"
end
c_perform (a_api: POINTER; a_curl_handle: POINTER): INTEGER
-- Declared as curl_easy_perform().
require
exists: a_api /= default_pointer
exists: a_curl_handle /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
return (FUNCTION_CAST(CURLcode, (CURL *)) $a_api)
((CURL *) $a_curl_handle);
]"
end
c_setopt_int (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: INTEGER)
-- Same as `c_setopt' except we can pass `a_data' as integer.
require
exists: a_api /= default_pointer
exists: a_curl_handle /= default_pointer
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
external
"C inline use <curl/curl.h>"
alias
"[
{
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_api)
((CURL *) $a_curl_handle,
(CURLoption)$a_opt,
$a_data);
}
]"
end
c_setopt (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: POINTER)
-- C implementation of `setopt_void_star'.
-- Declared as curl_easy_setopt ().
require
exists: a_api /= default_pointer
exists: a_curl_handle /= default_pointer
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
external
"C inline use <curl/curl.h>"
alias
"[
{
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_api)
((CURL *) $a_curl_handle,
(CURLoption)$a_opt,
$a_data);
}
]"
end
c_getinfo (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: POINTER): INTEGER
-- C implementation of `curl_easy_getinfo'.
-- Declared as curl_easy_setopt ().
require
exists: a_api /= default_pointer
exists: a_curl_handle /= default_pointer
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
external
"C inline use <curl/curl.h>"
alias
"[
return (FUNCTION_CAST(CURLcode, (CURL *, CURLINFO info, ...)) $a_api)
((CURL *) $a_curl_handle,
(CURLINFO)$a_opt,
$a_data);
]"
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2010, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,254 @@
note
description: "[
cURL externals.
For more information, see:
http://curl.haxx.se/libcurl/c/
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_EXTERNALS
feature -- Command
global_init
-- Declared as curl_global_init().
require
dynamic_library_exists: is_dynamic_library_exists
local
l_ptr: POINTER
do
l_ptr := api_loader.api_pointer ("curl_global_init")
if l_ptr /= default_pointer then
c_curl_global_init (l_ptr, {CURL_GLOBAL_CONSTANTS}.curl_global_all);
end
end
global_cleanup
-- Declared as curl_global_cleanup().
local
l_ptr: POINTER
do
l_ptr := api_loader.api_pointer ("curl_global_cleanup")
if l_ptr /= default_pointer then
c_curl_global_cleanup (l_ptr);
end
end
formadd_string_string (a_form: CURL_FORM; a_last_pointer: CURL_FORM; a_arg_1: INTEGER; a_arg_1_value: READABLE_STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: READABLE_STRING_GENERAL; a_arg_3: INTEGER)
-- Declared as curl_formadd ().
require
not_void: a_form /= Void
not_void: a_last_pointer /= Void
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_1)
not_void: a_arg_1_value /= Void
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_2)
not_void: a_arg_2_value /= Void
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_3)
local
l_form_pointer, l_last_pointer: POINTER
do
l_form_pointer := a_form.item
l_last_pointer := a_last_pointer.item
internal_formadd_string_string ($l_form_pointer, $l_last_pointer, a_arg_1, a_arg_1_value, a_arg_2, a_arg_2_value, a_arg_3)
if a_form.item /= l_form_pointer then
check not_set: a_form.item = default_pointer end
a_form.set_item (l_form_pointer)
end
if a_last_pointer.item /= l_last_pointer then
a_last_pointer.set_item (l_last_pointer)
end
end
slist_append (a_list: POINTER; a_string: READABLE_STRING_GENERAL): POINTER
-- Declared as curl_slist_append ().
-- note: call with a null `a_list' to get initialized pointer as Result
require
not_void: a_string /= Void
local
l_c_string: C_STRING
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_slist_append")
if l_api /= default_pointer then
create l_c_string.make (a_string)
Result := c_slist_append (l_api, a_list, l_c_string.item)
end
end
slist_free_all (a_curl_slist: POINTER)
-- Declared as curl_slist_free_all ().
-- See: http://curl.haxx.se/libcurl/c/curl_slist_free_all.html
-- curl_slist_free_all - free an entire curl_slist list
-- This must be called when the data has been used, which typically means after the curl_easy_perform(3) has been called.
require
exists: a_curl_slist /= default_pointer
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_slist_free_all")
if l_api /= default_pointer then
c_slist_free_all (l_api, a_curl_slist)
end
end
feature -- Query
is_dynamic_library_exists: BOOLEAN
-- If dll/so files exist?
do
Result := api_loader.is_interface_usable
end
feature {CURL_FORM} -- Internal command
formfree (a_curl_form: POINTER)
-- Declared as curl_formfree ().
-- See: http://curl.askapache.com/libcurl/c/curl_formfree.html
-- curl_formfree() is used to clean up data previously built/appended with curl_formadd(3).
-- This must be called when the data has been used, which typically means after the curl_easy_perform(3) has been called.
require
exists: a_curl_form /= default_pointer
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_formfree")
if l_api /= default_pointer then
c_formfree (l_api, a_curl_form)
end
end
feature {NONE} -- Implementation
api_loader: DYNAMIC_MODULE
-- Module name.
local
l_utility: CURL_UTILITY
once
create l_utility
Result := l_utility.api_loader
end
internal_formadd_string_string (a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: READABLE_STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: READABLE_STRING_GENERAL; a_arg_3: INTEGER)
-- Declared as curl_formadd ().
local
l_c_string_1, l_c_string_2: C_STRING
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_formadd");
if l_api /= default_pointer then
create l_c_string_1.make (a_arg_1_value)
create l_c_string_2.make (a_arg_2_value)
c_formadd_string_string (l_api, a_form, a_last_pointer, a_arg_1, l_c_string_1.item, a_arg_2, l_c_string_2.item, a_arg_3)
end
end
feature {NONE} -- C externals
c_formadd_string_string (a_api: POINTER; a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: POINTER; a_arg_2: INTEGER; a_arg_2_value: POINTER; a_arg_3: INTEGER)
-- C implementation of formadd_string_string ().
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
{
(FUNCTION_CAST(void, (struct curl_httppost **, struct curl_httppost **, int, char *, int, char *, int)) $a_api)
((struct curl_httppost **)$a_form,
(struct curl_httppost **)$a_last_pointer,
(int)$a_arg_1,
(char *)$a_arg_1_value,
(int)$a_arg_2,
(char *)$a_arg_2_value,
(int)$a_arg_3);
}
]"
end
c_formfree (a_api: POINTER; a_curl_form: POINTER)
-- Declared as curl_formfree ().
require
exists: a_api /= default_pointer
exists: a_curl_form /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
(FUNCTION_CAST(void, (struct curl_httppost *)) $a_api)
((struct curl_httppost *) $a_curl_form);
]"
end
c_curl_global_init (a_api: POINTER; a_opt: NATURAL_64)
-- `a_api' point to API curl_global_init ()
-- `a_opt' is intialization option.
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
(FUNCTION_CAST(void, (long)) $a_api)((long) $a_opt);
]"
end
c_curl_global_cleanup (a_api: POINTER)
-- `a_api' point to API curl_global_cleanup()
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
(FUNCTION_CAST(void, ()) $a_api)();
]"
end
c_slist_append (a_api: POINTER; a_list_pointer: POINTER; a_string: POINTER): POINTER
-- Declared as curl_slist_append ().
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
{
return (FUNCTION_CAST(void *, (struct curl_slist *, const char *)) $a_api)
((struct curl_slist *)$a_list_pointer,
(const char *)$a_string);
}
]"
end
c_slist_free_all (a_api: POINTER; a_list_pointer: POINTER)
-- Declared as void curl_slist_free_all(struct curl_slist * list)
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
(FUNCTION_CAST(void *, (struct curl_slist *)) $a_api)
((struct curl_slist *)$a_list_pointer);
]"
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2010, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,94 @@
note
description: "[
cURL form.
For more informaton see:
http://curl.haxx.se/libcurl/c/curl_formadd.html
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_FORM
inherit
DISPOSABLE
create
make,
share_with_pointer
feature {NONE} -- Initialization
make
-- Creation method.
do
end
share_with_pointer (a_pointer: POINTER)
-- Creation method.
-- `item' share with `a_pointer'.
require
exists: a_pointer /= default_pointer
do
item := a_pointer
ensure
set: item = a_pointer
end
feature -- Query
item: POINTER
-- C pointer of Current.
is_exists: BOOLEAN
-- If C pointer exists?
do
Result := item /= default_pointer
end
feature -- Command
dispose
-- Free memory if possible.
local
l_curl: CURL_EXTERNALS
do
if item /= default_pointer then
create l_curl
l_curl.formfree (item)
item := default_pointer
end
end
release_item
-- Release item
-- NOT free memory! This is useful if Current generated by {CURL_EXTERNALS}.formadd_string_string.
do
item := default_pointer
end
feature {CURL_EXTERNALS} -- Internal command
set_item (a_item: POINTER)
-- Set `item' with `a_item'
do
item := a_item
ensure
set: item = a_item
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,78 @@
note
description: "[
cURL form constants.
For more informaton see:
http://curl.haxx.se/libcurl/c/curl_formadd.html
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_FORM_CONSTANTS
feature -- Query
curlform_copyname: INTEGER
-- Declared as CURLFORM_COPYNAME
external
"C inline use <curl/curl.h>"
alias
"[
CURLFORM_COPYNAME
]"
end
curlform_copycontents: INTEGER
-- Declared as CURLFORM_COPYCONTENTS
external
"C inline use <curl/curl.h>"
alias
"[
CURLFORM_COPYCONTENTS
]"
end
curlform_end: INTEGER
-- Declared as CURLFORM_END
external
"C inline use <curl/curl.h>"
alias
"[
CURLFORM_END
]"
end
curlform_file: INTEGER
-- Declared as CURLFORM_FILE
external
"C inline use <curl/curl.h>"
alias
"[
CURLFORM_FILE
]"
end
is_valid (a_integer: INTEGER): BOOLEAN
-- If `a_integer' valid?
do
Result := a_integer = curlform_copycontents or
a_integer = curlform_copyname or
a_integer = curlform_end or
a_integer = curlform_file
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,257 @@
note
description: "[
cURL curl_easy_setopt callback functions' Eiffel wrappers.
We need this class since cURL need a c function pointer as value but
Eiffel function need frist parameter of any funciton call is object address.
Client programmers can inherit this class to fit their needs.
Note: descendants of this class have to call `set_object_and_function_address',
otherwise cURL would not know how to call Eiffel features (such as `write_function').
See example: $ISE_LIBRARY\examples\cURL\upload_and_read_function
See http://curl.haxx.se/libcurl/c/curl_easy_setopt.html for libcurl documentation
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
deferred class
CURL_FUNCTION
inherit
DISPOSABLE
feature -- Interactive with C
set_object_and_function_address
-- Set object and function addresses.
-- Call this feature before call `c_set_progress_function', `c_set_debug_function' and `c_set_write_function, c_set_read_function'.
do
c_set_object ($Current)
c_set_progress_function_address ($progress_function)
c_set_write_function_address ($write_function)
c_set_read_function_address ($read_function)
c_set_debug_function_address ($debug_function)
end
c_set_progress_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
-- Setting CURLOPT_PROGRESSFUNCTION option of `a_curl_handle'.
-- We need this function since cURL need a c function pointer as value.
require
exists: a_setopt_api /= default_pointer
external
"C inline use <eiffel_curl.h>"
alias
"[
{
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
((CURL *) $a_curl_handle,
(CURLoption)CURLOPT_PROGRESSFUNCTION,
curl_progress_function);
}
]"
end
c_set_debug_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
-- Setting CURLOPT_DEBUGFUNCTION option of `a_curl_handle'.
-- We need this function since cURL need a c function pointer as value.
require
exists: a_curl_handle /= default_pointer
external
"C inline use <eiffel_curl.h>"
alias
"[
{
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
((CURL *) $a_curl_handle,
(CURLoption)CURLOPT_DEBUGFUNCTION,
curl_debug_function);
}
]"
end
c_set_write_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
-- Setting CURLOPT_WRITEFUNCTION option of `a_curl_handle'.
-- We need this function since cURL need a c function pointer as value.
require
exists: a_setopt_api /= default_pointer
external
"C inline use <eiffel_curl.h>"
alias
"[
{
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
((CURL *) $a_curl_handle,
(CURLoption)CURLOPT_WRITEFUNCTION,
curl_write_function);
}
]"
end
c_set_read_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
-- Setting CURLOPT_READFUNCTION option of `a_curl_handle'.
-- We need this function since cURL need a c function pointer as value.
require
exists: a_setopt_api /= default_pointer
external
"C inline use <eiffel_curl.h>"
alias
"[
{
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
((CURL *) $a_curl_handle,
(CURLoption)CURLOPT_READFUNCTION,
curl_read_function);
}
]"
end
feature -- cURL curl_easy_setopt functions
progress_function (a_object_id: POINTER; a_download_total, a_download_now, a_upload_total, a_upload_now: REAL_64): INTEGER
-- Function correspond to {CURL_OPT_CONSTANTS}.curlopt_progressfunction
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
-- may changed during GC.
deferred
end
write_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
-- Function called by libcurl as soon as there is data received that needs to be saved.
-- The size of the data pointed to by `a_data_pointer' is `a_size' multiplied with `a_nmemb', it will not be null terminated.
-- Returns the number of bytes actually taken care of
--
-- Function corresponds to {CURL_OPT_CONSTANTS}.curlopt_writefunction
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
-- may changed during GC.
--| libcurl doc:
--| Function pointer that should match the following prototype: size_t function( char *ptr, size_t size, size_t nmemb, void *userdata);
--| This function gets called by libcurl as soon as there is data received that needs to be saved.
--| The size of the data pointed to by ptr is size multiplied with nmemb, it will not be zero terminated.
--| Return the number of bytes actually taken care of.
--| If that amount differs from the amount passed to your function, it'll signal an error to the library.
--| This will abort the transfer and return CURLE_WRITE_ERROR.
--| From 7.18.0, the function can return CURL_WRITEFUNC_PAUSE which then will cause writing to this connection to become paused.
--| See curl_easy_pause(3) for further details.
--|
--| This function may be called with zero bytes data if the transferred file is empty.
--|
--| Set this option to NULL to get the internal default function.
--| The internal default function will write the data to the FILE * given with CURLOPT_WRITEDATA.
--|
--| Set the userdata argument with the CURLOPT_WRITEDATA option.
--|
--| The callback function will be passed as much data as possible in all invokes,
--| but you cannot possibly make any assumptions. It may be one byte, it may be thousands.
--| The maximum amount of body data that can be passed to the write callback is defined
--| in the curl.h header file: CURL_MAX_WRITE_SIZE (the usual default is 16K).
--| If you however have CURLOPT_HEADER set, which sends header data to the write callback,
--| you can get up to CURL_MAX_HTTP_HEADER bytes of header data passed into it. This usually means 100K.
deferred
end
read_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
-- Function called by libcurl as soon as it needs to read data in order to send it to the peer.
-- The data area pointed at by the pointer `a_data_pointer' may be filled with at most
-- `a_size' multiplied with `a_nmemb' number of bytes.
-- Returns the actual number of bytes stored in that memory area.
-- Returning 0 will signal end-of-file to the library and cause it to stop the current transfer.
--
-- Function corresponds to {CURL_OPT_CONSTANTS}.curlopt_readfunction
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
-- may changed during GC.
--| libcurl doc:
--| Function pointer that should match the following prototype: size_t function( void *ptr, size_t size, size_t nmemb, void *userdata);
--| This function gets called by libcurl as soon as it needs to read data in order to send it to the peer.
--| The data area pointed at by the pointer ptr may be filled with at most size multiplied with nmemb number of bytes.
--| Your function must return the actual number of bytes that you stored in that memory area.
--| Returning 0 will signal end-of-file to the library and cause it to stop the current transfer.
--|
--| If you stop the current transfer by returning 0 "pre-maturely" (i.e before the server expected it,
--| like when you've said you will upload N bytes and you upload less than N bytes),
--| you may experience that the server "hangs" waiting for the rest of the data that won't come.
--|
--| The read callback may return CURL_READFUNC_ABORT to stop the current operation immediately,
--| resulting in a CURLE_ABORTED_BY_CALLBACK error code from the transfer (Added in 7.12.1)
--|
--| From 7.18.0, the function can return CURL_READFUNC_PAUSE which then will cause reading from this connection to become paused.
--| See curl_easy_pause(3) for further details.
--|
--| Bugs: when doing TFTP uploads, you must return the exact amount of data that the callback wants,
--| or it will be considered the final packet by the server end and the transfer will end there.
--|
--| If you set this callback pointer to NULL, or don't set it at all, the default internal read function will be used.
--| It is doing an fread() on the FILE * userdata set with CURLOPT_READDATA.
deferred
end
debug_function (a_curl_handle: POINTER; a_curl_infotype: INTEGER; a_char_pointer: POINTER; a_size: INTEGER; a_object_id: POINTER): INTEGER
-- Function correspond to {CURL_OPT_CONSTANTS}.curlopt_debugfunction
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
-- may changed during GC.
require
vaild: (create {CURL_INFO_TYPE}).is_valid (a_curl_infotype)
deferred
end
feature {NONE} -- Externals
c_set_object (a_object: POINTER)
-- Set Current object address.
external
"C signature (EIF_REFERENCE) use %"eiffel_curl.h%""
end
c_release_object
-- Release Current pointer in C
external
"C use %"eiffel_curl.h%""
end
c_set_progress_function_address (a_address: POINTER)
-- Set progress function address.
external
"C use %"eiffel_curl.h%""
end
c_set_write_function_address (a_address: POINTER)
-- Set write function address.
external
"C use %"eiffel_curl.h%""
end
c_set_read_function_address (a_address: POINTER)
-- Set read function address.
external
"C use %"eiffel_curl.h%""
end
c_set_debug_function_address (a_address: POINTER)
-- Set write function address.
external
"C use %"eiffel_curl.h%""
end
feature {NONE} -- Implementation
dispose
-- Wean `Current'
do
c_release_object
c_set_object (default_pointer)
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,78 @@
note
description: "[
cURL library constants used by curl_global_init ()
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_GLOBAL_CONSTANTS
feature -- Query
curl_global_ssl: NATURAL_64
-- Delcared as CURL_GLOBAL_SSL
external
"C inline use <curl/curl.h>"
alias
"[
return CURL_GLOBAL_SSL;
]"
end
curl_global_win32: NATURAL_64
-- Delcared as CURL_GLOBAL_WIN32
external
"C inline use <curl/curl.h>"
alias
"[
return CURL_GLOBAL_WIN32;
]"
end
curl_global_all: NATURAL_64
-- Delcared as CURL_GLOBAL_ALL
external
"C inline use <curl/curl.h>"
alias
"[
return CURL_GLOBAL_ALL;
]"
end
curl_global_nothing: NATURAL_64
-- Delcared as CURL_GLOBAL_NOTHING
external
"C inline use <curl/curl.h>"
alias
"[
return CURL_GLOBAL_NOTHING;
]"
end
curl_global_default: NATURAL_64
-- Delcared as CURL_GLOBAL_DEFAULT
external
"C inline use <curl/curl.h>"
alias
"[
return CURL_GLOBAL_DEFAULT;
]"
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,122 @@
note
description: "[
cURL library info constants.
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_INFO_CONSTANTS
feature -- Constants
curlinfo_string: INTEGER = 0x100000
-- Declared as CURLINFO_STRING
curlinfo_long: INTEGER = 0x200000
-- Declared as CURLINFO_LONG
curlinfo_double: INTEGER = 0x300000
-- Declared as CURLINFO_DOUBLE
curlinfo_slist: INTEGER = 0x400000
-- Declared as CURLINFO_SLIST
curlinfo_mask: INTEGER = 0x0fffff
-- Declared as CURLINFO_MASK
curlinfo_typemask: INTEGER = 0xf00000
-- Declared as CURLINFO_TYPEMASK
feature -- Info constants
curlinfo_effective_url: INTEGER = 0x100001 -- CURLINFO_STRING + 1,
curlinfo_response_code: INTEGER = 0x200002 -- CURLINFO_LONG + 2,
curlinfo_total_time: INTEGER = 0x300003 -- CURLINFO_DOUBLE + 3,
curlinfo_namelookup_time: INTEGER = 0x300004 -- CURLINFO_DOUBLE + 4,
curlinfo_connect_time: INTEGER = 0x300005 -- CURLINFO_DOUBLE + 5,
curlinfo_pretransfer_time: INTEGER = 0x300006 -- CURLINFO_DOUBLE + 6,
curlinfo_size_upload: INTEGER = 0x300007 -- CURLINFO_DOUBLE + 7,
curlinfo_size_download: INTEGER = 0x300008 -- CURLINFO_DOUBLE + 8,
curlinfo_speed_download: INTEGER = 0x300009 -- CURLINFO_DOUBLE + 9,
curlinfo_speed_upload: INTEGER = 0x30000a -- CURLINFO_DOUBLE + 10,
curlinfo_header_size: INTEGER = 0x20000b -- CURLINFO_LONG + 11,
curlinfo_request_size: INTEGER = 0x20000c -- CURLINFO_LONG + 12,
curlinfo_ssl_verifyresult: INTEGER = 0x20000d -- CURLINFO_LONG + 13,
curlinfo_filetime: INTEGER = 0x20000e -- CURLINFO_LONG + 14,
curlinfo_content_length_download: INTEGER = 0x30000f -- CURLINFO_DOUBLE + 15,
curlinfo_content_length_upload: INTEGER = 0x300010 -- CURLINFO_DOUBLE + 16,
curlinfo_starttransfer_time: INTEGER = 0x300011 -- CURLINFO_DOUBLE + 17,
curlinfo_content_type: INTEGER = 0x100012 -- CURLINFO_STRING + 18,
curlinfo_redirect_time: INTEGER = 0x300013 -- CURLINFO_DOUBLE + 19,
curlinfo_redirect_count: INTEGER = 0x200014 -- CURLINFO_LONG + 20,
curlinfo_private: INTEGER = 0x100015 -- CURLINFO_STRING + 21,
curlinfo_http_connectcode: INTEGER = 0x200016 -- CURLINFO_LONG + 22,
curlinfo_httpauth_avail: INTEGER = 0x200017 -- CURLINFO_LONG + 23,
curlinfo_proxyauth_avail: INTEGER = 0x200018 -- CURLINFO_LONG + 24,
curlinfo_os_errno: INTEGER = 0x200019 -- CURLINFO_LONG + 25,
curlinfo_num_connects: INTEGER = 0x20001a -- CURLINFO_LONG + 26,
curlinfo_ssl_engines: INTEGER = 0x40001b -- CURLINFO_SLIST + 27,
curlinfo_cookielist: INTEGER = 0x40001c -- CURLINFO_SLIST + 28,
curlinfo_lastsocket: INTEGER = 0x20001d -- CURLINFO_LONG + 29,
curlinfo_ftp_entry_path: INTEGER = 0x10001e -- CURLINFO_STRING + 30,
feature -- Contract support
is_valid (a_code: INTEGER): BOOLEAN
-- Is `a_code' valid?
do
inspect a_code
when
curlinfo_effective_url,
curlinfo_response_code,
curlinfo_total_time,
curlinfo_namelookup_time,
curlinfo_connect_time,
curlinfo_pretransfer_time,
curlinfo_size_upload,
curlinfo_size_download,
curlinfo_speed_download,
curlinfo_speed_upload,
curlinfo_header_size,
curlinfo_request_size,
curlinfo_ssl_verifyresult,
curlinfo_filetime,
curlinfo_content_length_download,
curlinfo_content_length_upload,
curlinfo_starttransfer_time,
curlinfo_content_type,
curlinfo_redirect_time,
curlinfo_redirect_count,
curlinfo_private,
curlinfo_http_connectcode,
curlinfo_httpauth_avail,
curlinfo_proxyauth_avail,
curlinfo_os_errno,
curlinfo_num_connects,
curlinfo_ssl_engines,
curlinfo_cookielist,
curlinfo_lastsocket,
curlinfo_ftp_entry_path
then
Result := True
else
Result := False
end
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,69 @@
note
description: "[
cURL library info type constants.
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_INFO_TYPE
feature -- Enumeration
curlinfo_text: INTEGER = 0
-- Declared as CURLINFO_TEXT
curlinfo_header_in: INTEGER = 1
-- Declared as CURLINFO_HEADER_IN
curlinfo_header_out: INTEGER = 2
-- Declared as CURLINFO_HEADER_OUT
curlinfo_data_in: INTEGER = 3
-- Declared as CURLINFO_DATA_IN
curlinfo_data_out: INTEGER = 4
-- Declared as CURLINFO_DATA_OUT
curlinfo_ssl_data_in: INTEGER = 5
-- Declared as CURLINFO_SSL_DATA_IN
curlinfo_ssl_data_out: INTEGER = 6
-- Declared as CURLINFO_SSL_DATA_OUT
feature -- Contract support
is_valid (a_type: INTEGER): BOOLEAN
-- If `a_type' valid?
do
inspect a_type
when
curlinfo_data_in,
curlinfo_data_out,
curlinfo_header_in,
curlinfo_header_out,
curlinfo_ssl_data_in,
curlinfo_ssl_data_out,
curlinfo_text
then
Result := True
else
Result := False
end
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,51 @@
note
description: "[
C CURLMSG enum
]"
date: "$Date$"
revision: "$Revision$"
class
CURL_MSG
feature -- Query
curlmsg_done: INTEGER
-- Declared as CURLMSG_DONE.
-- This easy handle has completed.
-- 'result' contains the CURLcode of the transfer
external
"C inline use <curl/curl.h>"
alias
"return CURLMSG_DONE;"
end
curlmsg_none: INTEGER
-- Declared as CURLMSG_NONE.
-- First, not used
external
"C inline use <curl/curl.h>"
alias
"return CURLMSG_NONE;"
end
curlmsg_last: INTEGER
-- Declared as CURLMSG_LAST.
-- Last, not used
external
"C inline use <curl/curl.h>"
alias
"return CURLMSG_LAST;"
end
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,83 @@
note
description: "[
C Struct CURLMsg wrapper
Read multi stack informationals
This class is used by {CURL_MSG_STRUCT}.info_read
More info:
http://curl.haxx.se/libcurl/c/curl_multi_info_read.html
]"
date: "$Date$"
revision: "$Revision$"
class
CURL_MSG_STRUCT
create
make
feature {NONE} -- Initialization
make (a_pointer: POINTER)
-- Creation method
-- Bind message structure to the address `a_pointer'".
require
not_default: a_pointer /= default_pointer
do
item := a_pointer
ensure
set: item = a_pointer
end
feature -- Query
curl_handle: POINTER
-- CURL easy_handle
-- The handle it concerns
do
Result := c_curl_handle (item)
end
msg: INTEGER
-- What does this message mean?
-- It's one value from {CURLMSG}
do
Result := c_msg (item)
end
feature {NONE} -- Implementation
item: POINTER
-- C struct item
feature {NONE} -- C externals
c_curl_handle (a_item: POINTER): POINTER
-- cURL easy handle it concerns
external
"C inline use <curl/curl.h>"
alias
"return (CURL *)((CURLMsg *)$a_item)->easy_handle;"
end
c_msg (a_item: POINTER): INTEGER
-- Get msg
external
"C inline use <curl/curl.h>"
alias
"return (CURLMSG)((CURLMsg *)$a_item)->msg;"
end
;note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,48 @@
note
description: "[
The generic return code used by functions in the libcurl multi interface.
Also consider curl_multi_strerror(3).
]"
date: "$Date$"
revision: "$Revision$"
class
CURL_MULTI_CODES
feature -- Query
curlm_call_multi_perform: INTEGER = -1
-- This is not really an error. It means you should call curl_multi_perform(3) again without doing select() or similar in between.
curlm_ok: INTEGER = 0
-- Things are fine.
curlm_bad_handle: INTEGER = 1
-- The passed-in handle is not a valid CURLM handle.
curlm_bad_easy_handle: INTEGER = 2
-- An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle.
curlm_out_of_memory: INTEGER = 3
-- You are doomed.
curlm_internal_error: INTEGER = 4
-- This can only be returned if libcurl bugs. Please report it to us!
curlm_bad_socket: INTEGER = 5
-- The passed-in socket is not a valid one that libcurl already knows about. (Added in 7.15.4)
curlm_unknown_option: INTEGER = 6
-- curl_multi_setopt() with unsupported option (Added in 7.15.4)
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,251 @@
note
description: "[
The multi interface offers several abilities that the easy interface doesn't. They are mainly:
1. Enable a "pull" interface. The application that uses libcurl decides where and when to ask libcurl to get/send data.
2. Enable multiple simultaneous transfers in the same thread without making it complicated for the application.
3. Enable the application to wait for action on its own file descriptors and curl's file descriptors simultaneous easily.
More info: http://curl.haxx.se/libcurl/c/libcurl-multi.html
]"
date: "$Date$"
revision: "$Revision$"
class
CURL_MULTI_EXTERNALS
feature -- Command
init
-- Create a multi handle.
-- If success, Result is a cURL multi hanlde just created.
-- This feature maybe failed in some cases: cannot find required DLL, etc.
-- Then the post condition would be violated.
require
dynamic_library_exists: is_dynamic_library_exists
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_multi_init")
if l_api /= default_pointer then
item := c_init (l_api)
end
end
add_handle (a_easy_handle: POINTER)
-- Add an easy handle to a multi session.
require
dynamic_library_exists: is_dynamic_library_exists
is_multi_handle_exists: is_exists
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_multi_add_handle")
if l_api /= default_pointer then
c_add_handle (l_api, item, a_easy_handle)
end
end
remove_handle (a_easy_handle: POINTER)
-- Remove an easy handle from a multi session.
require
dynamic_library_exists: is_dynamic_library_exists
is_multi_handle_exists: is_exists
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_multi_remove_handle")
if l_api /= default_pointer then
c_remove_handle (l_api, item, a_easy_handle)
end
end
cleanup: INTEGER
-- Close down a multi session.
-- Result is one value from {CURL_MULTI_CODES}.
require
dynamic_library_exists: is_dynamic_library_exists
is_multi_handle_exists: is_exists
local
l_api: POINTER
do
l_api := api_loader.api_pointer ("curl_multi_cleanup")
if l_api /= default_pointer then
Result := c_cleanup (l_api, item)
end
end
perform (a_running_handle: CELL [INTEGER]): INTEGER
-- Reads/writes available data from each easy handle.
-- Result is one value from {CURL_MULTI_CODES}.
require
dynamic_library_exists: is_dynamic_library_exists
is_multi_handle_exists: is_exists
local
l_api: POINTER
l_running_handle: INTEGER
do
l_api := api_loader.api_pointer ("curl_multi_perform")
if l_api /= default_pointer then
Result := c_perform (l_api, item, $l_running_handle)
a_running_handle.put (l_running_handle)
end
end
info_read (a_msgs_in_queue: CELL [INTEGER]): POINTER
-- Read multi stack informationals.
-- The result is C struct CURLMsg {CURL_MSG_STRUCT}.
-- Repeated calls to this function will return a new struct each time, until a NULL
-- is returned as a signal that there is no more to get at this point. The integer
-- pointed to with msgs_in_queue will contain the number of remaining messages after
-- this function was called.
-- When you fetch a message using this function, it is removed from the internal queue
-- so calling this function again will not return the same message again. It will instead
-- return new messages at each new invoke until the queue is emptied.
require
dynamic_library_exists: is_dynamic_library_exists
is_multi_handle_exists: is_exists
local
l_api: POINTER
l_msgs_in_queue: INTEGER
do
l_api := api_loader.api_pointer ("curl_multi_info_read")
if l_api /= default_pointer then
Result := c_info_read (l_api, item, $l_msgs_in_queue)
a_msgs_in_queue.put (l_msgs_in_queue)
end
end
is_dynamic_library_exists: BOOLEAN
-- Are required .dll/.so files available?
do
Result := api_loader.is_interface_usable
end
-- Feature not yet wrapped/tested
-- curl_multi_assign
-- curl_multi_fdset
-- curl_multi_setopt
-- curl_multi_socket
-- curl_multi_socket_action
-- curl_multi_strerror
-- curl_multi_timeout
feature -- Query
is_exists: BOOLEAN
-- If C pointer exists?
do
Result := item /= default_pointer
end
feature {NONE} -- Implementation
item: POINTER
-- C pointer item for cURL multi
feature {NONE} -- C externals
c_init (a_api: POINTER): POINTER
-- Declared as curl_multi_init ().
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
return (FUNCTION_CAST(CURLM *, ()) $a_api)();
]"
end
c_cleanup (a_api: POINTER; a_multi_handle: POINTER): INTEGER
-- Declared as curl_multi_cleanup ().
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
return (FUNCTION_CAST(CURLMcode, (CURLM *)) $a_api)
((CURLM *)$a_multi_handle);
]"
end
c_add_handle (a_api: POINTER; a_multi_handle: POINTER; a_easy_handle: POINTER)
-- Declared as curl_multi_add_handle ().
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
(FUNCTION_CAST(void, (CURLM *, CURL *)) $a_api)
((CURLM *) $a_multi_handle,
(CURL *) $a_easy_handle);
]"
end
c_remove_handle (a_api: POINTER; a_multi_handle: POINTER; a_easy_handle: POINTER)
-- Declared as curl_multi_remove_handle ().
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
(FUNCTION_CAST(void, (CURLM *, CURL *)) $a_api)
((CURLM *) $a_multi_handle,
(CURL *) $a_easy_handle);
]"
end
c_perform (a_api: POINTER; a_multi_handle: POINTER; a_running_handles: TYPED_POINTER [INTEGER]): INTEGER
-- Declared as curl_multi_perform.
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
return (FUNCTION_CAST(CURLMcode, (CURLM *, int *)) $a_api)
((CURLM *) $a_multi_handle,
(int *) $a_running_handles);
]"
end
c_info_read (a_api: POINTER; a_multi_handle: POINTER; a_msgs_in_queue: TYPED_POINTER [INTEGER]): POINTER
-- Declared as curl_multi_info_read.
require
exists: a_api /= default_pointer
external
"C inline use <curl/curl.h>"
alias
"[
return (FUNCTION_CAST(CURLMsg *, (CURLM *, int *)) $a_api)
((CURLM *) $a_multi_handle,
(int *) $a_msgs_in_queue);
]"
end
feature {NONE} -- Implementation
api_loader: DYNAMIC_MODULE
-- Module name.
local
l_utility: CURL_UTILITY
once
create l_utility
Result := l_utility.api_loader
end
note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
note
description: "[
String used by cURL wrapper library.
Only added features from IDENTIFIED.
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_STRING
inherit
STRING
select
is_equal,
copy,
out
end
IDENTIFIED
rename
is_equal as identified_is_equal,
copy as identified_copy,
out as identified_out
end
create
make,
make_empty,
make_filled,
make_from_string,
make_from_c,
make_from_cil
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1,51 @@
note
description: "[
Utilities for Eiffel cURL wrapper library.
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
CURL_UTILITY
feature -- Query
api_loader: DYNAMIC_MODULE
-- API dynamic loader
local
l_platform: PLATFORM
once
create l_platform
if l_platform.is_unix or l_platform.is_mac then
create Result.make_with_version (module_name, "3")
else
check is_window: l_platform.is_windows end
create Result.make (module_name)
end
ensure
not_void: Result /= Void
end
module_name: STRING
-- Module name.
once
Result := "libcurl"
ensure
not_void: Result /= Void
end
note
library: "cURL: Library of reusable components for Eiffel."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -1,40 +1,38 @@
note
description: "Summary description for {WSF_CUSTOM_HEADER_FILTER}."
date: "$Date: 2013-05-23 21:54:29 +0200 (jeu., 23 mai 2013) $"
revision: "$Revision: 92585 $"
description: "[
Interactive with native system APIs for dynamic loading.
Cocoa verson.
]"
status: "See notice at end of class."
legal: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
WSF_CUSTOM_HEADER_FILTER
API_LOADER_IMP
inherit
WSF_FILTER
feature -- Command
create
make
feature {NONE} -- Initialization
make (n: INTEGER)
load_module (a_name: STRING): POINTER
-- Load module with `a_name'.
require
exists: a_name /= Void
do
create custom_header.make_with_count (n)
-- fixme: implement
end
feature -- Access
custom_header: HTTP_HEADER
feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter
loal_api (a_module: POINTER; a_name: STRING): POINTER
-- Load api which name is `a_name' in `a_module'
require
exists: a_module /= default_pointer
exists: a_name /= Void
do
res.put_header_lines (custom_header)
execute_next (req, res)
-- fixme: implement
end
note
copyright: "Copyright (c) 1984-2013, Eiffel Software"
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
copyright: "Copyright (c) 1984-2007, Eiffel Software"
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
licensing_options: "http://www.eiffel.com/licensing"
copying: "[
This file is part of Eiffel Software's Eiffel Development Environment.
@@ -57,10 +55,11 @@ note
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
]"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -0,0 +1 @@
reference:forum2

View File

@@ -0,0 +1,5 @@
When your Eiffel executable running, Eiffel cURL library needs 3 DLLs, they are:
libcurl.dll, libeay32.dll and ssleay32.dll
Please make sure the 3 DLLs files can be found in your environment PATH or in same folder of your executable.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
#ifndef __CURL_CURLVER_H
#define __CURL_CURLVER_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
/* This header file contains nothing but libcurl version info, generated by
a script at release-time. This was made its own header file in 7.11.2 */
/* This is the version number of the libcurl package from which this header
file origins: */
#define LIBCURL_VERSION "7.17.0"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 17
#define LIBCURL_VERSION_PATCH 0
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
always follow this syntax:
0xXXYYZZ
Where XX, YY and ZZ are the main version, release and patch numbers in
hexadecimal (using 8 bits each). All three numbers are always represented
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
appears as "0x090b07".
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.
*/
#define LIBCURL_VERSION_NUM 0x071100
/*
* This is the date and time when the full source package was created. The
* timestamp is not stored in CVS, as the timestamp is properly set in the
* tarballs by the maketgz script.
*
* The format of the date should follow this template:
*
* "Mon Feb 12 11:35:33 UTC 2007"
*/
#define LIBCURL_TIMESTAMP "Thu Sep 13 20:22:24 UTC 2007"
#endif /* __CURL_CURLVER_H */

View File

@@ -0,0 +1,81 @@
#ifndef __CURL_EASY_H
#define __CURL_EASY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
CURL_EXTERN CURL *curl_easy_init(void);
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
/*
* NAME curl_easy_getinfo()
*
* DESCRIPTION
*
* Request internal information from the curl session with this function. The
* third argument MUST be a pointer to a long, a pointer to a char * or a
* pointer to a double (as the documentation describes elsewhere). The data
* pointed to will be filled in accordingly and can be relied upon only if the
* function returns CURLE_OK. This function is intended to get used *AFTER* a
* performed transfer, all results from this function are undefined until the
* transfer is completed.
*/
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
/*
* NAME curl_easy_duphandle()
*
* DESCRIPTION
*
* Creates a new curl session handle with the same options set for the handle
* passed in. Duplicating a handle could only be a matter of cloning data and
* options, internal state info and things like persistant connections cannot
* be transfered. It is useful in multithreaded applications when you can run
* curl_easy_duphandle() for each new thread to avoid a series of identical
* curl_easy_setopt() invokes in every thread.
*/
CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);
/*
* NAME curl_easy_reset()
*
* DESCRIPTION
*
* Re-initializes a CURL handle to the default values. This puts back the
* handle to the same state as it was in when it was just created.
*
* It does keep: live connections, the Session ID cache, the DNS cache and the
* cookies.
*/
CURL_EXTERN void curl_easy_reset(CURL *curl);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,80 @@
#ifndef __CURL_MPRINTF_H
#define __CURL_MPRINTF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
#include <stdarg.h>
#include <stdio.h> /* needed for FILE */
#include "curl.h"
#ifdef __cplusplus
extern "C" {
#endif
CURL_EXTERN int curl_mprintf(const char *format, ...);
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
CURL_EXTERN char *curl_maprintf(const char *format, ...);
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
#ifdef _MPRINTF_REPLACE
# undef printf
# undef fprintf
# undef sprintf
# undef vsprintf
# undef snprintf
# undef vprintf
# undef vfprintf
# undef vsnprintf
# undef aprintf
# undef vaprintf
# define printf curl_mprintf
# define fprintf curl_mfprintf
#ifdef CURLDEBUG
/* When built with CURLDEBUG we define away the sprintf() functions since we
don't want internal code to be using them */
# define sprintf sprintf_was_used
# define vsprintf vsprintf_was_used
#else
# define sprintf curl_msprintf
# define vsprintf curl_mvsprintf
#endif
# define snprintf curl_msnprintf
# define vprintf curl_mvprintf
# define vfprintf curl_mvfprintf
# define vsnprintf curl_mvsnprintf
# define aprintf curl_maprintf
# define vaprintf curl_mvaprintf
#endif
#ifdef __cplusplus
}
#endif
#endif /* __CURL_MPRINTF_H */

View File

@@ -0,0 +1,346 @@
#ifndef __CURL_MULTI_H
#define __CURL_MULTI_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
/*
This is an "external" header file. Don't give away any internals here!
GOALS
o Enable a "pull" interface. The application that uses libcurl decides where
and when to ask libcurl to get/send data.
o Enable multiple simultaneous transfers in the same thread without making it
complicated for the application.
o Enable the application to select() on its own file descriptors and curl's
file descriptors simultaneous easily.
*/
/*
* This header file should not really need to include "curl.h" since curl.h
* itself includes this file and we expect user applications to do #include
* <curl/curl.h> without the need for especially including multi.h.
*
* For some reason we added this include here at one point, and rather than to
* break existing (wrongly written) libcurl applications, we leave it as-is
* but with this warning attached.
*/
#include "curl.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void CURLM;
typedef enum {
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
curl_multi_socket*() soon */
CURLM_OK,
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
CURLM_LAST
} CURLMcode;
/* just to make code nicer when using curl_multi_socket() you can now check
for CURLM_CALL_MULTI_SOCKET too in the same style it works for
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
typedef enum {
CURLMSG_NONE, /* first, not used */
CURLMSG_DONE, /* This easy handle has completed. 'result' contains
the CURLcode of the transfer */
CURLMSG_LAST /* last, not used */
} CURLMSG;
struct CURLMsg {
CURLMSG msg; /* what this message means */
CURL *easy_handle; /* the handle it concerns */
union {
void *whatever; /* message-specific data */
CURLcode result; /* return code for transfer */
} data;
};
typedef struct CURLMsg CURLMsg;
/*
* Name: curl_multi_init()
*
* Desc: inititalize multi-style curl usage
*
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
*/
CURL_EXTERN CURLM *curl_multi_init(void);
/*
* Name: curl_multi_add_handle()
*
* Desc: add a standard curl handle to the multi stack
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
CURL *curl_handle);
/*
* Name: curl_multi_remove_handle()
*
* Desc: removes a curl handle from the multi stack again
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
CURL *curl_handle);
/*
* Name: curl_multi_fdset()
*
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
* poll() on. We want curl_multi_perform() called as soon as one of
* them are ready.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
fd_set *read_fd_set,
fd_set *write_fd_set,
fd_set *exc_fd_set,
int *max_fd);
/*
* Name: curl_multi_perform()
*
* Desc: When the app thinks there's data available for curl it calls this
* function to read/write whatever there is right now. This returns
* as soon as the reads and writes are done. This function does not
* require that there actually is data available for reading or that
* data can be written, it can be called just in case. It returns
* the number of handles that still transfer data in the second
* argument's integer-pointer.
*
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
* returns errors etc regarding the whole multi stack. There might
* still have occurred problems on invidual transfers even when this
* returns OK.
*/
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
int *running_handles);
/*
* Name: curl_multi_cleanup()
*
* Desc: Cleans up and removes a whole multi stack. It does not free or
* touch any individual easy handles in any way. We need to define
* in what state those handles will be if this function is called
* in the middle of a transfer.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
/*
* Name: curl_multi_info_read()
*
* Desc: Ask the multi handle if there's any messages/informationals from
* the individual transfers. Messages include informationals such as
* error code from the transfer or just the fact that a transfer is
* completed. More details on these should be written down as well.
*
* Repeated calls to this function will return a new struct each
* time, until a special "end of msgs" struct is returned as a signal
* that there is no more to get at this point.
*
* The data the returned pointer points to will not survive calling
* curl_multi_cleanup().
*
* The 'CURLMsg' struct is meant to be very simple and only contain
* very basic informations. If more involved information is wanted,
* we will provide the particular "transfer handle" in that struct
* and that should/could/would be used in subsequent
* curl_easy_getinfo() calls (or similar). The point being that we
* must never expose complex structs to applications, as then we'll
* undoubtably get backwards compatibility problems in the future.
*
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
* of structs. It also writes the number of messages left in the
* queue (after this read) in the integer the second argument points
* to.
*/
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
int *msgs_in_queue);
/*
* Name: curl_multi_strerror()
*
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
* value into the equivalent human readable error string. This is
* useful for printing meaningful error messages.
*
* Returns: A pointer to a zero-terminated error message.
*/
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
/*
* Name: curl_multi_socket() and
* curl_multi_socket_all()
*
* Desc: An alternative version of curl_multi_perform() that allows the
* application to pass in one of the file descriptors that have been
* detected to have "action" on them and let libcurl perform.
* See man page for details.
*/
#define CURL_POLL_NONE 0
#define CURL_POLL_IN 1
#define CURL_POLL_OUT 2
#define CURL_POLL_INOUT 3
#define CURL_POLL_REMOVE 4
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
#define CURL_CSELECT_IN 0x01
#define CURL_CSELECT_OUT 0x02
#define CURL_CSELECT_ERR 0x04
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
int what, /* see above */
void *userp, /* private callback
pointer */
void *socketp); /* private socket
pointer */
/*
* Name: curl_multi_timer_callback
*
* Desc: Called by libcurl whenever the library detects a change in the
* maximum number of milliseconds the app is allowed to wait before
* curl_multi_socket() or curl_multi_perform() must be called
* (to allow libcurl's timed events to take place).
*
* Returns: The callback should return zero.
*/
typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
long timeout_ms, /* see above */
void *userp); /* private callback
pointer */
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
int *running_handles);
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
curl_socket_t s,
int ev_bitmask,
int *running_handles);
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
int *running_handles);
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
/* This macro below was added in 7.16.3 to push users who recompile to use
the new curl_multi_socket_action() instead of the old curl_multi_socket()
*/
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
#endif
/*
* Name: curl_multi_timeout()
*
* Desc: Returns the maximum number of milliseconds the app is allowed to
* wait before curl_multi_socket() or curl_multi_perform() must be
* called (to allow libcurl's timed events to take place).
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
long *milliseconds);
#undef CINIT /* re-using the same name as in curl.h */
#ifdef CURL_ISOCPP
#define CINIT(name,type,number) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + number
#else
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
#define LONG CURLOPTTYPE_LONG
#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
#define OFF_T CURLOPTTYPE_OFF_T
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
#endif
typedef enum {
/* This is the socket callback function pointer */
CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
/* This is the argument passed to the socket callback */
CINIT(SOCKETDATA, OBJECTPOINT, 2),
/* set to 1 to enable pipelining for this multi handle */
CINIT(PIPELINING, LONG, 3),
/* This is the timer callback function pointer */
CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
/* This is the argument passed to the timer callback */
CINIT(TIMERDATA, OBJECTPOINT, 5),
/* maximum number of entries in the connection cache */
CINIT(MAXCONNECTS, LONG, 6),
CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption;
/*
* Name: curl_multi_setopt()
*
* Desc: Sets options for the multi handle.
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
CURLMoption option, ...);
/*
* Name: curl_multi_assign()
*
* Desc: This function sets an association in the multi handle between the
* given socket and a private pointer of the application. This is
* (only) useful for curl_multi_socket uses.
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
curl_socket_t sockfd, void *sockp);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif

View File

@@ -0,0 +1,34 @@
#ifndef __STDC_HEADERS_H
#define __STDC_HEADERS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
***************************************************************************/
#include <sys/types.h>
size_t fread (void *, size_t, size_t, FILE *);
size_t fwrite (const void *, size_t, size_t, FILE *);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
#endif

View File

@@ -0,0 +1 @@
/* not used */

View File

@@ -0,0 +1,47 @@
/*
indexing
description: "Functions used by the class CURL_FUNCTION."
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
*/
#ifndef _eiffel_curl_h_
#define _eiffel_curl_h_
#include "eif_eiffel.h"
/* unix-specific */
#ifndef EIF_WINDOWS
#include <sys/time.h>
#include <unistd.h>
#endif
#include <curl/curl.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void c_set_object(EIF_REFERENCE a_address);
extern void c_release_object(void);
extern void c_set_progress_function_address( EIF_POINTER a_address);
extern void c_set_read_function_address( EIF_POINTER a_address);
extern void c_set_write_function_address( EIF_POINTER a_address);
extern void c_set_debug_function_address (EIF_POINTER a_address);
extern size_t curl_write_function (void *ptr, size_t size, size_t nmemb, void *data);
extern size_t curl_read_function (void *ptr, size_t size, size_t nmemb, void *data);
extern size_t curl_progress_function (void * a_object_id, double a_dltotal, double a_dlnow, double a_ultotal, double a_ulnow);
extern size_t curl_debug_function (CURL * a_curl_handle, curl_infotype a_curl_infotype, unsigned char * a_char_pointer, size_t a_size, void * a_object_id);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,44 +1,44 @@
note
description : "nino application root class"
date : "$Date$"
revision : "$Revision$"
class
APPLICATION
inherit
ARGUMENTS
HTTP_SERVER_SHARED_CONFIGURATION
create
make
feature {NONE} -- Initialization
make
-- Run application.
local
l_server : HTTP_SERVER
l_cfg: HTTP_SERVER_CONFIGURATION
l_http_handler : HTTP_HANDLER
do
create l_cfg.make
l_cfg.http_server_port := 9_000
l_cfg.document_root := default_document_root
set_server_configuration (l_cfg)
debug ("nino")
l_cfg.set_is_verbose (True)
end
create l_server.make (l_cfg)
create {APPLICATION_CONNECTION_HANDLER} l_http_handler.make (l_server)
l_server.setup (l_http_handler)
end
feature -- Access
default_document_root: STRING = "webroot"
end
note
description : "nino application root class"
date : "$Date$"
revision : "$Revision$"
class
APPLICATION
inherit
ARGUMENTS
HTTP_SERVER_SHARED_CONFIGURATION
create
make
feature {NONE} -- Initialization
make
-- Run application.
local
l_server : HTTP_SERVER
l_cfg: HTTP_SERVER_CONFIGURATION
l_http_handler : HTTP_HANDLER
do
create l_cfg.make
l_cfg.http_server_port := 9_000
l_cfg.document_root := default_document_root
set_server_configuration (l_cfg)
debug ("nino")
l_cfg.set_is_verbose (True)
end
create l_server.make (l_cfg)
create {APPLICATION_CONNECTION_HANDLER} l_http_handler.make (l_server)
l_server.setup (l_http_handler)
end
feature -- Access
default_document_root: STRING = "webroot"
end

View File

@@ -1,115 +1,115 @@
note
description: "Summary description for {HEAD_REQUEST_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
HEAD_REQUEST_HANDLER
inherit
SHARED_DOCUMENT_ROOT
SHARED_URI_CONTENTS_TYPES
HTTP_REQUEST_HANDLER
HTTP_CONSTANTS
feature
process
-- process the request and create an answer
local
fname: STRING
f: RAW_FILE
ctype, extension: STRING
do
fname := document_root_cell.item.twin
fname.append (request_uri)
debug
print ("URI name: " + fname )
end
create f.make (fname)
create answer.make
if f.exists then
extension := ct_table.extension (request_uri)
ctype := ct_table.content_types.item (extension)
-- TODO: This code could be improved to avoid string
-- comparisons
if ctype = Void then
process_default
answer.set_content_type ("text/html")
else
if ctype.is_equal ("text/html") then
process_text_file (f)
else
process_raw_file (f)
end
answer.set_content_type (ctype)
end
else
answer.set_status_code (not_found)
answer.set_reason_phrase (not_found_message)
answer.set_reply_text ("Not found on this server%N%R")
end
end
process_default
--
local
html : STRING
do
answer.set_reply_text ("")
html := " <html> <head> <title> Micro HTTPD </title> " +
" </head> " +
" <body> " +
" <h1> Welcome to Micro HTTPD! </h1> "+
" <p> Default page " +
" </p> " +
" </body> " +
" </html> "
answer.append_reply_text (html)
end
process_text_file (f: FILE)
-- send a text file reply
require
valid_f: f /= Void
do
f.open_read
from
answer.set_reply_text ("")
f.read_line
until f.end_of_file
loop
answer.append_reply_text (f.last_string)
answer.append_reply_text (crlf)
f.read_line
end
f.close
end
process_raw_file (f: FILE)
-- send a raw file reply
require
valid_f: f /= Void
do
-- this is not quite right....
f.open_read
from
answer.set_reply_text ("")
until f.end_of_file
loop
f.read_stream (1024)
answer.append_reply_text (f.last_string)
end
f.close
end
end
note
description: "Summary description for {HEAD_REQUEST_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
HEAD_REQUEST_HANDLER
inherit
SHARED_DOCUMENT_ROOT
SHARED_URI_CONTENTS_TYPES
HTTP_REQUEST_HANDLER
HTTP_CONSTANTS
feature
process
-- process the request and create an answer
local
fname: STRING
f: RAW_FILE
ctype, extension: STRING
do
fname := document_root_cell.item.twin
fname.append (request_uri)
debug
print ("URI name: " + fname )
end
create f.make (fname)
create answer.make
if f.exists then
extension := ct_table.extension (request_uri)
ctype := ct_table.content_types.item (extension)
-- TODO: This code could be improved to avoid string
-- comparisons
if ctype = Void then
process_default
answer.set_content_type ("text/html")
else
if ctype.is_equal ("text/html") then
process_text_file (f)
else
process_raw_file (f)
end
answer.set_content_type (ctype)
end
else
answer.set_status_code (not_found)
answer.set_reason_phrase (not_found_message)
answer.set_reply_text ("Not found on this server%N%R")
end
end
process_default
--
local
html : STRING
do
answer.set_reply_text ("")
html := " <html> <head> <title> Micro HTTPD </title> " +
" </head> " +
" <body> " +
" <h1> Welcome to Micro HTTPD! </h1> "+
" <p> Default page " +
" </p> " +
" </body> " +
" </html> "
answer.append_reply_text (html)
end
process_text_file (f: FILE)
-- send a text file reply
require
valid_f: f /= Void
do
f.open_read
from
answer.set_reply_text ("")
f.read_line
until f.end_of_file
loop
answer.append_reply_text (f.last_string)
answer.append_reply_text (crlf)
f.read_line
end
f.close
end
process_raw_file (f: FILE)
-- send a raw file reply
require
valid_f: f /= Void
do
-- this is not quite right....
f.open_read
from
answer.set_reply_text ("")
until f.end_of_file
loop
f.read_stream (1024)
answer.append_reply_text (f.last_string)
end
f.close
end
end

View File

@@ -1,53 +1,53 @@
note
description: "Summary description for {POST_REQUEST_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
POST_REQUEST_HANDLER
inherit
GET_REQUEST_HANDLER
redefine
process
end
create
make
feature -- Execution
process
-- process the request and create an answer
local
l_data: STRING
s: detachable STRING
n: INTEGER
sock: like socket
do
from
n := 1_024
sock := socket
if sock.socket_ok then
sock.read_stream_thread_aware (n)
s := sock.last_string
else
s := Void
end
create l_data.make_empty
until
s = Void or else s.count < n
loop
l_data.append_string (s)
if sock.socket_ok then
sock.read_stream_thread_aware (n)
s := sock.last_string
else
s := Void
end
end
Precursor
end
end
note
description: "Summary description for {POST_REQUEST_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
POST_REQUEST_HANDLER
inherit
GET_REQUEST_HANDLER
redefine
process
end
create
make
feature -- Execution
process
-- process the request and create an answer
local
l_data: STRING
s: detachable STRING
n: INTEGER
sock: like socket
do
from
n := 1_024
sock := socket
if sock.socket_ok then
sock.read_stream_thread_aware (n)
s := sock.last_string
else
s := Void
end
create l_data.make_empty
until
s = Void or else s.count < n
loop
l_data.append_string (s)
if sock.socket_ok then
sock.read_stream_thread_aware (n)
s := sock.last_string
else
s := Void
end
end
Precursor
end
end

View File

@@ -1,91 +1,91 @@
1.4.2
[Feature]
- The plugin support percentages as target ('50%' or {top:'50%', left:'45%'})
- Exposed the max() calculation as $.scrollTo.max
[Enhancement]
- Renamed $.fn.scrollable to $.fn._scrollable to avoid conflicts with other plugins
[Fix]
- Fixing max calculations for regular DOM elements
1.4.1
[Feature]
- The target can be 'max' to scroll to the end while keeping it elegant.
[Enhancement]
- Default duration is 0 for jquery +1.3. Means sync animation
- The plugin works on all major browsers, on compat & quirks modes, including iframes.
- In addition to window/document, if html or body are received, the plugin will choose the right one.
[Fix]
- The plugin accepts floating numbers, Thanks Ramin
- Using jQuery.nodeName where neccessary so that this works on xml+xhtml
- The max() internal function wasn't completely accurrate, now it is 98% (except for IE on quirks mode and it's not too noticeable).
1.4
[Fix]
- Fixed the problem when scrolling the window to absolute positioned elements on Safari.
- Fixed the problem on Opera 9.5 when scrolling the window. That it always scrolls to 0.
[Feature]
- Added the settings object as 2nd argument to the onAfter callback.
- The 3rd argument of scrollTo can be just a function and it's used as the onAfter.
- Added full support for iframes (even max scroll calculation).
- Instead of $.scrollTo, $(window).scrollTo() and $(document).scrollTo() can be used.
- Added $().scrollable() that returns the real element to scroll, f.e: $(window).scrollable() == [body|html], works for iframes.
[Enhancement]
- Cleaned the code a bit, specially the comments
1.3.3
[Change]
- Changed the licensing from GPL to GPL+MIT.
1.3.2
[Enhancement]
- Small improvements to make the code shorter.
[Change]
- Removed the last argument received by onAfter as it was the same as the 'this' but jqueryfied.
1.3.1
[Feature]
- Exposed $.scrollTo.window() to get the element that needs to be animated, to scroll the window.
- Added option 'over'.
[Enhancement]
- Made the code as short as possible.
[Change]
- Changed the arguments received by onAfter
1.3
[Enhancement]
- Added semicolon to the start, for safe file concatenation
- Added a limit check, values below 0 or over the maximum are fixed.
- Now it should work faster, only one of html or body go through all the processing, instead of both for all browsers.
[Fix]
- Fixed the behavior for Opera, which seemed to react to both changes on <html> and <body>.
- The border is also reduced, when 'margin' is set to true.
[Change]
- The option speed has been renamed to duration.
[Feature]
- The duration can be specified with a number as 2nd argument, and the rest of the settings as the third ( like $().animate )
- Remade the demo
1.2.4
[Enhancement]
- The target can be in the form of { top:x, left:y } allowing different position for each axis.
[Feature]
- The option 'offset' has been added, to scroll behind or past the target. Can be a number(both axes) or { top:x, left:y }.
1.2.3
[Feature]
- Exposed the defaults.
[Enhancement]
- Made the callback functions receive more parameters.
1.2.2
[Fix]
- Fixed a bug, I didn't have to add the scrolled amount if it was body or html.
1.2
[Change]
- The option 'onafter' is now called 'onAfter'.
[Feature]
- Two axes can be scrolled together, this is set with the option 'axis'.
- In case 2 axes are chosen, the scrolling can be queued: one scrolls, and then the other.
- There's an intermediary event, 'onAfterFirst' called in case the axes are queued, after the first ends.
1.4.2
[Feature]
- The plugin support percentages as target ('50%' or {top:'50%', left:'45%'})
- Exposed the max() calculation as $.scrollTo.max
[Enhancement]
- Renamed $.fn.scrollable to $.fn._scrollable to avoid conflicts with other plugins
[Fix]
- Fixing max calculations for regular DOM elements
1.4.1
[Feature]
- The target can be 'max' to scroll to the end while keeping it elegant.
[Enhancement]
- Default duration is 0 for jquery +1.3. Means sync animation
- The plugin works on all major browsers, on compat & quirks modes, including iframes.
- In addition to window/document, if html or body are received, the plugin will choose the right one.
[Fix]
- The plugin accepts floating numbers, Thanks Ramin
- Using jQuery.nodeName where neccessary so that this works on xml+xhtml
- The max() internal function wasn't completely accurrate, now it is 98% (except for IE on quirks mode and it's not too noticeable).
1.4
[Fix]
- Fixed the problem when scrolling the window to absolute positioned elements on Safari.
- Fixed the problem on Opera 9.5 when scrolling the window. That it always scrolls to 0.
[Feature]
- Added the settings object as 2nd argument to the onAfter callback.
- The 3rd argument of scrollTo can be just a function and it's used as the onAfter.
- Added full support for iframes (even max scroll calculation).
- Instead of $.scrollTo, $(window).scrollTo() and $(document).scrollTo() can be used.
- Added $().scrollable() that returns the real element to scroll, f.e: $(window).scrollable() == [body|html], works for iframes.
[Enhancement]
- Cleaned the code a bit, specially the comments
1.3.3
[Change]
- Changed the licensing from GPL to GPL+MIT.
1.3.2
[Enhancement]
- Small improvements to make the code shorter.
[Change]
- Removed the last argument received by onAfter as it was the same as the 'this' but jqueryfied.
1.3.1
[Feature]
- Exposed $.scrollTo.window() to get the element that needs to be animated, to scroll the window.
- Added option 'over'.
[Enhancement]
- Made the code as short as possible.
[Change]
- Changed the arguments received by onAfter
1.3
[Enhancement]
- Added semicolon to the start, for safe file concatenation
- Added a limit check, values below 0 or over the maximum are fixed.
- Now it should work faster, only one of html or body go through all the processing, instead of both for all browsers.
[Fix]
- Fixed the behavior for Opera, which seemed to react to both changes on <html> and <body>.
- The border is also reduced, when 'margin' is set to true.
[Change]
- The option speed has been renamed to duration.
[Feature]
- The duration can be specified with a number as 2nd argument, and the rest of the settings as the third ( like $().animate )
- Remade the demo
1.2.4
[Enhancement]
- The target can be in the form of { top:x, left:y } allowing different position for each axis.
[Feature]
- The option 'offset' has been added, to scroll behind or past the target. Can be a number(both axes) or { top:x, left:y }.
1.2.3
[Feature]
- Exposed the defaults.
[Enhancement]
- Made the callback functions receive more parameters.
1.2.2
[Fix]
- Fixed a bug, I didn't have to add the scrolled amount if it was body or html.
1.2
[Change]
- The option 'onafter' is now called 'onAfter'.
[Feature]
- Two axes can be scrolled together, this is set with the option 'axis'.
- In case 2 axes are chosen, the scrolling can be queued: one scrolls, and then the other.
- There's an intermediary event, 'onAfterFirst' called in case the axes are queued, after the first ends.
- If the option 'margin' is set to true, the plugin will take in account, the margin of the target(no use if target is a value).

View File

@@ -1,11 +1,11 @@
/**
* jQuery.ScrollTo - Easy element scrolling using jQuery.
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 5/25/2009
* @author Ariel Flesler
* @version 1.4.2
*
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
*/
/**
* jQuery.ScrollTo - Easy element scrolling using jQuery.
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 5/25/2009
* @author Ariel Flesler
* @version 1.4.2
*
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
*/
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

View File

@@ -1,215 +1,215 @@
/**
* jQuery.ScrollTo
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 5/25/2009
*
* @projectDescription Easy element scrolling using jQuery.
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
*
* @author Ariel Flesler
* @version 1.4.2
*
* @id jQuery.scrollTo
* @id jQuery.fn.scrollTo
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
* The different options for target are:
* - A number position (will be applied to all axes).
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
* - A jQuery/DOM element ( logically, child of the element to scroll )
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
* - The string 'max' for go-to-end.
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
* @param {Object,Function} settings Optional set of settings or the onAfter callback.
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
* @option {Number} duration The OVERALL length of the animation.
* @option {String} easing The easing method for the animation.
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
* @option {Function} onAfter Function to be called after the scrolling ends.
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
* @return {jQuery} Returns the same jQuery object, for chaining.
*
* @desc Scroll to a fixed position
* @example $('div').scrollTo( 340 );
*
* @desc Scroll relatively to the actual position
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
*
* @dec Scroll using a selector (relative to the scrolled element)
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
*
* @ Scroll to a DOM element (same for jQuery object)
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
* alert('scrolled!!');
* }});
*
* @desc Scroll on both axes, to different values
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
*/
;(function( $ ){
var $scrollTo = $.scrollTo = function( target, duration, settings ){
$(window).scrollTo( target, duration, settings );
};
$scrollTo.defaults = {
axis:'xy',
duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
};
// Returns the element that needs to be animated to scroll the window.
// Kept for backwards compatibility (specially for localScroll & serialScroll)
$scrollTo.window = function( scope ){
return $(window)._scrollable();
};
// Hack, hack, hack :)
// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
$.fn._scrollable = function(){
return this.map(function(){
var elem = this,
isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
if( !isWin )
return elem;
var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
return $.browser.safari || doc.compatMode == 'BackCompat' ?
doc.body :
doc.documentElement;
});
};
$.fn.scrollTo = function( target, duration, settings ){
if( typeof duration == 'object' ){
settings = duration;
duration = 0;
}
if( typeof settings == 'function' )
settings = { onAfter:settings };
if( target == 'max' )
target = 9e9;
settings = $.extend( {}, $scrollTo.defaults, settings );
// Speed is still recognized for backwards compatibility
duration = duration || settings.speed || settings.duration;
// Make sure the settings are given right
settings.queue = settings.queue && settings.axis.length > 1;
if( settings.queue )
// Let's keep the overall duration
duration /= 2;
settings.offset = both( settings.offset );
settings.over = both( settings.over );
return this._scrollable().each(function(){
var elem = this,
$elem = $(elem),
targ = target, toff, attr = {},
win = $elem.is('html,body');
switch( typeof targ ){
// A number will pass the regex
case 'number':
case 'string':
if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
targ = both( targ );
// We are done
break;
}
// Relative selector, no break!
targ = $(targ,this);
case 'object':
// DOMElement / jQuery
if( targ.is || targ.style )
// Get the real position of the target
toff = (targ = $(targ)).offset();
}
$.each( settings.axis.split(''), function( i, axis ){
var Pos = axis == 'x' ? 'Left' : 'Top',
pos = Pos.toLowerCase(),
key = 'scroll' + Pos,
old = elem[key],
max = $scrollTo.max(elem, axis);
if( toff ){// jQuery / DOMElement
attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
// If it's a dom element, reduce the margin
if( settings.margin ){
attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
}
attr[key] += settings.offset[pos] || 0;
if( settings.over[pos] )
// Scroll to a fraction of its width/height
attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
}else{
var val = targ[pos];
// Handle percentage values
attr[key] = val.slice && val.slice(-1) == '%' ?
parseFloat(val) / 100 * max
: val;
}
// Number or 'number'
if( /^\d+$/.test(attr[key]) )
// Check the limits
attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
// Queueing axes
if( !i && settings.queue ){
// Don't waste time animating, if there's no need.
if( old != attr[key] )
// Intermediate animation
animate( settings.onAfterFirst );
// Don't animate this axis again in the next iteration.
delete attr[key];
}
});
animate( settings.onAfter );
function animate( callback ){
$elem.animate( attr, duration, settings.easing, callback && function(){
callback.call(this, target, settings);
});
};
}).end();
};
// Max scrolling position, works on quirks mode
// It only fails (not too badly) on IE, quirks mode.
$scrollTo.max = function( elem, axis ){
var Dim = axis == 'x' ? 'Width' : 'Height',
scroll = 'scroll'+Dim;
if( !$(elem).is('html,body') )
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
var size = 'client' + Dim,
html = elem.ownerDocument.documentElement,
body = elem.ownerDocument.body;
return Math.max( html[scroll], body[scroll] )
- Math.min( html[size] , body[size] );
};
function both( val ){
return typeof val == 'object' ? val : { top:val, left:val };
};
/**
* jQuery.ScrollTo
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 5/25/2009
*
* @projectDescription Easy element scrolling using jQuery.
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
*
* @author Ariel Flesler
* @version 1.4.2
*
* @id jQuery.scrollTo
* @id jQuery.fn.scrollTo
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
* The different options for target are:
* - A number position (will be applied to all axes).
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
* - A jQuery/DOM element ( logically, child of the element to scroll )
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
* - The string 'max' for go-to-end.
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
* @param {Object,Function} settings Optional set of settings or the onAfter callback.
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
* @option {Number} duration The OVERALL length of the animation.
* @option {String} easing The easing method for the animation.
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
* @option {Function} onAfter Function to be called after the scrolling ends.
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
* @return {jQuery} Returns the same jQuery object, for chaining.
*
* @desc Scroll to a fixed position
* @example $('div').scrollTo( 340 );
*
* @desc Scroll relatively to the actual position
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
*
* @dec Scroll using a selector (relative to the scrolled element)
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
*
* @ Scroll to a DOM element (same for jQuery object)
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
* alert('scrolled!!');
* }});
*
* @desc Scroll on both axes, to different values
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
*/
;(function( $ ){
var $scrollTo = $.scrollTo = function( target, duration, settings ){
$(window).scrollTo( target, duration, settings );
};
$scrollTo.defaults = {
axis:'xy',
duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
};
// Returns the element that needs to be animated to scroll the window.
// Kept for backwards compatibility (specially for localScroll & serialScroll)
$scrollTo.window = function( scope ){
return $(window)._scrollable();
};
// Hack, hack, hack :)
// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
$.fn._scrollable = function(){
return this.map(function(){
var elem = this,
isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
if( !isWin )
return elem;
var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
return $.browser.safari || doc.compatMode == 'BackCompat' ?
doc.body :
doc.documentElement;
});
};
$.fn.scrollTo = function( target, duration, settings ){
if( typeof duration == 'object' ){
settings = duration;
duration = 0;
}
if( typeof settings == 'function' )
settings = { onAfter:settings };
if( target == 'max' )
target = 9e9;
settings = $.extend( {}, $scrollTo.defaults, settings );
// Speed is still recognized for backwards compatibility
duration = duration || settings.speed || settings.duration;
// Make sure the settings are given right
settings.queue = settings.queue && settings.axis.length > 1;
if( settings.queue )
// Let's keep the overall duration
duration /= 2;
settings.offset = both( settings.offset );
settings.over = both( settings.over );
return this._scrollable().each(function(){
var elem = this,
$elem = $(elem),
targ = target, toff, attr = {},
win = $elem.is('html,body');
switch( typeof targ ){
// A number will pass the regex
case 'number':
case 'string':
if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
targ = both( targ );
// We are done
break;
}
// Relative selector, no break!
targ = $(targ,this);
case 'object':
// DOMElement / jQuery
if( targ.is || targ.style )
// Get the real position of the target
toff = (targ = $(targ)).offset();
}
$.each( settings.axis.split(''), function( i, axis ){
var Pos = axis == 'x' ? 'Left' : 'Top',
pos = Pos.toLowerCase(),
key = 'scroll' + Pos,
old = elem[key],
max = $scrollTo.max(elem, axis);
if( toff ){// jQuery / DOMElement
attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
// If it's a dom element, reduce the margin
if( settings.margin ){
attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
}
attr[key] += settings.offset[pos] || 0;
if( settings.over[pos] )
// Scroll to a fraction of its width/height
attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
}else{
var val = targ[pos];
// Handle percentage values
attr[key] = val.slice && val.slice(-1) == '%' ?
parseFloat(val) / 100 * max
: val;
}
// Number or 'number'
if( /^\d+$/.test(attr[key]) )
// Check the limits
attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
// Queueing axes
if( !i && settings.queue ){
// Don't waste time animating, if there's no need.
if( old != attr[key] )
// Intermediate animation
animate( settings.onAfterFirst );
// Don't animate this axis again in the next iteration.
delete attr[key];
}
});
animate( settings.onAfter );
function animate( callback ){
$elem.animate( attr, duration, settings.easing, callback && function(){
callback.call(this, target, settings);
});
};
}).end();
};
// Max scrolling position, works on quirks mode
// It only fails (not too badly) on IE, quirks mode.
$scrollTo.max = function( elem, axis ){
var Dim = axis == 'x' ? 'Width' : 'Height',
scroll = 'scroll'+Dim;
if( !$(elem).is('html,body') )
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
var size = 'client' + Dim,
html = elem.ownerDocument.documentElement,
body = elem.ownerDocument.body;
return Math.max( html[scroll], body[scroll] )
- Math.min( html[size] , body[size] );
};
function both( val ){
return typeof val == 'object' ? val : { top:val, left:val };
};
})( jQuery );

View File

@@ -1,12 +1,12 @@
$(document).ready(function(){
/* This code is executed after the DOM has been completely loaded */
$('nav a,footer a.up').click(function(e){
// If a link has been clicked, scroll the page to the link's hash target:
$.scrollTo( this.hash || 0, 1500);
e.preventDefault();
});
$(document).ready(function(){
/* This code is executed after the DOM has been completely loaded */
$('nav a,footer a.up').click(function(e){
// If a link has been clicked, scroll the page to the link's hash target:
$.scrollTo( this.hash || 0, 1500);
e.preventDefault();
});
});

View File

@@ -1,219 +1,219 @@
*{
/* Universal reset: */
margin:0;
padding:0;
}
header,footer,
article,section,
hgroup,nav,
figure{
/* Giving a display value to the HTML5 rendered elements: */
display:block;
}
body{
/* Setting the default text color, size, page background and a font stack: */
font-size:0.825em;
color:#fcfcfc;
background-color:#355664;
font-family:Arial, Helvetica, sans-serif;
}
/* Hyperlink Styles: */
a, a:visited {
color:#0196e3;
text-decoration:none;
outline:none;
}
a:hover{
text-decoration:underline;
}
a img{
border:none;
}
/* Headings: */
h1,h2,h3{
font-family:"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
text-shadow:0 1px 1px black;
}
h1{
/* The logo text */
font-size:3.5em;
padding:0.5em 0 0;
text-transform:uppercase;
}
h3{
/* The slogan text */
font-family:forte,"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
font-size:2em;
font-weight:normal;
margin:0 0 1em;
}
h2{
font-size:2.2em;
font-weight:normal;
letter-spacing:0.01em;
text-transform:uppercase;
}
p{
line-height:1.5em;
padding-bottom:1em;
}
.line{
/* The dividing line: */
height:1px;
background-color:#24404c;
border-bottom:1px solid #416371;
margin:1em 0;
overflow:hidden;
}
article .line{
/* The dividing line inside of the article is darker: */
background-color:#15242a;
border-bottom-color:#204656;
margin:1.3em 0;
}
footer .line{
margin:2em 0;
}
nav{
background:url(img/gradient_light.jpg) repeat-x 50% 50% #f8f8f8;
padding:0 5px;
position:absolute;
right:0;
top:4em;
border:1px solid #FCFCFC;
-moz-box-shadow:0 1px 1px #333333;
-webkit-box-shadow:0 1px 1px #333333;
box-shadow:0 1px 1px #333333;
}
/* The clearfix hack to clear the floats: */
.clear:after{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* The navigation styling: */
nav ul li{
display:inline;
}
nav ul li a,
nav ul li a:visited{
color:#565656;
display:block;
float:left;
font-size:1.25em;
font-weight:bold;
margin:5px 2px;
padding:7px 10px 4px;
text-shadow:0 1px 1px white;
text-transform:uppercase;
}
nav ul li a:hover{
text-decoration:none;
background-color:#f0f0f0;
}
nav, article, nav ul li a,figure{
/* Applying CSS3 rounded corners: */
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
}
/* Article styles: */
#page{
width:960px;
margin:0 auto;
position:relative;
}
article{
background-color:#213E4A;
margin:3em 0;
padding:20px;
text-shadow:0 2px 0 black;
}
figure{
border:3px solid #142830;
float:right;
height:300px;
margin-left:15px;
overflow:hidden;
width:500px;
}
figure:hover{
-moz-box-shadow:0 0 2px #4D7788;
-webkit-box-shadow:0 0 2px #4D7788;
box-shadow:0 0 2px #4D7788;
}
figure img{
margin-left:-60px;
}
/* Footer styling: */
footer{
margin-bottom:30px;
text-align:center;
font-size:0.825em;
}
footer p{
margin-bottom:-2.5em;
position:relative;
}
footer a,footer a:visited{
color:#cccccc;
background-color:#213e4a;
display:block;
padding:2px 4px;
z-index:100;
position:relative;
}
footer a:hover{
text-decoration:none;
background-color:#142830;
}
footer a.by{
float:left;
}
footer a.up{
float:right;
}
*{
/* Universal reset: */
margin:0;
padding:0;
}
header,footer,
article,section,
hgroup,nav,
figure{
/* Giving a display value to the HTML5 rendered elements: */
display:block;
}
body{
/* Setting the default text color, size, page background and a font stack: */
font-size:0.825em;
color:#fcfcfc;
background-color:#355664;
font-family:Arial, Helvetica, sans-serif;
}
/* Hyperlink Styles: */
a, a:visited {
color:#0196e3;
text-decoration:none;
outline:none;
}
a:hover{
text-decoration:underline;
}
a img{
border:none;
}
/* Headings: */
h1,h2,h3{
font-family:"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
text-shadow:0 1px 1px black;
}
h1{
/* The logo text */
font-size:3.5em;
padding:0.5em 0 0;
text-transform:uppercase;
}
h3{
/* The slogan text */
font-family:forte,"Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
font-size:2em;
font-weight:normal;
margin:0 0 1em;
}
h2{
font-size:2.2em;
font-weight:normal;
letter-spacing:0.01em;
text-transform:uppercase;
}
p{
line-height:1.5em;
padding-bottom:1em;
}
.line{
/* The dividing line: */
height:1px;
background-color:#24404c;
border-bottom:1px solid #416371;
margin:1em 0;
overflow:hidden;
}
article .line{
/* The dividing line inside of the article is darker: */
background-color:#15242a;
border-bottom-color:#204656;
margin:1.3em 0;
}
footer .line{
margin:2em 0;
}
nav{
background:url(img/gradient_light.jpg) repeat-x 50% 50% #f8f8f8;
padding:0 5px;
position:absolute;
right:0;
top:4em;
border:1px solid #FCFCFC;
-moz-box-shadow:0 1px 1px #333333;
-webkit-box-shadow:0 1px 1px #333333;
box-shadow:0 1px 1px #333333;
}
/* The clearfix hack to clear the floats: */
.clear:after{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* The navigation styling: */
nav ul li{
display:inline;
}
nav ul li a,
nav ul li a:visited{
color:#565656;
display:block;
float:left;
font-size:1.25em;
font-weight:bold;
margin:5px 2px;
padding:7px 10px 4px;
text-shadow:0 1px 1px white;
text-transform:uppercase;
}
nav ul li a:hover{
text-decoration:none;
background-color:#f0f0f0;
}
nav, article, nav ul li a,figure{
/* Applying CSS3 rounded corners: */
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
}
/* Article styles: */
#page{
width:960px;
margin:0 auto;
position:relative;
}
article{
background-color:#213E4A;
margin:3em 0;
padding:20px;
text-shadow:0 2px 0 black;
}
figure{
border:3px solid #142830;
float:right;
height:300px;
margin-left:15px;
overflow:hidden;
width:500px;
}
figure:hover{
-moz-box-shadow:0 0 2px #4D7788;
-webkit-box-shadow:0 0 2px #4D7788;
box-shadow:0 0 2px #4D7788;
}
figure img{
margin-left:-60px;
}
/* Footer styling: */
footer{
margin-bottom:30px;
text-align:center;
font-size:0.825em;
}
footer p{
margin-bottom:-2.5em;
position:relative;
}
footer a,footer a:visited{
color:#cccccc;
background-color:#213e4a;
display:block;
padding:2px 4px;
z-index:100;
position:relative;
}
footer a:hover{
text-decoration:none;
background-color:#142830;
}
footer a.by{
float:left;
}
footer a.up{
float:right;
}

View File

@@ -1,139 +1,139 @@
<!DOCTYPE html> <!-- The new doctype -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Coding A CSS3 &amp; HTML5 One Page Template | Tutorialzine demo</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<!-- Internet Explorer HTML5 enabling code: -->
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<style type="text/css">
.clear {
zoom: 1;
display: block;
}
</style>
<![endif]-->
</head>
<body>
<section id="page"> <!-- Defining the #page section with the section tag -->
<header> <!-- Defining the header section of the page with the appropriate tag -->
<hgroup>
<h1>Your Logo</h1>
<h3>and a fancy slogan</h3>
</hgroup>
<nav class="clear"> <!-- The nav link semantically marks your main site navigation -->
<ul>
<li><a href="#article1">Photoshoot</a></li>
<li><a href="#article2">Sweet Tabs</a></li>
<li><a href="#article3">Navigation Menu</a></li>
</ul>
</nav>
</header>
<section id="articles"> <!-- A new section with the articles -->
<!-- Article 1 start -->
<div class="line"></div> <!-- Dividing line -->
<article id="article1"> <!-- The new article tag. The id is supplied so it can be scrolled into view. -->
<h2>Photoshoot Effect</h2>
<div class="line"></div>
<div class="articleBody clear">
<figure> <!-- The figure tag marks data (usually an image) that is part of the article -->
<a href="http://tutorialzine.com/2010/02/photo-shoot-css-jquery/"><img src="http://tutorialzine.com/img/featured/641.jpg" width="620" height="340" /></a>
</figure>
<p>In this tutorial, we are creating a photo shoot effect with our just-released PhotoShoot jQuery plug-in. With it you can convert a regular div on the page into a photo shooting stage simulating a camera-like feel.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
</div>
</article>
<!-- Article 1 end -->
<!-- Article 2 start -->
<div class="line"></div>
<article id="article2">
<h2>Sweet AJAX Tabs</h2>
<div class="line"></div>
<div class="articleBody clear">
<figure>
<a href="http://tutorialzine.com/2010/01/sweet-tabs-jquery-ajax-css/"><img src="http://tutorialzine.com/img/featured/633.jpg" width="620" height="340" /></a>
</figure>
<p>Here we are making sweet AJAX-powered tabs with CSS3 and the newly released version 1.4 of jQuery.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
</div>
</article>
<!-- Article 2 end -->
<!-- Article 3 start -->
<div class="line"></div>
<article id="article3">
<h2>Halftone Navigation Menu</h2>
<div class="line"></div>
<div class="articleBody clear">
<figure>
<a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/"><img src="http://tutorialzine.com/img/featured/610.jpg" width="620" height="340" /></a>
</figure>
<p>Today we are making a CSS3 & jQuery halftone-style navigation menu, which will allow you to display animated halftone-style shapes in accordance with the navigation links, and will provide a simple editor for creating additional shapes as well.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
</div>
</article>
<!-- Article 3 end -->
</section>
<footer> <!-- Marking the footer section -->
<div class="line"></div>
<p>Copyright 2010 - YourSite.com</p> <!-- Change the copyright notice -->
<a href="#" class="up">Go UP</a>
<a href="http://tutorialzine.com/2010/02/html5-css3-website-template/" class="by">Template by Tutorialzine</a>
</footer>
</section> <!-- Closing the #page section -->
<!-- JavaScript Includes -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="jquery.scrollTo-1.4.2/jquery.scrollTo-min.js"></script>
<script src="script.js"></script>
</body>
</html>
<!DOCTYPE html> <!-- The new doctype -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Coding A CSS3 &amp; HTML5 One Page Template | Tutorialzine demo</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<!-- Internet Explorer HTML5 enabling code: -->
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<style type="text/css">
.clear {
zoom: 1;
display: block;
}
</style>
<![endif]-->
</head>
<body>
<section id="page"> <!-- Defining the #page section with the section tag -->
<header> <!-- Defining the header section of the page with the appropriate tag -->
<hgroup>
<h1>Your Logo</h1>
<h3>and a fancy slogan</h3>
</hgroup>
<nav class="clear"> <!-- The nav link semantically marks your main site navigation -->
<ul>
<li><a href="#article1">Photoshoot</a></li>
<li><a href="#article2">Sweet Tabs</a></li>
<li><a href="#article3">Navigation Menu</a></li>
</ul>
</nav>
</header>
<section id="articles"> <!-- A new section with the articles -->
<!-- Article 1 start -->
<div class="line"></div> <!-- Dividing line -->
<article id="article1"> <!-- The new article tag. The id is supplied so it can be scrolled into view. -->
<h2>Photoshoot Effect</h2>
<div class="line"></div>
<div class="articleBody clear">
<figure> <!-- The figure tag marks data (usually an image) that is part of the article -->
<a href="http://tutorialzine.com/2010/02/photo-shoot-css-jquery/"><img src="http://tutorialzine.com/img/featured/641.jpg" width="620" height="340" /></a>
</figure>
<p>In this tutorial, we are creating a photo shoot effect with our just-released PhotoShoot jQuery plug-in. With it you can convert a regular div on the page into a photo shooting stage simulating a camera-like feel.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
</div>
</article>
<!-- Article 1 end -->
<!-- Article 2 start -->
<div class="line"></div>
<article id="article2">
<h2>Sweet AJAX Tabs</h2>
<div class="line"></div>
<div class="articleBody clear">
<figure>
<a href="http://tutorialzine.com/2010/01/sweet-tabs-jquery-ajax-css/"><img src="http://tutorialzine.com/img/featured/633.jpg" width="620" height="340" /></a>
</figure>
<p>Here we are making sweet AJAX-powered tabs with CSS3 and the newly released version 1.4 of jQuery.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
</div>
</article>
<!-- Article 2 end -->
<!-- Article 3 start -->
<div class="line"></div>
<article id="article3">
<h2>Halftone Navigation Menu</h2>
<div class="line"></div>
<div class="articleBody clear">
<figure>
<a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/"><img src="http://tutorialzine.com/img/featured/610.jpg" width="620" height="340" /></a>
</figure>
<p>Today we are making a CSS3 & jQuery halftone-style navigation menu, which will allow you to display animated halftone-style shapes in accordance with the navigation links, and will provide a simple editor for creating additional shapes as well.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer luctus quam quis nibh fringilla sit amet consectetur lectus malesuada. Sed nec libero erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mi nisi, rhoncus ut vestibulum ac, sollicitudin quis lorem. Duis felis dui, vulputate nec adipiscing nec, interdum vel tortor. Sed gravida, erat nec rutrum tincidunt, metus mauris imperdiet nunc, et elementum tortor nunc at eros. Donec malesuada congue molestie. Suspendisse potenti. Vestibulum cursus congue sem et feugiat. Morbi quis elit odio. </p>
</div>
</article>
<!-- Article 3 end -->
</section>
<footer> <!-- Marking the footer section -->
<div class="line"></div>
<p>Copyright 2010 - YourSite.com</p> <!-- Change the copyright notice -->
<a href="#" class="up">Go UP</a>
<a href="http://tutorialzine.com/2010/02/html5-css3-website-template/" class="by">Template by Tutorialzine</a>
</footer>
</section> <!-- Closing the #page section -->
<!-- JavaScript Includes -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="jquery.scrollTo-1.4.2/jquery.scrollTo-min.js"></script>
<script src="script.js"></script>
</body>
</html>

View File

@@ -1,43 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Halftone Navigation Menu With jQuery &amp; CSS3 | Tutorialzine demo</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1>Halftone Navigation Menu With jQuery &amp; CSS3</h1>
<h2>View the <a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/">original tutorial &raquo;</a></h2>
<div id="main">
<div id="navigation">
<ul class="menuUL">
<!-- The class names that are assigned to the links correspond to name of the shape that is shown on hover: -->
<li><a href="#" class="house">Home</a></li>
<li><a href="#" class="wrench">Services</a></li>
<li><a href="#" class="envelope">Contact</a></li>
<li><a href="#" class="info">About</a></li>
</ul>
<div class="clear"></div>
</div>
<div id="stage">
<!-- The dot divs are shown here -->
</div>
</div>
<p class="tutInfo">This is a tutorialzine demo. View the <a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/">original tutorial</a>, or download the <a href="demo.zip">source files</a>.</p>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Halftone Navigation Menu With jQuery &amp; CSS3 | Tutorialzine demo</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1>Halftone Navigation Menu With jQuery &amp; CSS3</h1>
<h2>View the <a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/">original tutorial &raquo;</a></h2>
<div id="main">
<div id="navigation">
<ul class="menuUL">
<!-- The class names that are assigned to the links correspond to name of the shape that is shown on hover: -->
<li><a href="#" class="house">Home</a></li>
<li><a href="#" class="wrench">Services</a></li>
<li><a href="#" class="envelope">Contact</a></li>
<li><a href="#" class="info">About</a></li>
</ul>
<div class="clear"></div>
</div>
<div id="stage">
<!-- The dot divs are shown here -->
</div>
</div>
<p class="tutInfo">This is a tutorialzine demo. View the <a href="http://tutorialzine.com/2010/01/halftone-navigation-menu-jquery-css/">original tutorial</a>, or download the <a href="demo.zip">source files</a>.</p>
</body>
</html>

View File

@@ -1,121 +1,121 @@
/* Set serviceMode to true to create your own shapes: */
var serviceMode = false;
$(document).ready(function(){
/* This code is executed after the DOM has been completely loaded */
var str=[];
var perRow = 16;
/* Generating the dot divs: */
for(var i=0;i<192;i++)
{
str.push('<div class="dot" id="d-'+i+'" />');
}
/* Joining the array into a string and adding it to the inner html of the stage div: */
$('#stage').html(str.join(''));
/* Using the hover method: */
$('#navigation li a').hover(function(e){
/* serviceDraw is a cut-out version of the draw function, used for shape editing and composing: */
if(serviceMode)
serviceDraw($(this).attr('class'));
else
draw($(this).attr('class'));
}, function(e){
});
/* Caching the dot divs into a variable for performance: */
dots = $('.dot');
if(serviceMode)
{
/* If we are in service mode, show borders around the dot divs, add the export link, and listen for clicks: */
dots.css({
border:'1px solid black',
width:dots.eq(0).width()-2,
height:dots.eq(0).height()-2,
cursor:'pointer'
})
$('<div/>').css({
position:'absolute',
bottom:-20,
right:0
}).html('<a href="" onclick="outputString();return false;">[Export Shape]</a>').appendTo('#stage');
dots.click(function(){
$(this).toggleClass('active');
});
}
});
var shapes={
/* Each shape is described by an array of points. You can add your own shapes here,
just don't forget to add a coma after each array, except for the last one */
house:[22,37,38,39,52,53,54,55,56,67,68,69,70,71,72,73,82,83,84,85,86,87,88,89,90,99,100,104,105,115,116,120,121,131,132,136,137,147,148,150,151,152,153,163,164,166,167,168,169],
wrench:[22,23,24,25,26,27,38,39,40,41,42,43,54,55,58,59,70,71,86,87,88,89,101,102,103,104,105,116,117,118,131,132,133,146,147,148,163],
envelope:[34,35,36,37,38,39,40,41,42,43,44,50,51,52,58,59,60,66,68,69,73,74,76,82,85,86,88,89,92,98,102,103,104,108,114,119,124,130,140,146,147,148,149,150,151,152,153,154,155,156],
info:[22,23,38,39,69,70,71,86,87,102,103,118,119,134,135,150,151,166,167,168]
}
var stopCounter = 0;
var dots;
function draw(shape)
{
/* This function draws a shape from the shapes object */
stopCounter++;
var currentCounter = stopCounter;
dots.removeClass('active').css('opacity',0);
$.each(shapes[shape],function(i,j){
setTimeout(function(){
/* If a different shape animaton has been started during the showing of the current one, exit the function */
if(currentCounter!=stopCounter) return false;
dots.eq(j).addClass('active').fadeTo('slow',0.4);
/* The fade animation is scheduled for 10*i millisecond in the future: */
},10*i);
});
}
function serviceDraw(shape)
{
/* A cut out version of the draw function, used in service mode */
dots.removeClass('active');
$.each(shapes[shape],function(i,j){
dots.eq(j).addClass('active');
});
}
function outputString()
{
/* Outputs the positions of the active dot divs as a comma-separated string: */
var str=[];
$('.dot.active').each(function(){
str.push(this.id.replace('d-',''));
})
prompt('Insert this string as an array in the shapes object',str.join(','));
/* Set serviceMode to true to create your own shapes: */
var serviceMode = false;
$(document).ready(function(){
/* This code is executed after the DOM has been completely loaded */
var str=[];
var perRow = 16;
/* Generating the dot divs: */
for(var i=0;i<192;i++)
{
str.push('<div class="dot" id="d-'+i+'" />');
}
/* Joining the array into a string and adding it to the inner html of the stage div: */
$('#stage').html(str.join(''));
/* Using the hover method: */
$('#navigation li a').hover(function(e){
/* serviceDraw is a cut-out version of the draw function, used for shape editing and composing: */
if(serviceMode)
serviceDraw($(this).attr('class'));
else
draw($(this).attr('class'));
}, function(e){
});
/* Caching the dot divs into a variable for performance: */
dots = $('.dot');
if(serviceMode)
{
/* If we are in service mode, show borders around the dot divs, add the export link, and listen for clicks: */
dots.css({
border:'1px solid black',
width:dots.eq(0).width()-2,
height:dots.eq(0).height()-2,
cursor:'pointer'
})
$('<div/>').css({
position:'absolute',
bottom:-20,
right:0
}).html('<a href="" onclick="outputString();return false;">[Export Shape]</a>').appendTo('#stage');
dots.click(function(){
$(this).toggleClass('active');
});
}
});
var shapes={
/* Each shape is described by an array of points. You can add your own shapes here,
just don't forget to add a coma after each array, except for the last one */
house:[22,37,38,39,52,53,54,55,56,67,68,69,70,71,72,73,82,83,84,85,86,87,88,89,90,99,100,104,105,115,116,120,121,131,132,136,137,147,148,150,151,152,153,163,164,166,167,168,169],
wrench:[22,23,24,25,26,27,38,39,40,41,42,43,54,55,58,59,70,71,86,87,88,89,101,102,103,104,105,116,117,118,131,132,133,146,147,148,163],
envelope:[34,35,36,37,38,39,40,41,42,43,44,50,51,52,58,59,60,66,68,69,73,74,76,82,85,86,88,89,92,98,102,103,104,108,114,119,124,130,140,146,147,148,149,150,151,152,153,154,155,156],
info:[22,23,38,39,69,70,71,86,87,102,103,118,119,134,135,150,151,166,167,168]
}
var stopCounter = 0;
var dots;
function draw(shape)
{
/* This function draws a shape from the shapes object */
stopCounter++;
var currentCounter = stopCounter;
dots.removeClass('active').css('opacity',0);
$.each(shapes[shape],function(i,j){
setTimeout(function(){
/* If a different shape animaton has been started during the showing of the current one, exit the function */
if(currentCounter!=stopCounter) return false;
dots.eq(j).addClass('active').fadeTo('slow',0.4);
/* The fade animation is scheduled for 10*i millisecond in the future: */
},10*i);
});
}
function serviceDraw(shape)
{
/* A cut out version of the draw function, used in service mode */
dots.removeClass('active');
$.each(shapes[shape],function(i,j){
dots.eq(j).addClass('active');
});
}
function outputString()
{
/* Outputs the positions of the active dot divs as a comma-separated string: */
var str=[];
$('.dot.active').each(function(){
str.push(this.id.replace('d-',''));
})
prompt('Insert this string as an array in the shapes object',str.join(','));
}

View File

@@ -1,148 +1,148 @@
body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{
/* Simple page reset */
margin:0;
padding:0;
}
body{
/* Setting default text color, background and a font stack */
color:#cccccc;
font-size:0.825em;
background: url(img/background.jpg) no-repeat center top #252525;
font-family:Arial, Helvetica, sans-serif;
}
.menuUL li{
/* This will arrange the LI-s next to each other */
display:inline;
}
.menuUL li a,.menuUL li a:visited{
/* Styling the hyperlinks of the menu as buttons */
float:left;
font-weight:bold;
background:url(img/button_bg.jpg) repeat-x center bottom #666666;
/* display:block allows for additinal CSS rules to take effect, such as paddings: */
display:block;
border:1px solid #4D4D4D;
color:#CCCCCC;
border-top-color:#565656;
padding:4px 6px;
margin:4px 5px;
height:16px;
/* Setting a CSS3 box shadow around the button */
-moz-box-shadow:0 0 1px black;
-webkit-box-shadow:0 0 1px black;
box-shadow:0 0 1px black;
/* CSS3 text shadow */
text-shadow:0 1px black;
}
.menuUL li a:hover{
/* On hover show the top, lighter, part of the background: */
background-position:center top;
text-decoration:none;
}
#navigation{
/* The navigation menu bar: */
background:#222222;
border:1px solid #111111;
float:left;
padding:5px 10px;
}
#navigation,.menuUL li a{
/* CSS3 rounded corners for both the navigation bar and the buttons: */
-moz-border-radius:4px;
-webkit-border-radius:4px;
-khtml-border-radius:4px;
border-radius:4px;
}
#stage{
/* The stage contains the individual divs that comprise the halftone icon: */
height:300px;
position:absolute;
right:50px;
top:20px;
width:400px;
}
.dot{
/* The stage contains 192 .dot divs: */
float:left;
height:25px;
width:25px;
}
.dot.active{
/* When assigned the active class, the div shows a background image of a dot: */
background:url(img/dot.png) no-repeat center center;
}
.clear{
/* Old-school clear fix hack to clear the floats: */
clear:both;
}
#main{
margin:0 auto;
position:relative;
width:900px;
}
/* The styles below are only necessary for the demo page */
h1{
background:#222222;
border-bottom:1px solid black;
font-size:1.5em;
font-weight:normal;
margin-bottom:15px;
padding:15px;
text-align:center;
}
h2 {
font-size:0.9em;
font-weight:normal;
padding-right:40px;
position:relative;
right:0;
text-align:right;
text-transform:uppercase;
top:-48px;
}
a, a:visited {
color:#0196e3;
text-decoration:none;
outline:none;
}
a:hover{
text-decoration:underline;
}
p.tutInfo{
/* The tutorial info on the bottom of the page */
padding:10px 0;
text-align:center;
position:absolute;
bottom:0px;
background:#222222;
border-top:1px solid black;
width:100%;
}
h1,h2,p.tutInfo{
font-family:"Myriad Pro",Arial,Helvetica,sans-serif;
}
body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{
/* Simple page reset */
margin:0;
padding:0;
}
body{
/* Setting default text color, background and a font stack */
color:#cccccc;
font-size:0.825em;
background: url(img/background.jpg) no-repeat center top #252525;
font-family:Arial, Helvetica, sans-serif;
}
.menuUL li{
/* This will arrange the LI-s next to each other */
display:inline;
}
.menuUL li a,.menuUL li a:visited{
/* Styling the hyperlinks of the menu as buttons */
float:left;
font-weight:bold;
background:url(img/button_bg.jpg) repeat-x center bottom #666666;
/* display:block allows for additinal CSS rules to take effect, such as paddings: */
display:block;
border:1px solid #4D4D4D;
color:#CCCCCC;
border-top-color:#565656;
padding:4px 6px;
margin:4px 5px;
height:16px;
/* Setting a CSS3 box shadow around the button */
-moz-box-shadow:0 0 1px black;
-webkit-box-shadow:0 0 1px black;
box-shadow:0 0 1px black;
/* CSS3 text shadow */
text-shadow:0 1px black;
}
.menuUL li a:hover{
/* On hover show the top, lighter, part of the background: */
background-position:center top;
text-decoration:none;
}
#navigation{
/* The navigation menu bar: */
background:#222222;
border:1px solid #111111;
float:left;
padding:5px 10px;
}
#navigation,.menuUL li a{
/* CSS3 rounded corners for both the navigation bar and the buttons: */
-moz-border-radius:4px;
-webkit-border-radius:4px;
-khtml-border-radius:4px;
border-radius:4px;
}
#stage{
/* The stage contains the individual divs that comprise the halftone icon: */
height:300px;
position:absolute;
right:50px;
top:20px;
width:400px;
}
.dot{
/* The stage contains 192 .dot divs: */
float:left;
height:25px;
width:25px;
}
.dot.active{
/* When assigned the active class, the div shows a background image of a dot: */
background:url(img/dot.png) no-repeat center center;
}
.clear{
/* Old-school clear fix hack to clear the floats: */
clear:both;
}
#main{
margin:0 auto;
position:relative;
width:900px;
}
/* The styles below are only necessary for the demo page */
h1{
background:#222222;
border-bottom:1px solid black;
font-size:1.5em;
font-weight:normal;
margin-bottom:15px;
padding:15px;
text-align:center;
}
h2 {
font-size:0.9em;
font-weight:normal;
padding-right:40px;
position:relative;
right:0;
text-align:right;
text-transform:uppercase;
top:-48px;
}
a, a:visited {
color:#0196e3;
text-decoration:none;
outline:none;
}
a:hover{
text-decoration:underline;
}
p.tutInfo{
/* The tutorial info on the bottom of the page */
padding:10px 0;
text-align:center;
position:absolute;
bottom:0px;
background:#222222;
border-top:1px solid black;
width:100%;
}
h1,h2,p.tutInfo{
font-family:"Myriad Pro",Arial,Helvetica,sans-serif;
}

View File

@@ -1,153 +1,153 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Business Co.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onload="MM_preloadImages('images/btn_1_over.jpg','images/btn_2_over.jpg','images/btn_3_over.jpg','images/btn_4_over.jpg','images/btn_5_over.jpg', 'images/btn_6_over.jpg');">
<!-- Save for Web Slices (index.psd) -->
<table width="775" height="700" border="0" align="center" cellpadding="0" cellspacing="0" id="table_01">
<tr>
<td width="59" height="0" nowrap="nowrap"></td>
<td width="19" height="0" nowrap="nowrap"></td>
<td width="4" height="0" nowrap="nowrap"></td>
<td width="23" height="0" nowrap="nowrap"></td>
<td width="83" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="8" height="0" nowrap="nowrap"></td>
<td width="10" height="0" nowrap="nowrap"></td>
<td width="31" height="0" nowrap="nowrap"></td>
<td width="47" height="0" nowrap="nowrap"></td>
<td width="4" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="98" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="66" height="0" nowrap="nowrap"></td>
<td width="31" height="0" nowrap="nowrap"></td>
<td width="10" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="5" height="0" nowrap="nowrap"></td>
<td width="89" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="15" height="0" nowrap="nowrap"></td>
<td width="57" height="0" nowrap="nowrap"></td>
<td width="21" height="0" nowrap="nowrap"></td>
<td width="17" height="0" nowrap="nowrap"></td>
<td width="60" height="0" nowrap="nowrap"></td>
<td width="0" height="0"></td>
</tr>
<tr>
<td width="59" height="651" rowspan="15">
<img src="images/main.jpg" width="59" height="651" alt="" /></td>
<td width="561" height="33" colspan="22" align="left" valign="middle" bgcolor="#efefef" class="text3" style="padding-left:20px">SEPTEMBER 29, 2009 </td>
<td width="95" height="33" colspan="3" align="left" valign="top"><a href="#"><img src="images/client_login.jpg" alt="" width="95" height="33" border="0" /></a></td>
<td width="60" height="651" rowspan="15">
<img src="images/main-03.jpg" width="60" height="651" alt="" /></td>
<td width="0" height="33" nowrap="nowrap"></td>
</tr>
<tr>
<td width="656" height="21" colspan="25" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
<td width="0" height="21" nowrap="nowrap"></td>
</tr>
<tr>
<td width="23" height="17" colspan="2" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
<td width="106" height="17" colspan="2" align="left" valign="top" bgcolor="#a7a7a7"><a href="index.html"><img src="images/btn_1.jpg" alt="" name="btn_1" width="106" height="17" border="0" id="btn_1" onmouseover="MM_swapImage('btn_1','','images/btn_1_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines.jpg" width="3" height="17" alt="" /></td>
<td width="100" height="17" colspan="5" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_2.jpg" alt="" name="btn_2" width="100" height="17" border="0" id="btn_2" onmouseover="MM_swapImage('btn_2','','images/btn_2_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines-07.jpg" width="3" height="17" alt="" /></td>
<td width="98" height="17" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_3.jpg" alt="" name="btn_3" width="98" height="17" border="0" id="btn_3" onmouseover="MM_swapImage('btn_3','','images/btn_3_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines-09.jpg" width="3" height="17" alt="" /></td>
<td width="107" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_4.jpg" alt="" name="btn_4" width="107" height="17" border="0" id="btn_4" onmouseover="MM_swapImage('btn_4','','images/btn_4_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines-11.jpg" width="3" height="17" alt="" /></td>
<td width="97" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_5.jpg" alt="" name="btn_5" width="97" height="17" border="0" id="btn_5" onmouseover="MM_swapImage('btn_5','','images/btn_5_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines-13.jpg" width="3" height="17" alt="" /></td>
<td width="93" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_6.jpg" alt="" name="btn_6" width="93" height="17" border="0" id="btn_6" onmouseover="MM_swapImage('btn_6','','images/btn_6_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="17" height="17" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
<td width="0" height="17" nowrap="nowrap"></td>
</tr>
<tr>
<td width="656" height="19" colspan="25" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
<td width="0" height="19" nowrap="nowrap"></td>
</tr>
<tr>
<td width="656" height="240" colspan="25" align="left" valign="top">
<img src="images/main-15.jpg" width="656" height="240" alt="" /></td>
<td width="0" height="240" nowrap="nowrap"></td>
</tr>
<tr>
<td width="656" height="321" colspan="25" rowspan="10" align="center" valign="middle" nowrap="nowrap" bgcolor="#efefef" class="text1">Content Page</td>
<td width="0" height="7" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="43" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="56" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="26" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="12" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="17" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="23" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="22" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="58" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="57" nowrap="nowrap"></td>
</tr>
<tr>
<td width="775" height="49" colspan="27" align="center" valign="middle" class="text2" style="background:url(images/b_footer.jpg)"><a href="index.html">HOME</a> | <a href="contentpage.html">ABOUT US</a> | <a href="contentpage.html">SERVICES</a> | <a href="contentpage.html">SOLUTIONS</a> | <a href="contentpage.html">SUPPORT</a> | <a href="contentpage.html">CONTACTS</a><br />
<span class="text3">Copyright &copy; Your Company Name</span><br/>
Design by <a href="http://www.templatesbox.com" target="_blank" class="adv">Templates</a> Box. Create a <a href="http://www.wix.com" target="_blank" class="adv">free website</a>.
</td>
<td width="0" height="49" nowrap="nowrap"></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Business Co.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onload="MM_preloadImages('images/btn_1_over.jpg','images/btn_2_over.jpg','images/btn_3_over.jpg','images/btn_4_over.jpg','images/btn_5_over.jpg', 'images/btn_6_over.jpg');">
<!-- Save for Web Slices (index.psd) -->
<table width="775" height="700" border="0" align="center" cellpadding="0" cellspacing="0" id="table_01">
<tr>
<td width="59" height="0" nowrap="nowrap"></td>
<td width="19" height="0" nowrap="nowrap"></td>
<td width="4" height="0" nowrap="nowrap"></td>
<td width="23" height="0" nowrap="nowrap"></td>
<td width="83" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="8" height="0" nowrap="nowrap"></td>
<td width="10" height="0" nowrap="nowrap"></td>
<td width="31" height="0" nowrap="nowrap"></td>
<td width="47" height="0" nowrap="nowrap"></td>
<td width="4" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="98" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="66" height="0" nowrap="nowrap"></td>
<td width="31" height="0" nowrap="nowrap"></td>
<td width="10" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="5" height="0" nowrap="nowrap"></td>
<td width="89" height="0" nowrap="nowrap"></td>
<td width="3" height="0" nowrap="nowrap"></td>
<td width="15" height="0" nowrap="nowrap"></td>
<td width="57" height="0" nowrap="nowrap"></td>
<td width="21" height="0" nowrap="nowrap"></td>
<td width="17" height="0" nowrap="nowrap"></td>
<td width="60" height="0" nowrap="nowrap"></td>
<td width="0" height="0"></td>
</tr>
<tr>
<td width="59" height="651" rowspan="15">
<img src="images/main.jpg" width="59" height="651" alt="" /></td>
<td width="561" height="33" colspan="22" align="left" valign="middle" bgcolor="#efefef" class="text3" style="padding-left:20px">SEPTEMBER 29, 2009 </td>
<td width="95" height="33" colspan="3" align="left" valign="top"><a href="#"><img src="images/client_login.jpg" alt="" width="95" height="33" border="0" /></a></td>
<td width="60" height="651" rowspan="15">
<img src="images/main-03.jpg" width="60" height="651" alt="" /></td>
<td width="0" height="33" nowrap="nowrap"></td>
</tr>
<tr>
<td width="656" height="21" colspan="25" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
<td width="0" height="21" nowrap="nowrap"></td>
</tr>
<tr>
<td width="23" height="17" colspan="2" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
<td width="106" height="17" colspan="2" align="left" valign="top" bgcolor="#a7a7a7"><a href="index.html"><img src="images/btn_1.jpg" alt="" name="btn_1" width="106" height="17" border="0" id="btn_1" onmouseover="MM_swapImage('btn_1','','images/btn_1_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines.jpg" width="3" height="17" alt="" /></td>
<td width="100" height="17" colspan="5" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_2.jpg" alt="" name="btn_2" width="100" height="17" border="0" id="btn_2" onmouseover="MM_swapImage('btn_2','','images/btn_2_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines-07.jpg" width="3" height="17" alt="" /></td>
<td width="98" height="17" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_3.jpg" alt="" name="btn_3" width="98" height="17" border="0" id="btn_3" onmouseover="MM_swapImage('btn_3','','images/btn_3_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines-09.jpg" width="3" height="17" alt="" /></td>
<td width="107" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_4.jpg" alt="" name="btn_4" width="107" height="17" border="0" id="btn_4" onmouseover="MM_swapImage('btn_4','','images/btn_4_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines-11.jpg" width="3" height="17" alt="" /></td>
<td width="97" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_5.jpg" alt="" name="btn_5" width="97" height="17" border="0" id="btn_5" onmouseover="MM_swapImage('btn_5','','images/btn_5_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#a7a7a7">
<img src="images/lines-13.jpg" width="3" height="17" alt="" /></td>
<td width="93" height="17" colspan="3" align="left" valign="top" bgcolor="#a7a7a7"><a href="contentpage.html"><img src="images/btn_6.jpg" alt="" name="btn_6" width="93" height="17" border="0" id="btn_6" onmouseover="MM_swapImage('btn_6','','images/btn_6_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="17" height="17" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
<td width="0" height="17" nowrap="nowrap"></td>
</tr>
<tr>
<td width="656" height="19" colspan="25" align="left" valign="top" nowrap="nowrap" bgcolor="#a7a7a7"></td>
<td width="0" height="19" nowrap="nowrap"></td>
</tr>
<tr>
<td width="656" height="240" colspan="25" align="left" valign="top">
<img src="images/main-15.jpg" width="656" height="240" alt="" /></td>
<td width="0" height="240" nowrap="nowrap"></td>
</tr>
<tr>
<td width="656" height="321" colspan="25" rowspan="10" align="center" valign="middle" nowrap="nowrap" bgcolor="#efefef" class="text1">Content Page</td>
<td width="0" height="7" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="43" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="56" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="26" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="12" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="17" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="23" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="22" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="58" nowrap="nowrap"></td>
</tr>
<tr>
<td width="0" height="57" nowrap="nowrap"></td>
</tr>
<tr>
<td width="775" height="49" colspan="27" align="center" valign="middle" class="text2" style="background:url(images/b_footer.jpg)"><a href="index.html">HOME</a> | <a href="contentpage.html">ABOUT US</a> | <a href="contentpage.html">SERVICES</a> | <a href="contentpage.html">SOLUTIONS</a> | <a href="contentpage.html">SUPPORT</a> | <a href="contentpage.html">CONTACTS</a><br />
<span class="text3">Copyright &copy; Your Company Name</span><br/>
Design by <a href="http://www.templatesbox.com" target="_blank" class="adv">Templates</a> Box. Create a <a href="http://www.wix.com" target="_blank" class="adv">free website</a>.
</td>
<td width="0" height="49" nowrap="nowrap"></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>

View File

@@ -1,160 +1,160 @@
body{
padding:0px;
margin:0px;
background:#c7c7c7;
color:#848484;
font:10px/14px Tahoma, sans-serif;
}
div, p, ul, h2, h3, h4, img, form{padding:0px; margin:0px;}
ul{list-style-type:none;}
.clear{
clear:both;
}
.frame {
border: 1px solid #D5E6E0;
}
.text1 {
font: 11px/14px "Trebuchet MS", Arial, Helvetica, sans-serif;
color:#000;
font-weight:bold;
}
.text2 {
font: 11px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
}
.text3 {
font: 10px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
}
.text4 {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#052578;
font-weight:bold;
}
.text5 {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#052578;
font-weight:bold;
}
a:link {
font: 11px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:none;
}
a:visited{
font: 11px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:none;
}
a:hover {
font: 11px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:underline;
}
a.a:link {
font: 10px/14px Tahoma, Geneva, sans-serif;
color:#19a1cb;
font-weight:normal;
text-decoration:underline;
}
a.a:visited{
font: 10px/14px Tahoma, Geneva, sans-serif;
color:#19a1cb;
font-weight:normal;
text-decoration:underline;
}
a.a:hover {
font: 10px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:none;
}
a.b:link {
font: 10px/18px Tahoma, Geneva, sans-serif;
color:#848484;
font-weight:normal;
text-decoration:underline;
}
a.b:visited{
font: 10px/18px Tahoma, Geneva, sans-serif;
color:#848484;
font-weight:normal;
text-decoration:underline;
}
a.b:hover {
font: 10px/18px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:none;
}
a.c:link {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:none;
}
a.c:visited{
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:none;
}
a.c:hover {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:underline;
}
a.d:link {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:none;
}
a.d:visited{
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:none;
}
a.d:hover {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:underline;
}
input, textarea, select{
border:#fff 1px solid;
background-color:#d6e6e0;
font:10px/12px Tahoma, sans-serif; color:#000;
}
a.adv:link {text-decoration: none; font-weight:bold; color:#000;}
a.adv:hover {text-decoration: none; font-weight:bold; color:#000;}
a.adv:visited {text-decoration: none; font-weight:bold; color:#000;}
body{
padding:0px;
margin:0px;
background:#c7c7c7;
color:#848484;
font:10px/14px Tahoma, sans-serif;
}
div, p, ul, h2, h3, h4, img, form{padding:0px; margin:0px;}
ul{list-style-type:none;}
.clear{
clear:both;
}
.frame {
border: 1px solid #D5E6E0;
}
.text1 {
font: 11px/14px "Trebuchet MS", Arial, Helvetica, sans-serif;
color:#000;
font-weight:bold;
}
.text2 {
font: 11px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
}
.text3 {
font: 10px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
}
.text4 {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#052578;
font-weight:bold;
}
.text5 {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#052578;
font-weight:bold;
}
a:link {
font: 11px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:none;
}
a:visited{
font: 11px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:none;
}
a:hover {
font: 11px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:underline;
}
a.a:link {
font: 10px/14px Tahoma, Geneva, sans-serif;
color:#19a1cb;
font-weight:normal;
text-decoration:underline;
}
a.a:visited{
font: 10px/14px Tahoma, Geneva, sans-serif;
color:#19a1cb;
font-weight:normal;
text-decoration:underline;
}
a.a:hover {
font: 10px/14px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:none;
}
a.b:link {
font: 10px/18px Tahoma, Geneva, sans-serif;
color:#848484;
font-weight:normal;
text-decoration:underline;
}
a.b:visited{
font: 10px/18px Tahoma, Geneva, sans-serif;
color:#848484;
font-weight:normal;
text-decoration:underline;
}
a.b:hover {
font: 10px/18px Tahoma, Geneva, sans-serif;
color:#000;
font-weight:normal;
text-decoration:none;
}
a.c:link {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:none;
}
a.c:visited{
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:none;
}
a.c:hover {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:underline;
}
a.d:link {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:none;
}
a.d:visited{
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:none;
}
a.d:hover {
font: 10px/12px Tahoma, Geneva, sans-serif;
color:#FFF;
font-weight:normal;
text-decoration:underline;
}
input, textarea, select{
border:#fff 1px solid;
background-color:#d6e6e0;
font:10px/12px Tahoma, sans-serif; color:#000;
}
a.adv:link {text-decoration: none; font-weight:bold; color:#000;}
a.adv:hover {text-decoration: none; font-weight:bold; color:#000;}
a.adv:visited {text-decoration: none; font-weight:bold; color:#000;}

View File

@@ -1,197 +1,197 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Business Co.</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onload="MM_preloadImages('images/btn_1_over.jpg','images/btn_2_over.jpg','images/btn_3_over.jpg','images/btn_4_over.jpg','images/btn_5_over.jpg', 'images/btn_6_over.jpg')">
<!-- Save for Web Slices (index.psd) -->
<table width="775" height="700" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
<td width="59" height="0" nowrap></td>
<td width="19" height="0" nowrap></td>
<td width="4" height="0" nowrap></td>
<td width="23" height="0" nowrap></td>
<td width="83" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="8" height="0" nowrap></td>
<td width="10" height="0" nowrap></td>
<td width="31" height="0" nowrap></td>
<td width="47" height="0" nowrap></td>
<td width="4" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="98" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="66" height="0" nowrap></td>
<td width="31" height="0" nowrap></td>
<td width="10" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="5" height="0" nowrap></td>
<td width="89" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="15" height="0" nowrap></td>
<td width="57" height="0" nowrap></td>
<td width="21" height="0" nowrap></td>
<td width="17" height="0" nowrap></td>
<td width="60" height="0" nowrap></td>
<td width="0" height="0"></td>
</tr>
<tr>
<td width="59" height="651" rowspan="15">
<img src="images/main.jpg" width="59" height="651" alt="" /></td>
<td width="561" height="33" colspan="22" align="left" valign="middle" bgcolor="#EFEFEF" class="text3" style="padding-left:20px">SEPTEMBER 29, 2009 </td>
<td width="95" height="33" colspan="3" align="left" valign="top"><a href="#"><img src="images/client_login.jpg" alt="" width="95" height="33" border="0" /></a></td>
<td width="60" height="651" rowspan="15">
<img src="images/main-03.jpg" width="60" height="651" alt="" /></td>
<td width="0" height="33" nowrap></td>
</tr>
<tr>
<td width="656" height="21" colspan="25" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
<td width="0" height="21" nowrap></td>
</tr>
<tr>
<td width="23" height="17" colspan="2" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
<td width="106" height="17" colspan="2" align="left" valign="top" bgcolor="#A7A7A7"><a href="index.html"><img src="images/btn_1.jpg" alt="" name="btn_1" width="106" height="17" border="0" id="btn_1" onmouseover="MM_swapImage('btn_1','','images/btn_1_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines.jpg" width="3" height="17" alt="" /></td>
<td width="100" height="17" colspan="5" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_2.jpg" alt="" name="btn_2" width="100" height="17" border="0" id="btn_2" onmouseover="MM_swapImage('btn_2','','images/btn_2_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines-07.jpg" width="3" height="17" alt="" /></td>
<td width="98" height="17" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_3.jpg" alt="" name="btn_3" width="98" height="17" border="0" id="btn_3" onmouseover="MM_swapImage('btn_3','','images/btn_3_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines-09.jpg" width="3" height="17" alt="" /></td>
<td width="107" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_4.jpg" alt="" name="btn_4" width="107" height="17" border="0" id="btn_4" onmouseover="MM_swapImage('btn_4','','images/btn_4_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines-11.jpg" width="3" height="17" alt="" /></td>
<td width="97" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_5.jpg" alt="" name="btn_5" width="97" height="17" border="0" id="btn_5" onmouseover="MM_swapImage('btn_5','','images/btn_5_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines-13.jpg" width="3" height="17" alt="" /></td>
<td width="93" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_6.jpg" alt="" name="btn_6" width="93" height="17" border="0" id="btn_6" onmouseover="MM_swapImage('btn_6','','images/btn_6_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="17" height="17" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
<td width="0" height="17" nowrap></td>
</tr>
<tr>
<td width="656" height="19" colspan="25" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
<td width="0" height="19" nowrap></td>
</tr>
<tr>
<td width="656" height="240" colspan="25" align="left" valign="top">
<img src="images/main-15.jpg" width="656" height="240" alt="" /></td>
<td width="0" height="240" nowrap></td>
</tr>
<tr>
<td width="656" height="7" colspan="25" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="0" height="7" nowrap></td>
</tr>
<tr>
<td width="19" height="314" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="209" height="43" colspan="8" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/welcome.jpg" width="209" height="43" alt="" /></td>
<td width="174" height="43" colspan="5" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="31" height="314" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="185" height="43" colspan="8" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/news.jpg" width="185" height="43" alt="" /></td>
<td width="38" height="314" colspan="2" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="0" height="43" nowrap></td>
</tr>
<tr>
<td width="121" height="82" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/welcome-18.jpg" width="121" height="82" alt="" /></td>
<td width="10" height="94" rowspan="3" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="252" height="94" colspan="7" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF"><span class="text1">Lorem ipsum dolor sit amet, consectetuer</span><br />
Nam eu nulla. Donec lobortis purus vel urna. Nunc laoreet lacinia nunc. In volutpat sodales ipsum. Sed vestibulum. <a href="#" class="a">Integer in ante. Sed posuere ligula</a> rhoncus erat. Fusce urna dui, sollicitudin ac, pulvinar quis</td>
<td width="21" height="56" colspan="4" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/news-19.jpg" width="21" height="56" alt="" /></td>
<td width="164" height="56" colspan="4" align="left" valign="top" bgcolor="#EFEFEF" style="padding-top:5px"><p class="text1">September 29
</p>
<p><a href="#" class="a">Integer in ante. Sed posuere ligula </a>rhoncus erat. Fusce urna dui </p></td>
<td width="0" height="56" nowrap></td>
</tr>
<tr>
<td width="21" height="55" colspan="4" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF"><img src="images/news-20.jpg" width="21" height="55" alt="" /></td>
<td width="164" height="55" colspan="4" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF" style="padding-top:5px"><span class="text1">September 28
</span><br />
<a href="#" class="a">Integer in ante. Sed posuere ligula</a> rhoncus erat. Fusce urna dui</td>
<td width="0" height="26" nowrap></td>
</tr>
<tr>
<td width="121" height="12" colspan="5" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="0" height="12" nowrap></td>
</tr>
<tr>
<td width="162" height="40" colspan="7" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/services.jpg" width="162" height="40" alt="" /></td>
<td width="221" height="40" colspan="6" rowspan="2" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="0" height="17" nowrap></td>
</tr>
<tr>
<td width="185" height="45" colspan="8" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/spotlight.jpg" width="185" height="45" alt="" /></td>
<td width="0" height="23" nowrap></td>
</tr>
<tr>
<td width="121" height="80" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/services-23.jpg" width="121" height="80" alt="" /></td>
<td width="10" height="80" rowspan="2" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="252" height="80" colspan="7" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF"><span class="text1">Lorem ipsum dolor sit amet, consectetuer</span><br />
<a href="#" class="a">Nam eu nulla. Donec lobortis purus vel urna. Nunc </a>laoreet lacinia nunc. In volutpat sodales ipsum. Sed vestibulum. rhoncus erat. Fusce urna dui, sollicitudin ac, pulvinar quis</td>
<td width="0" height="22" nowrap></td>
</tr>
<tr>
<td width="16" height="115" colspan="3" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/spotlight-24.jpg" width="16" height="115" alt="" /></td>
<td width="169" height="115" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF" style="line-height:18px; padding-top:3px"><a href="#" class="b">Morbi volutpat leo in ligula. Inter vel</a><br />
<a href="#" class="b">magna. sagittis. Fusce elit ligula, </a><br />
<a href="#" class="b">sodales sit amet, tincid unt in, Fusce </a><br />
<a href="#" class="b">interdum. Sed laoreet. Aenean. Sed </a><br />
l<a href="#" class="b">aoreet. magna. sagittis. Fusce elit</a></td>
<td width="0" height="58" nowrap></td>
</tr>
<tr>
<td width="27" height="57" colspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/services-25.jpg" width="27" height="57" alt="" /></td>
<td width="356" height="57" colspan="11" align="left" valign="top" bgcolor="#EFEFEF" style="line-height:18px; padding-top:8px"><a href="#" class="b">Morbi volutpat leo in ligula. Inter vel magna. sagittis. Fusce elit ligula, sodales </a><br />
<a href="#" class="b">sit amet, tincid unt in, Fusce interdum. Sed laoreet. Aenean. Sed laoreet. </a></td>
<td width="0" height="57" nowrap></td>
</tr>
<tr>
<td width="775" height="49" colspan="27" align="center" valign="middle" class="text2" style="background:url(images/b_footer.jpg)"><a href="index.html">HOME</a> | <a href="contentpage.html">ABOUT US</a> | <a href="contentpage.html">SERVICES</a> | <a href="contentpage.html">SOLUTIONS</a> | <a href="contentpage.html">SUPPORT</a> | <a href="contentpage.html">CONTACTS</a><br />
<span class="text3">Copyright © Your Company Name</span><br />
Design by <a href="http://www.templatesbox.com" target="_blank" class="adv">Templates</a> Box. Create a <a href="http://www.wix.com" target="_blank" class="adv">free website</a>.
</td>
<td width="0" height="49" nowrap></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Business Co.</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onload="MM_preloadImages('images/btn_1_over.jpg','images/btn_2_over.jpg','images/btn_3_over.jpg','images/btn_4_over.jpg','images/btn_5_over.jpg', 'images/btn_6_over.jpg')">
<!-- Save for Web Slices (index.psd) -->
<table width="775" height="700" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
<td width="59" height="0" nowrap></td>
<td width="19" height="0" nowrap></td>
<td width="4" height="0" nowrap></td>
<td width="23" height="0" nowrap></td>
<td width="83" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="8" height="0" nowrap></td>
<td width="10" height="0" nowrap></td>
<td width="31" height="0" nowrap></td>
<td width="47" height="0" nowrap></td>
<td width="4" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="98" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="66" height="0" nowrap></td>
<td width="31" height="0" nowrap></td>
<td width="10" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="5" height="0" nowrap></td>
<td width="89" height="0" nowrap></td>
<td width="3" height="0" nowrap></td>
<td width="15" height="0" nowrap></td>
<td width="57" height="0" nowrap></td>
<td width="21" height="0" nowrap></td>
<td width="17" height="0" nowrap></td>
<td width="60" height="0" nowrap></td>
<td width="0" height="0"></td>
</tr>
<tr>
<td width="59" height="651" rowspan="15">
<img src="images/main.jpg" width="59" height="651" alt="" /></td>
<td width="561" height="33" colspan="22" align="left" valign="middle" bgcolor="#EFEFEF" class="text3" style="padding-left:20px">SEPTEMBER 29, 2009 </td>
<td width="95" height="33" colspan="3" align="left" valign="top"><a href="#"><img src="images/client_login.jpg" alt="" width="95" height="33" border="0" /></a></td>
<td width="60" height="651" rowspan="15">
<img src="images/main-03.jpg" width="60" height="651" alt="" /></td>
<td width="0" height="33" nowrap></td>
</tr>
<tr>
<td width="656" height="21" colspan="25" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
<td width="0" height="21" nowrap></td>
</tr>
<tr>
<td width="23" height="17" colspan="2" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
<td width="106" height="17" colspan="2" align="left" valign="top" bgcolor="#A7A7A7"><a href="index.html"><img src="images/btn_1.jpg" alt="" name="btn_1" width="106" height="17" border="0" id="btn_1" onmouseover="MM_swapImage('btn_1','','images/btn_1_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines.jpg" width="3" height="17" alt="" /></td>
<td width="100" height="17" colspan="5" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_2.jpg" alt="" name="btn_2" width="100" height="17" border="0" id="btn_2" onmouseover="MM_swapImage('btn_2','','images/btn_2_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines-07.jpg" width="3" height="17" alt="" /></td>
<td width="98" height="17" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_3.jpg" alt="" name="btn_3" width="98" height="17" border="0" id="btn_3" onmouseover="MM_swapImage('btn_3','','images/btn_3_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines-09.jpg" width="3" height="17" alt="" /></td>
<td width="107" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_4.jpg" alt="" name="btn_4" width="107" height="17" border="0" id="btn_4" onmouseover="MM_swapImage('btn_4','','images/btn_4_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines-11.jpg" width="3" height="17" alt="" /></td>
<td width="97" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_5.jpg" alt="" name="btn_5" width="97" height="17" border="0" id="btn_5" onmouseover="MM_swapImage('btn_5','','images/btn_5_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="3" height="17" align="left" valign="top" bgcolor="#A7A7A7">
<img src="images/lines-13.jpg" width="3" height="17" alt="" /></td>
<td width="93" height="17" colspan="3" align="left" valign="top" bgcolor="#A7A7A7"><a href="contentpage.html"><img src="images/btn_6.jpg" alt="" name="btn_6" width="93" height="17" border="0" id="btn_6" onmouseover="MM_swapImage('btn_6','','images/btn_6_over.jpg',1)" onmouseout="MM_swapImgRestore()"/></a></td>
<td width="17" height="17" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
<td width="0" height="17" nowrap></td>
</tr>
<tr>
<td width="656" height="19" colspan="25" align="left" valign="top" nowrap bgcolor="#A7A7A7"></td>
<td width="0" height="19" nowrap></td>
</tr>
<tr>
<td width="656" height="240" colspan="25" align="left" valign="top">
<img src="images/main-15.jpg" width="656" height="240" alt="" /></td>
<td width="0" height="240" nowrap></td>
</tr>
<tr>
<td width="656" height="7" colspan="25" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="0" height="7" nowrap></td>
</tr>
<tr>
<td width="19" height="314" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="209" height="43" colspan="8" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/welcome.jpg" width="209" height="43" alt="" /></td>
<td width="174" height="43" colspan="5" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="31" height="314" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="185" height="43" colspan="8" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/news.jpg" width="185" height="43" alt="" /></td>
<td width="38" height="314" colspan="2" rowspan="9" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="0" height="43" nowrap></td>
</tr>
<tr>
<td width="121" height="82" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/welcome-18.jpg" width="121" height="82" alt="" /></td>
<td width="10" height="94" rowspan="3" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="252" height="94" colspan="7" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF"><span class="text1">Lorem ipsum dolor sit amet, consectetuer</span><br />
Nam eu nulla. Donec lobortis purus vel urna. Nunc laoreet lacinia nunc. In volutpat sodales ipsum. Sed vestibulum. <a href="#" class="a">Integer in ante. Sed posuere ligula</a> rhoncus erat. Fusce urna dui, sollicitudin ac, pulvinar quis</td>
<td width="21" height="56" colspan="4" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/news-19.jpg" width="21" height="56" alt="" /></td>
<td width="164" height="56" colspan="4" align="left" valign="top" bgcolor="#EFEFEF" style="padding-top:5px"><p class="text1">September 29
</p>
<p><a href="#" class="a">Integer in ante. Sed posuere ligula </a>rhoncus erat. Fusce urna dui </p></td>
<td width="0" height="56" nowrap></td>
</tr>
<tr>
<td width="21" height="55" colspan="4" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF"><img src="images/news-20.jpg" width="21" height="55" alt="" /></td>
<td width="164" height="55" colspan="4" rowspan="3" align="left" valign="top" bgcolor="#EFEFEF" style="padding-top:5px"><span class="text1">September 28
</span><br />
<a href="#" class="a">Integer in ante. Sed posuere ligula</a> rhoncus erat. Fusce urna dui</td>
<td width="0" height="26" nowrap></td>
</tr>
<tr>
<td width="121" height="12" colspan="5" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="0" height="12" nowrap></td>
</tr>
<tr>
<td width="162" height="40" colspan="7" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/services.jpg" width="162" height="40" alt="" /></td>
<td width="221" height="40" colspan="6" rowspan="2" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="0" height="17" nowrap></td>
</tr>
<tr>
<td width="185" height="45" colspan="8" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/spotlight.jpg" width="185" height="45" alt="" /></td>
<td width="0" height="23" nowrap></td>
</tr>
<tr>
<td width="121" height="80" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/services-23.jpg" width="121" height="80" alt="" /></td>
<td width="10" height="80" rowspan="2" align="left" valign="top" nowrap bgcolor="#EFEFEF"></td>
<td width="252" height="80" colspan="7" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF"><span class="text1">Lorem ipsum dolor sit amet, consectetuer</span><br />
<a href="#" class="a">Nam eu nulla. Donec lobortis purus vel urna. Nunc </a>laoreet lacinia nunc. In volutpat sodales ipsum. Sed vestibulum. rhoncus erat. Fusce urna dui, sollicitudin ac, pulvinar quis</td>
<td width="0" height="22" nowrap></td>
</tr>
<tr>
<td width="16" height="115" colspan="3" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/spotlight-24.jpg" width="16" height="115" alt="" /></td>
<td width="169" height="115" colspan="5" rowspan="2" align="left" valign="top" bgcolor="#EFEFEF" style="line-height:18px; padding-top:3px"><a href="#" class="b">Morbi volutpat leo in ligula. Inter vel</a><br />
<a href="#" class="b">magna. sagittis. Fusce elit ligula, </a><br />
<a href="#" class="b">sodales sit amet, tincid unt in, Fusce </a><br />
<a href="#" class="b">interdum. Sed laoreet. Aenean. Sed </a><br />
l<a href="#" class="b">aoreet. magna. sagittis. Fusce elit</a></td>
<td width="0" height="58" nowrap></td>
</tr>
<tr>
<td width="27" height="57" colspan="2" align="left" valign="top" bgcolor="#EFEFEF">
<img src="images/services-25.jpg" width="27" height="57" alt="" /></td>
<td width="356" height="57" colspan="11" align="left" valign="top" bgcolor="#EFEFEF" style="line-height:18px; padding-top:8px"><a href="#" class="b">Morbi volutpat leo in ligula. Inter vel magna. sagittis. Fusce elit ligula, sodales </a><br />
<a href="#" class="b">sit amet, tincid unt in, Fusce interdum. Sed laoreet. Aenean. Sed laoreet. </a></td>
<td width="0" height="57" nowrap></td>
</tr>
<tr>
<td width="775" height="49" colspan="27" align="center" valign="middle" class="text2" style="background:url(images/b_footer.jpg)"><a href="index.html">HOME</a> | <a href="contentpage.html">ABOUT US</a> | <a href="contentpage.html">SERVICES</a> | <a href="contentpage.html">SOLUTIONS</a> | <a href="contentpage.html">SUPPORT</a> | <a href="contentpage.html">CONTACTS</a><br />
<span class="text3">Copyright © Your Company Name</span><br />
Design by <a href="http://www.templatesbox.com" target="_blank" class="adv">Templates</a> Box. Create a <a href="http://www.wix.com" target="_blank" class="adv">free website</a>.
</td>
<td width="0" height="49" nowrap></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>

View File

@@ -1,86 +1,86 @@
<!-- saved from url=(0022)http://internet.e-mail -->
<html>
<head>
<title>TemplatesBox.com | Terms of Use</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#5E717F" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="700" cellspacing="0" cellpadding="8" align="center" bgcolor="#BED5E2" style="border-collapse:collapse;">
<tr>
<td bgcolor="#567280" style="border-top-width:1px; border-right-width:1px; border-left-width:1px; border-top-color:rgb(216,216,216); border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-top-style:solid; border-right-style:solid; border-left-style:solid;"><font color="#C2DCEB" size="2" face="Verdana,Arial"><b>Templates</b></font><font color="#FF9900" size="2" face="Verdana,Arial"><b>Box</b></font><font color="#FF9B05" size="2" face="Verdana,Arial"><b>
</b></font><font color="#E3E3E3" size="2" face="Verdana,Arial">|<b> Terms of Use</b></font></td>
</tr>
<tr>
<td bgcolor="#A1BBCA" style="border-right-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-left-style:solid;">
<table align="center" cellpadding="0" cellspacing="0" width="98%">
<tr>
<td>
<p style="line-height:115%; margin-top:0; margin-bottom:0;"><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;">By
downloading a template from TemplatesBox.com you agree to the following
Terms of Use: </span></font>
<p style="line-height:115%; margin-top:0; margin-bottom:0;"><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;">Our
web templates may be used for your own and/or your clients' websites,
but you may not sell/offer for free our templates in any sort of collection,
such as distributing to a third party via CD, diskette, or letting others
to download off your websites etc.<br>
<br>
Link back to www.templatesbox.com is required and always appreciated.
Also, please visit the<br>
</span></font><a href="http://www.templatesbox.com/linkus.htm" target="_blank"><font face="Verdana,Arial" color="#354D59"><b><span style="font-size:8pt;">Link
Us</span></b></font></a><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;"> section.<br>
<br>
The templates are offered &quot;as is&quot; without warranty of any kind,
either expressed or implied. TemplatesBox.com will not be liable for any
damage or loss of data whatsoever due to downloading or using a template.
In no event shall TemplatesBox.com be liable for any damages including,
but not limited to, direct, indirect, special, incidental or consequential
damages or other losses arising out of the use of or inability to use
the templates and/or information from TemplatesBox.com.<br>
<br>
TemplatesBox.com team reserves the right to change or modify these terms
with no prior notice.</span></font></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#567280" style="border-right-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-left-style:solid;"><font size="2" face="Verdana,Arial" color="#E3E3E3"><b>Featured
Partners</b></font></td>
</tr>
<tr>
<td bgcolor="#A1BBCA" style="border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-bottom-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-bottom-style:solid; border-left-style:solid;" height="235">
<table align="center" cellpadding="0" cellspacing="0" width="98%">
<tr>
<td>
<p><a href="http://www.specialtemplates.com" target="_blank"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F">Premium Website
Templates</font></b></a><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
Over 9000 High-end Website templates, Flash intros and Logo templates.<b><a href="http://www.freshtemplates.com" target="_blank"><br>
<br>
</a></b></font><a href="http://www.freephotosbank.com" target="_blank"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F">Free
Photos, Free Stock Photography</font></b></a><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><b><br></b>
</font><FONT face=Verdana color=#2d444f size=2><FONT size=2><FONT
face=Verdana><FONT color=#2d444f>1000's of FREE high quality stock
Photos!</FONT></FONT></FONT></FONT><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
<br>
</font><A
href="http://www.webmasterschannel.com" target=_blank><FONT face=Verdana><FONT color=#2d444f><B><FONT size=2>Webmaster&nbsp;Resources &amp;
Directory</FONT></B></FONT></FONT></A><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
</font><FONT size=2><FONT face=Verdana><FONT color=#2d444f>A large web directory with webmaster
resources.</FONT></FONT></FONT><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
<br>
</font><A href="http://www.photovations.com"
target=_blank><FONT face=Verdana color=#000000
size=2><FONT face=Verdana color=#2d444f size=2><STRONG>Photovations.com</STRONG></FONT></FONT></A><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
</font><FONT face=Verdana color=#2d444f size=2><FONT size=2><FONT
face=Verdana><FONT color=#2d444f>Online Photo Sharing. Free Image
Hosting</FONT></FONT></FONT></FONT></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<!-- saved from url=(0022)http://internet.e-mail -->
<html>
<head>
<title>TemplatesBox.com | Terms of Use</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#5E717F" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="700" cellspacing="0" cellpadding="8" align="center" bgcolor="#BED5E2" style="border-collapse:collapse;">
<tr>
<td bgcolor="#567280" style="border-top-width:1px; border-right-width:1px; border-left-width:1px; border-top-color:rgb(216,216,216); border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-top-style:solid; border-right-style:solid; border-left-style:solid;"><font color="#C2DCEB" size="2" face="Verdana,Arial"><b>Templates</b></font><font color="#FF9900" size="2" face="Verdana,Arial"><b>Box</b></font><font color="#FF9B05" size="2" face="Verdana,Arial"><b>
</b></font><font color="#E3E3E3" size="2" face="Verdana,Arial">|<b> Terms of Use</b></font></td>
</tr>
<tr>
<td bgcolor="#A1BBCA" style="border-right-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-left-style:solid;">
<table align="center" cellpadding="0" cellspacing="0" width="98%">
<tr>
<td>
<p style="line-height:115%; margin-top:0; margin-bottom:0;"><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;">By
downloading a template from TemplatesBox.com you agree to the following
Terms of Use: </span></font>
<p style="line-height:115%; margin-top:0; margin-bottom:0;"><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;">Our
web templates may be used for your own and/or your clients' websites,
but you may not sell/offer for free our templates in any sort of collection,
such as distributing to a third party via CD, diskette, or letting others
to download off your websites etc.<br>
<br>
Link back to www.templatesbox.com is required and always appreciated.
Also, please visit the<br>
</span></font><a href="http://www.templatesbox.com/linkus.htm" target="_blank"><font face="Verdana,Arial" color="#354D59"><b><span style="font-size:8pt;">Link
Us</span></b></font></a><font face="Verdana,Arial" color="#354D59"><span style="font-size:8pt;"> section.<br>
<br>
The templates are offered &quot;as is&quot; without warranty of any kind,
either expressed or implied. TemplatesBox.com will not be liable for any
damage or loss of data whatsoever due to downloading or using a template.
In no event shall TemplatesBox.com be liable for any damages including,
but not limited to, direct, indirect, special, incidental or consequential
damages or other losses arising out of the use of or inability to use
the templates and/or information from TemplatesBox.com.<br>
<br>
TemplatesBox.com team reserves the right to change or modify these terms
with no prior notice.</span></font></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#567280" style="border-right-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-left-style:solid;"><font size="2" face="Verdana,Arial" color="#E3E3E3"><b>Featured
Partners</b></font></td>
</tr>
<tr>
<td bgcolor="#A1BBCA" style="border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-right-color:rgb(216,216,216); border-bottom-color:rgb(216,216,216); border-left-color:rgb(216,216,216); border-right-style:solid; border-bottom-style:solid; border-left-style:solid;" height="235">
<table align="center" cellpadding="0" cellspacing="0" width="98%">
<tr>
<td>
<p><a href="http://www.specialtemplates.com" target="_blank"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F">Premium Website
Templates</font></b></a><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
Over 9000 High-end Website templates, Flash intros and Logo templates.<b><a href="http://www.freshtemplates.com" target="_blank"><br>
<br>
</a></b></font><a href="http://www.freephotosbank.com" target="_blank"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F">Free
Photos, Free Stock Photography</font></b></a><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><b><br></b>
</font><FONT face=Verdana color=#2d444f size=2><FONT size=2><FONT
face=Verdana><FONT color=#2d444f>1000's of FREE high quality stock
Photos!</FONT></FONT></FONT></FONT><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
<br>
</font><A
href="http://www.webmasterschannel.com" target=_blank><FONT face=Verdana><FONT color=#2d444f><B><FONT size=2>Webmaster&nbsp;Resources &amp;
Directory</FONT></B></FONT></FONT></A><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
</font><FONT size=2><FONT face=Verdana><FONT color=#2d444f>A large web directory with webmaster
resources.</FONT></FONT></FONT><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
<br>
</font><A href="http://www.photovations.com"
target=_blank><FONT face=Verdana color=#000000
size=2><FONT face=Verdana color=#2d444f size=2><STRONG>Photovations.com</STRONG></FONT></FONT></A><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#2D444F"><br>
</font><FONT face=Verdana color=#2d444f size=2><FONT size=2><FONT
face=Verdana><FONT color=#2d444f>Online Photo Sharing. Free Image
Hosting</FONT></FONT></FONT></FONT></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -1,9 +1,9 @@
<html>
<body>
<h2>Norwegian Mountain Trip</h2>
<img border="0" src="images/pulpit.jpg" alt="Pulpit rock" width="304" height="228" />
</body>
</html>
<html>
<body>
<h2>Norwegian Mountain Trip</h2>
<img border="0" src="images/pulpit.jpg" alt="Pulpit rock" width="304" height="228" />
</body>
</html>

View File

@@ -1,10 +1,10 @@
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

View File

@@ -1,99 +1,99 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8 />
<meta name="viewport" content="width=620" />
<title>HTML5 Demo: data-*</title>
<link rel="stylesheet" href="/css/html5demos.css" type="text/css" />
<script src="/js/h5utils.js"></script></head>
<body>
<section id="wrapper">
<header>
<h1>data-*</h1>
</header><style>
#test {
padding: 10px;
border: 1px solid #ccc;
margin: 20px 0;
}
pre {
overflow-x: auto;
padding: 10px;
border: 1px dashed #ccc;
background: #fff;
font-size: 12px;
}
</style>
<article>
<section>
<p>The <code>data-[name]</code> attribute on elements can now be accessed directly via the DOM using <code>element.dataset.[attr]</code>.</p>
<p>Try openning the Web Console and editing <code>element.dataset</code> directly: <br /><code>element.dataset.foo = 'bar';</code></p>
</section>
<p id="status">Not connected</p>
<section>
<div id="test" data-name="rem" data-height="short">This element has data</div>
<input type="button" value="Show data" id="show" />
<input type="button" value="Change data via dataset" id="change1" />
<input type="button" value="change data via setAttribute" id="change2" />
</section>
<pre><code id="element">[click buttons above to show element html]</code></pre>
</article>
<script>
(function () {
function show() {
code.innerHTML = test.outerHTML.replace(/[<>]/g, function (m) {
return { '<': '<', '>': '>' }[m];
});
for (var prop in test.dataset) {
code.innerHTML += '\nel.dataset.' + prop + ' = "' + test.dataset[prop] + '"';
}
}
var state = document.getElementById('status'),
code = document.getElementById('element');
var test = window.element = document.getElementById('test');
if (test.dataset === undefined) {
state.innerHTML = 'dataset not supported';
state.className = 'fail';
} else {
state.className = 'success';
state.innerHTML = 'element.dataset supported';
}
addEvent(document.getElementById('show'), 'click', function () {
show();
});
addEvent(document.getElementById('change1'), 'click', function () {
test.dataset.name = 'via el.dataset';
show();
});
addEvent(document.getElementById('change2'), 'click', function () {
test.setAttribute('data-name', 'via setAttribute');
show();
});
})();
</script>
<footer><a href="/">HTML5 demos</a>/<a id="built" href="http://twitter.com/rem">@rem built this</a>/<a href="#view-source">view source</a></footer>
</section>
<a href="http://github.com/remy/html5demos"><img style="position: absolute; top: 0; left: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub" /></a>
<script src="/js/prettify.packed.js"></script>
<script>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script>
try {
var pageTracker = _gat._getTracker("UA-1656750-18");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8 />
<meta name="viewport" content="width=620" />
<title>HTML5 Demo: data-*</title>
<link rel="stylesheet" href="/css/html5demos.css" type="text/css" />
<script src="/js/h5utils.js"></script></head>
<body>
<section id="wrapper">
<header>
<h1>data-*</h1>
</header><style>
#test {
padding: 10px;
border: 1px solid #ccc;
margin: 20px 0;
}
pre {
overflow-x: auto;
padding: 10px;
border: 1px dashed #ccc;
background: #fff;
font-size: 12px;
}
</style>
<article>
<section>
<p>The <code>data-[name]</code> attribute on elements can now be accessed directly via the DOM using <code>element.dataset.[attr]</code>.</p>
<p>Try openning the Web Console and editing <code>element.dataset</code> directly: <br /><code>element.dataset.foo = 'bar';</code></p>
</section>
<p id="status">Not connected</p>
<section>
<div id="test" data-name="rem" data-height="short">This element has data</div>
<input type="button" value="Show data" id="show" />
<input type="button" value="Change data via dataset" id="change1" />
<input type="button" value="change data via setAttribute" id="change2" />
</section>
<pre><code id="element">[click buttons above to show element html]</code></pre>
</article>
<script>
(function () {
function show() {
code.innerHTML = test.outerHTML.replace(/[<>]/g, function (m) {
return { '<': '<', '>': '>' }[m];
});
for (var prop in test.dataset) {
code.innerHTML += '\nel.dataset.' + prop + ' = "' + test.dataset[prop] + '"';
}
}
var state = document.getElementById('status'),
code = document.getElementById('element');
var test = window.element = document.getElementById('test');
if (test.dataset === undefined) {
state.innerHTML = 'dataset not supported';
state.className = 'fail';
} else {
state.className = 'success';
state.innerHTML = 'element.dataset supported';
}
addEvent(document.getElementById('show'), 'click', function () {
show();
});
addEvent(document.getElementById('change1'), 'click', function () {
test.dataset.name = 'via el.dataset';
show();
});
addEvent(document.getElementById('change2'), 'click', function () {
test.setAttribute('data-name', 'via setAttribute');
show();
});
})();
</script>
<footer><a href="/">HTML5 demos</a>/<a id="built" href="http://twitter.com/rem">@rem built this</a>/<a href="#view-source">view source</a></footer>
</section>
<a href="http://github.com/remy/html5demos"><img style="position: absolute; top: 0; left: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub" /></a>
<script src="/js/prettify.packed.js"></script>
<script>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script>
try {
var pageTracker = _gat._getTracker("UA-1656750-18");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>

View File

@@ -1,149 +1,149 @@
note
description: "Summary description for {HTTP_CONSTANTS}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
HTTP_CONSTANTS
feature
http_version_1_1: STRING = "HTTP/1.1"
http_version_1_0: STRING = "HTTP/1.0"
crlf: STRING = "%/13/%/10/"
feature -- Status codes
-- 1xx Informational -Request received, continuing process
Continue : STRING = "100"
Switching_Protocols : STRING = "101"
-- 2xx Success - The action was successfully received, understood, and accepted
Ok: STRING = "200"
Created : STRING = "201"
Accepted : STRING = "202"
Non_Authoritative_Information : STRING = "203"
No_Content : STRING = "204"
Reset_Content : STRING = "205"
Parcial_Content : STRING = "206"
-- 3xx Redirection - Further Action must be taken in order to complete the request
Multiple_Choices : STRING = "300"
Moved_Permanently: STRING = "301"
Found : STRING = "302"
See_Other : STRING = "303"
Not_Modified : STRING = "304"
Use_Proxy : STRING = "305"
Temporary_Redirect : STRING = "307"
--4xx Client Error - The request contains bad syntax or cannot be fulfilled
Bad_Request : STRING = "400"
Unauthorized : STRING = "401"
Payment_Required : STRING = "402"
Forbidden : STRING = "403"
Not_Found : STRING = "404"
Method_Not_Allowed : STRING = "405"
Not_Acceptable : STRING = "406"
Proxy_Authentication_Required : STRING = "407"
Request_Time_out : STRING = "408"
Conflict : STRING = "409"
Gone : STRING = "410"
Length_Required : STRING = "411"
Precondition_Failed : STRING = "412"
Request_Entity_Too_Large : STRING = "413"
Request_URI_Too_Large : STRING = "414"
Unsupported_Media_Type : STRING = "415"
Requested_range_not_satisfiable : STRING = "416"
Expectation_Failed : STRING = "417"
--5xx Server Error - The server failed to fulfill an apparently valid request
server_error: STRING = "500"
Internal_Server_Error : STRING = "500"
Not_Implemented : STRING = "501"
Bad_Gateway : STRING = "502"
Service_Unavailable : STRING = "503"
Gateway_Time_out : STRING = "504"
HTTP_Version_not_supported : STRING = "505"
-- messages
ok_message: STRING = "OK"
continue_message : STRING = "Continue"
not_found_message: STRING = "URI not found"
not_implemented_message: STRING = "Not Implemented"
feature -- content types
text_html: STRING = "text/html"
feature -- General Header Fields
-- There are a few header fields which have general applicability for both request and response messages,
-- but which do not apply to the entity being transferred.
-- These header fields apply only to the message being transmitted.
Cache_control : STRING = "Cache-Control"
Connection : STRING = "Connection"
Date : STRING = "Date"
Pragma : STRING = "PRAGMA"
Trailer : STRING = "Trailer"
Transfer_encoding : STRING = "Transfer-Encoding"
Upgrade : STRING = "Upgrade"
Via : STRING = "Via"
Warning : STRING = "Warning"
feature -- Request Header
Accept : STRING = "Accept"
Accept_charset : STRING = "Accept-Charset"
Accept_encoding : STRING = "Accept-Encoding"
Accept_language : STRING = "Accept-Language"
Authorization : STRING = "Authorization"
Expect : STRING = "Expect"
From_header : STRING = "From"
Host : STRING = "Host"
If_match : STRING = "If-Match"
If_modified_since : STRING = "If-Modified-Since"
If_none_match : STRING = "If-None-Match"
If_range : STRING = "If-Range"
If_unmodified_since : STRING = "If-Unmodified-Since"
Max_forwards : STRING = "Max-Forwards"
Proxy_authorization : STRING = "Proxy-Authorization"
Range : STRING = "Range"
Referer : STRING = "Referrer"
TE : STRING = "TE"
User_agent : STRING = "User-Agent"
feature -- Entity Header
Allow : STRING = "Allow"
Content_encoding : STRING = "Content-Encoding"
Content_language : STRING = "Content-Language"
Content_length : STRING = "Content-Length"
Content_location : STRING = "Content-Location"
Content_MD5 : STRING = "Content-MD5"
Content_range : STRING = "Content-Range"
Content_type : STRING = "Content-Type"
Expires : STRING = "Expires"
Last_modified : STRING = "Last-Modified"
feature -- Http Method
Options : STRING = "OPTIONS"
Get : STRING = "GET"
Head : STRING = "HEAD"
Post : STRING = "POST"
Put : STRING = "PUT"
Delete : STRING = "DELETE"
Trace : STRING = "TRACE"
Connect : STRING = "CONNECT"
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end
note
description: "Summary description for {HTTP_CONSTANTS}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
HTTP_CONSTANTS
feature
http_version_1_1: STRING = "HTTP/1.1"
http_version_1_0: STRING = "HTTP/1.0"
crlf: STRING = "%/13/%/10/"
feature -- Status codes
-- 1xx Informational -Request received, continuing process
Continue : STRING = "100"
Switching_Protocols : STRING = "101"
-- 2xx Success - The action was successfully received, understood, and accepted
Ok: STRING = "200"
Created : STRING = "201"
Accepted : STRING = "202"
Non_Authoritative_Information : STRING = "203"
No_Content : STRING = "204"
Reset_Content : STRING = "205"
Parcial_Content : STRING = "206"
-- 3xx Redirection - Further Action must be taken in order to complete the request
Multiple_Choices : STRING = "300"
Moved_Permanently: STRING = "301"
Found : STRING = "302"
See_Other : STRING = "303"
Not_Modified : STRING = "304"
Use_Proxy : STRING = "305"
Temporary_Redirect : STRING = "307"
--4xx Client Error - The request contains bad syntax or cannot be fulfilled
Bad_Request : STRING = "400"
Unauthorized : STRING = "401"
Payment_Required : STRING = "402"
Forbidden : STRING = "403"
Not_Found : STRING = "404"
Method_Not_Allowed : STRING = "405"
Not_Acceptable : STRING = "406"
Proxy_Authentication_Required : STRING = "407"
Request_Time_out : STRING = "408"
Conflict : STRING = "409"
Gone : STRING = "410"
Length_Required : STRING = "411"
Precondition_Failed : STRING = "412"
Request_Entity_Too_Large : STRING = "413"
Request_URI_Too_Large : STRING = "414"
Unsupported_Media_Type : STRING = "415"
Requested_range_not_satisfiable : STRING = "416"
Expectation_Failed : STRING = "417"
--5xx Server Error - The server failed to fulfill an apparently valid request
server_error: STRING = "500"
Internal_Server_Error : STRING = "500"
Not_Implemented : STRING = "501"
Bad_Gateway : STRING = "502"
Service_Unavailable : STRING = "503"
Gateway_Time_out : STRING = "504"
HTTP_Version_not_supported : STRING = "505"
-- messages
ok_message: STRING = "OK"
continue_message : STRING = "Continue"
not_found_message: STRING = "URI not found"
not_implemented_message: STRING = "Not Implemented"
feature -- content types
text_html: STRING = "text/html"
feature -- General Header Fields
-- There are a few header fields which have general applicability for both request and response messages,
-- but which do not apply to the entity being transferred.
-- These header fields apply only to the message being transmitted.
Cache_control : STRING = "Cache-Control"
Connection : STRING = "Connection"
Date : STRING = "Date"
Pragma : STRING = "PRAGMA"
Trailer : STRING = "Trailer"
Transfer_encoding : STRING = "Transfer-Encoding"
Upgrade : STRING = "Upgrade"
Via : STRING = "Via"
Warning : STRING = "Warning"
feature -- Request Header
Accept : STRING = "Accept"
Accept_charset : STRING = "Accept-Charset"
Accept_encoding : STRING = "Accept-Encoding"
Accept_language : STRING = "Accept-Language"
Authorization : STRING = "Authorization"
Expect : STRING = "Expect"
From_header : STRING = "From"
Host : STRING = "Host"
If_match : STRING = "If-Match"
If_modified_since : STRING = "If-Modified-Since"
If_none_match : STRING = "If-None-Match"
If_range : STRING = "If-Range"
If_unmodified_since : STRING = "If-Unmodified-Since"
Max_forwards : STRING = "Max-Forwards"
Proxy_authorization : STRING = "Proxy-Authorization"
Range : STRING = "Range"
Referer : STRING = "Referrer"
TE : STRING = "TE"
User_agent : STRING = "User-Agent"
feature -- Entity Header
Allow : STRING = "Allow"
Content_encoding : STRING = "Content-Encoding"
Content_language : STRING = "Content-Language"
Content_length : STRING = "Content-Length"
Content_location : STRING = "Content-Location"
Content_MD5 : STRING = "Content-MD5"
Content_range : STRING = "Content-Range"
Content_type : STRING = "Content-Type"
Expires : STRING = "Expires"
Last_modified : STRING = "Last-Modified"
feature -- Http Method
Options : STRING = "OPTIONS"
Get : STRING = "GET"
Head : STRING = "HEAD"
Post : STRING = "POST"
Put : STRING = "PUT"
Delete : STRING = "DELETE"
Trace : STRING = "TRACE"
Connect : STRING = "CONNECT"
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,60 +1,60 @@
note
description: "[
Provides features to encode and decode messages
]"
legal: "See notice at end of class."
status: "Community Preview 1.0"
date: "$Date: 2009-09-01 19:15:37 -0300 (mar 01 de sep de 2009) $"
revision: "$Revision: 80577 $"
class
HTTP_ENCODING_FACILITIES
create
make
feature -- Initialization
make
do
end
feature -- Conversion
encode_natural(a_i: NATURAL; a_is_fragmented: BOOLEAN): NATURAL
-- Leftshift of the natural (don't use numbers >= 2^31) and subsequent append of the flag bit.
-- Use decode_natural and decode_flag for decoding.
require
no_too_big: a_i < 2147483648
do
Result := (a_i |<< 1) + a_is_fragmented.to_integer.as_natural_32
end
change_flag(a_i: NATURAL; a_new_flag: BOOLEAN): NATURAL
-- Changes the flag to "new_flag" and doesn't change the encoded natural.
do
Result := (a_i & 0xFFFFFFFE) + a_new_flag.to_integer.as_natural_32
end
decode_natural_and_flag (a_i: NATURAL): TUPLE [NATURAL, BOOLEAN]
-- Convenience feature which combines both decodings (natural and flag)
do
Result := [decode_natural (a_i), decode_flag (a_i)]
end
decode_natural (a_i: NATURAL): NATURAL
-- The natural that was encoded in {ENCODING_FACILITIES}.encode_natural.
do
Result := (a_i |>> 1)
end
decode_flag (a_i: NATURAL): BOOLEAN
--`Result': the flag that was encoded in encode_natural
do
Result := (a_i.bit_and (1) = 1)
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end
note
description: "[
Provides features to encode and decode messages
]"
legal: "See notice at end of class."
status: "Community Preview 1.0"
date: "$Date: 2009-09-01 19:15:37 -0300 (mar 01 de sep de 2009) $"
revision: "$Revision: 80577 $"
class
HTTP_ENCODING_FACILITIES
create
make
feature -- Initialization
make
do
end
feature -- Conversion
encode_natural(a_i: NATURAL; a_is_fragmented: BOOLEAN): NATURAL
-- Leftshift of the natural (don't use numbers >= 2^31) and subsequent append of the flag bit.
-- Use decode_natural and decode_flag for decoding.
require
no_too_big: a_i < 2147483648
do
Result := (a_i |<< 1) + a_is_fragmented.to_integer.as_natural_32
end
change_flag(a_i: NATURAL; a_new_flag: BOOLEAN): NATURAL
-- Changes the flag to "new_flag" and doesn't change the encoded natural.
do
Result := (a_i & 0xFFFFFFFE) + a_new_flag.to_integer.as_natural_32
end
decode_natural_and_flag (a_i: NATURAL): TUPLE [NATURAL, BOOLEAN]
-- Convenience feature which combines both decodings (natural and flag)
do
Result := [decode_natural (a_i), decode_flag (a_i)]
end
decode_natural (a_i: NATURAL): NATURAL
-- The natural that was encoded in {ENCODING_FACILITIES}.encode_natural.
do
Result := (a_i |>> 1)
end
decode_flag (a_i: NATURAL): BOOLEAN
--`Result': the flag that was encoded in encode_natural
do
Result := (a_i.bit_and (1) = 1)
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,56 +1,56 @@
note
description: "Summary description for {HTTP_SERVER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
HTTP_SERVER
create
make
feature -- Initialization
make (cfg: like configuration)
do
configuration := cfg
end
setup (a_http_handler: HTTP_HANDLER)
require
a_http_handler_valid: a_http_handler /= Void
do
if configuration.is_verbose then
log ("%N%N%N")
log ("Starting Web Application Server (port="+ configuration.http_server_port.out +"):%N")
end
stop_requested := False
a_http_handler.execute
end
shutdown_server
do
stop_requested := True
end
feature -- Access
configuration: HTTP_SERVER_CONFIGURATION
-- Configuration of the server
stop_requested: BOOLEAN
-- Stops the server
feature -- Output
log (a_message: READABLE_STRING_8)
-- Log `a_message'
do
io.put_string (a_message)
end
;note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end
note
description: "Summary description for {HTTP_SERVER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
HTTP_SERVER
create
make
feature -- Initialization
make (cfg: like configuration)
do
configuration := cfg
end
setup (a_http_handler: HTTP_HANDLER)
require
a_http_handler_valid: a_http_handler /= Void
do
if configuration.is_verbose then
log ("%N%N%N")
log ("Starting Web Application Server (port="+ configuration.http_server_port.out +"):%N")
end
stop_requested := False
a_http_handler.execute
end
shutdown_server
do
stop_requested := True
end
feature -- Access
configuration: HTTP_SERVER_CONFIGURATION
-- Configuration of the server
stop_requested: BOOLEAN
-- Stops the server
feature -- Output
log (a_message: READABLE_STRING_8)
-- Log `a_message'
do
io.put_string (a_message)
end
;note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,118 +1,118 @@
deferred class HTTP_REQUEST_HANDLER
inherit
ANY
redefine
default_create
end
feature {NONE} -- Initialization
default_create
do
Precursor
create request_uri.make_empty
create script_name.make_empty
create query_string.make_empty
create answer
create headers.make (0)
end
feature -- Access
request_uri: STRING
-- requested url
script_name: STRING
-- Script name
query_string: STRING
-- Query string
data: detachable STRING
-- the entire request message
headers : HASH_TABLE [STRING, STRING]
-- Provides access to the request's HTTP headers, for example:
-- headers["Content-Type"] is "text/plain"
answer: HTTP_RESPONSE
-- reply to this request
feature -- Execution
process
-- process the request and create an answer
require
valid_uri: request_uri /= Void
deferred
end
feature -- Recycle
reset
-- reinit the fields
do
request_uri.wipe_out
script_name.wipe_out
query_string.wipe_out
data := Void
answer.reset
end
feature -- Element change
set_uri (new_uri: STRING)
-- set new URI
require
valid_uri: new_uri /= Void
local
p: INTEGER
do
request_uri := new_uri
p := new_uri.index_of ('?', 1)
if p > 0 then
script_name := new_uri.substring (1, p - 1)
query_string := new_uri.substring (p + 1, new_uri.count)
else
script_name := new_uri.string
query_string := ""
end
end
set_data (new_data: STRING)
-- set new data
do
data := new_data
end
set_headers ( a_header : HASH_TABLE [STRING, STRING] )
do
headers := a_header
end
feature {NONE} -- Implementation
real_filename (fn: STRING): STRING
-- Real filename from url-path `fn'
--| Find a better design for this piece of code
--| Eventually in a spec/$ISE_PLATFORM/ specific cluster
do
if {PLATFORM}.is_windows then
create Result.make_from_string (fn)
Result.replace_substring_all ("/", "\")
if Result[Result.count] = '\' then
Result.remove_tail (1)
end
else
Result := fn
if Result[Result.count] = '/' then
Result := Result.substring (1, Result.count - 1)
end
end
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end
deferred class HTTP_REQUEST_HANDLER
inherit
ANY
redefine
default_create
end
feature {NONE} -- Initialization
default_create
do
Precursor
create request_uri.make_empty
create script_name.make_empty
create query_string.make_empty
create answer
create headers.make (0)
end
feature -- Access
request_uri: STRING
-- requested url
script_name: STRING
-- Script name
query_string: STRING
-- Query string
data: detachable STRING
-- the entire request message
headers : HASH_TABLE [STRING, STRING]
-- Provides access to the request's HTTP headers, for example:
-- headers["Content-Type"] is "text/plain"
answer: HTTP_RESPONSE
-- reply to this request
feature -- Execution
process
-- process the request and create an answer
require
valid_uri: request_uri /= Void
deferred
end
feature -- Recycle
reset
-- reinit the fields
do
request_uri.wipe_out
script_name.wipe_out
query_string.wipe_out
data := Void
answer.reset
end
feature -- Element change
set_uri (new_uri: STRING)
-- set new URI
require
valid_uri: new_uri /= Void
local
p: INTEGER
do
request_uri := new_uri
p := new_uri.index_of ('?', 1)
if p > 0 then
script_name := new_uri.substring (1, p - 1)
query_string := new_uri.substring (p + 1, new_uri.count)
else
script_name := new_uri.string
query_string := ""
end
end
set_data (new_data: STRING)
-- set new data
do
data := new_data
end
set_headers ( a_header : HASH_TABLE [STRING, STRING] )
do
headers := a_header
end
feature {NONE} -- Implementation
real_filename (fn: STRING): STRING
-- Real filename from url-path `fn'
--| Find a better design for this piece of code
--| Eventually in a spec/$ISE_PLATFORM/ specific cluster
do
if {PLATFORM}.is_windows then
create Result.make_from_string (fn)
Result.replace_substring_all ("/", "\")
if Result[Result.count] = '\' then
Result.remove_tail (1)
end
else
Result := fn
if Result[Result.count] = '/' then
Result := Result.substring (1, Result.count - 1)
end
end
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,147 +1,147 @@
class HTTP_RESPONSE
inherit
HTTP_CONSTANTS
redefine
default_create
end
create
default_create
feature -- creation
default_create
do
Precursor
set_defaults
end
set_defaults
-- Set default values for the reply
do
status_code := ok
create content_length_data.make_empty
reason_phrase := ok_message
content_type_data := text_html
set_reply_text (Void)
end
feature -- Recycle
reset
do
set_defaults
end
feature -- response header fields
status_code: STRING
-- status
content_length_data : STRING
-- length
reason_phrase: STRING
-- message, if any
content_type_data: STRING
-- type of content in this reply (eg. text/html)
feature -- Element change
set_content_length (new_content_length: INTEGER)
require
positive_or_zero: new_content_length >= 0
do
content_length_data := new_content_length.out
end
set_status_code (new_status_code: STRING)
require
not_void: new_status_code /= Void
do
status_code := new_status_code
end
set_reason_phrase (new_reason_phrase: STRING)
require
not_void: new_reason_phrase /= Void
do
reason_phrase := new_reason_phrase
end
set_content_type (new_content_type: STRING)
require
not_void: new_content_type /= Void
do
content_type_data := new_content_type
end
feature -- Access: send reply
reply_header: STRING
-- header
do
Result := http_version_1_1.twin
Result.extend (' ')
Result.append (status_code)
Result.extend (' ')
Result.append (reason_phrase)
Result.append (crlf)
Result.append ({HTTP_SERVER_CONFIGURATION}.Server_details)
Result.append (crlf)
Result.append (Content_type + ": ")
Result.append (content_type_data)
Result.append (crlf)
Result.append (Content_length + ": ")
Result.append (content_length_data)
Result.append (crlf)
Result.append (crlf)
-- TODO: could add the size of data being sent here and
-- then keep the connection alive
end
reply_header_continue: STRING
-- header
do
Result := http_version_1_1.twin
Result.extend (' ')
Result.append (status_code)
Result.extend (' ')
Result.append (continue_message)
Result.append (crlf)
Result.append (crlf)
-- TODO: could add the size of data being sent here and
-- then keep the connection alive
end
reply_text: STRING
-- reply text
feature -- Change element: send reply
set_reply_text (new_text: detachable STRING)
-- text could be Void
do
if new_text = Void then
create reply_text.make_empty
else
reply_text := new_text
end
end
append_reply_text (more_text: STRING)
-- add more text to the reply
require
reply_text /= Void
more_text /= Void
do
reply_text.append (more_text)
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end
class HTTP_RESPONSE
inherit
HTTP_CONSTANTS
redefine
default_create
end
create
default_create
feature -- creation
default_create
do
Precursor
set_defaults
end
set_defaults
-- Set default values for the reply
do
status_code := ok
create content_length_data.make_empty
reason_phrase := ok_message
content_type_data := text_html
set_reply_text (Void)
end
feature -- Recycle
reset
do
set_defaults
end
feature -- response header fields
status_code: STRING
-- status
content_length_data : STRING
-- length
reason_phrase: STRING
-- message, if any
content_type_data: STRING
-- type of content in this reply (eg. text/html)
feature -- Element change
set_content_length (new_content_length: INTEGER)
require
positive_or_zero: new_content_length >= 0
do
content_length_data := new_content_length.out
end
set_status_code (new_status_code: STRING)
require
not_void: new_status_code /= Void
do
status_code := new_status_code
end
set_reason_phrase (new_reason_phrase: STRING)
require
not_void: new_reason_phrase /= Void
do
reason_phrase := new_reason_phrase
end
set_content_type (new_content_type: STRING)
require
not_void: new_content_type /= Void
do
content_type_data := new_content_type
end
feature -- Access: send reply
reply_header: STRING
-- header
do
Result := http_version_1_1.twin
Result.extend (' ')
Result.append (status_code)
Result.extend (' ')
Result.append (reason_phrase)
Result.append (crlf)
Result.append ({HTTP_SERVER_CONFIGURATION}.Server_details)
Result.append (crlf)
Result.append (Content_type + ": ")
Result.append (content_type_data)
Result.append (crlf)
Result.append (Content_length + ": ")
Result.append (content_length_data)
Result.append (crlf)
Result.append (crlf)
-- TODO: could add the size of data being sent here and
-- then keep the connection alive
end
reply_header_continue: STRING
-- header
do
Result := http_version_1_1.twin
Result.extend (' ')
Result.append (status_code)
Result.extend (' ')
Result.append (continue_message)
Result.append (crlf)
Result.append (crlf)
-- TODO: could add the size of data being sent here and
-- then keep the connection alive
end
reply_text: STRING
-- reply text
feature -- Change element: send reply
set_reply_text (new_text: detachable STRING)
-- text could be Void
do
if new_text = Void then
create reply_text.make_empty
else
reply_text := new_text
end
end
append_reply_text (more_text: STRING)
-- add more text to the reply
require
reply_text /= Void
more_text /= Void
do
reply_text.append (more_text)
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,18 +1,18 @@
note
description: "Summary description for {SHARED_URI_CONTENTS_TYPES}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
SHARED_URI_CONTENTS_TYPES
feature
ct_table: URI_CONTENTS_TYPES
once
create Result.make
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end
note
description: "Summary description for {SHARED_URI_CONTENTS_TYPES}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
SHARED_URI_CONTENTS_TYPES
feature
ct_table: URI_CONTENTS_TYPES
once
create Result.make
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,82 +0,0 @@
note
description: "Summary description for {TCP_STREAM_SOCKET}."
date: "$Date: 2015-02-16 19:53:13 +0100 (lun., 16 févr. 2015) $"
revision: "$Revision: 96642 $"
class
TCP_STREAM_SOCKET
inherit
NETWORK_STREAM_SOCKET
redefine
make
end
create
make_server_by_address_and_port,
make_server_by_port
create {NETWORK_STREAM_SOCKET}
make_from_descriptor_and_address
feature {NONE} -- Initialization
make
-- Create a network stream socket.
do
Precursor
set_reuse_address
end
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
-- Create server socket on `an_address' and `a_port'.
require
valid_port: a_port >= 0
do
make
create address.make_from_address_and_port (an_address, a_port)
bind
end
feature -- Basic operation
send_message (a_msg: STRING)
local
a_package : PACKET
a_data : MANAGED_POINTER
c_string : C_STRING
do
create c_string.make (a_msg)
create a_data.make_from_pointer (c_string.item, a_msg.count + 1)
create a_package.make_from_managed_pointer (a_data)
send (a_package, 1)
end
feature -- Output
put_readable_string_8 (s: READABLE_STRING_8)
-- Write readable string `s' to socket.
local
ext: C_STRING
do
create ext.make (s)
put_managed_pointer (ext.managed_data, 0, s.count)
end
feature -- Status report
try_ready_for_reading: BOOLEAN
-- Is data available for reading from the socket right now?
require
socket_exists: exists
local
retval: INTEGER
do
retval := c_select_poll_with_timeout (descriptor, True, 0)
Result := (retval > 0)
end
note
copyright: "2011-2015, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,83 +1,72 @@
note
description: "Summary description for {TCP_STREAM_SOCKET}."
date: "$Date$"
revision: "$Revision$"
class
TCP_STREAM_SOCKET
inherit
NETWORK_STREAM_SOCKET
redefine
make
end
create
make_server_by_address_and_port,
make_server_by_port
create {NETWORK_STREAM_SOCKET}
make_from_descriptor_and_address,
make_empty
feature {NONE} -- Initialization
make
-- Create a network stream socket.
do
Precursor
set_reuse_address
end
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
-- Create server socket on `an_address' and `a_port'.
require
valid_port: a_port >= 0
do
make
create address.make_from_address_and_port (an_address, a_port)
bind
end
feature -- Basic operation
send_message (a_msg: STRING)
local
a_package : PACKET
a_data : MANAGED_POINTER
c_string : C_STRING
do
create c_string.make (a_msg)
create a_data.make_from_pointer (c_string.item, a_msg.count + 1)
create a_package.make_from_managed_pointer (a_data)
send (a_package, 1)
end
feature -- Output
put_readable_string_8 (s: READABLE_STRING_8)
-- Write readable string `s' to socket.
local
ext: C_STRING
do
create ext.make (s)
put_managed_pointer (ext.managed_data, 0, s.count)
end
feature -- Status report
try_ready_for_reading: BOOLEAN
-- Is data available for reading from the socket right now?
require
socket_exists: exists
local
retval: INTEGER
do
retval := c_select_poll_with_timeout (descriptor, True, 0)
Result := (retval > 0)
end
note
copyright: "2011-2015, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end
note
description: "Summary description for {TCP_STREAM_SOCKET}."
date: "$Date$"
revision: "$Revision$"
class
TCP_STREAM_SOCKET
inherit
NETWORK_STREAM_SOCKET
create
make_server_by_address_and_port,
make_server_by_port
create {NETWORK_STREAM_SOCKET}
make_from_descriptor_and_address
feature {NONE} -- Initialization
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
-- Create server socket on `an_address' and `a_port'.
require
valid_port: a_port >= 0
do
make
create address.make_from_address_and_port (an_address, a_port)
bind
end
feature -- Basic operation
send_message (a_msg: STRING)
local
a_package : PACKET
a_data : MANAGED_POINTER
c_string : C_STRING
do
create c_string.make (a_msg)
create a_data.make_from_pointer (c_string.item, a_msg.count + 1)
create a_package.make_from_managed_pointer (a_data)
send (a_package, 1)
end
feature -- Output
put_readable_string_8 (s: READABLE_STRING_8)
-- Write readable string `s' to socket.
local
ext: C_STRING
do
create ext.make (s)
put_managed_pointer (ext.managed_data, 0, s.count)
end
feature -- Status report
try_ready_for_reading: BOOLEAN
-- Is data available for reading from the socket right now?
require
socket_exists: exists
local
retval: INTEGER
do
retval := c_select_poll_with_timeout (descriptor, True, 0)
Result := (retval > 0)
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,91 +1,91 @@
class URI_CONTENTS_TYPES
create
make
feature
content_types: HASH_TABLE [STRING, STRING]
extension (uri: STRING): STRING
-- extract extendion from a URI
local
i: INTEGER
do
-- going from the end find the position of the "."
from
i := uri.count
until
i = 0 or else uri.item (i) = '.'
loop
i := i - 1
end
Result := uri.substring (i+1, uri.count)
end
feature {NONE}
make
do
create content_types.make (30)
content_types.put ("text/html", "html")
content_types.put ("text/html", "htm")
content_types.put ("image/gif", "gif")
content_types.put ("image/jpeg", "jpeg")
content_types.put ("image/png", "jpg")
content_types.put ("image/png", "png")
end
feature -- Access: Encoding
urlencode (s: STRING): STRING
-- URL encode `s'
do
Result := s.string
Result.replace_substring_all ("#", "%%23")
Result.replace_substring_all (" ", "%%20")
Result.replace_substring_all ("%T", "%%09")
Result.replace_substring_all ("%N", "%%0A")
Result.replace_substring_all ("/", "%%2F")
Result.replace_substring_all ("&", "%%26")
Result.replace_substring_all ("<", "%%3C")
Result.replace_substring_all ("=", "%%3D")
Result.replace_substring_all (">", "%%3E")
Result.replace_substring_all ("%"", "%%22")
Result.replace_substring_all ("%'", "%%27")
end
urldecode (s: STRING): STRING
-- URL decode `s'
do
Result := s.string
Result.replace_substring_all ("%%23", "#")
Result.replace_substring_all ("%%20", " ")
Result.replace_substring_all ("%%09", "%T")
Result.replace_substring_all ("%%0A", "%N")
Result.replace_substring_all ("%%2F", "/")
Result.replace_substring_all ("%%26", "&")
Result.replace_substring_all ("%%3C", "<")
Result.replace_substring_all ("%%3D", "=")
Result.replace_substring_all ("%%3E", ">")
Result.replace_substring_all ("%%22", "%"")
Result.replace_substring_all ("%%27", "%'")
end
stripslashes (s: STRING): STRING
do
Result := s.string
Result.replace_substring_all ("\%"", "%"")
Result.replace_substring_all ("\'", "'")
Result.replace_substring_all ("\/", "/")
Result.replace_substring_all ("\\", "\")
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end
class URI_CONTENTS_TYPES
create
make
feature
content_types: HASH_TABLE [STRING, STRING]
extension (uri: STRING): STRING
-- extract extendion from a URI
local
i: INTEGER
do
-- going from the end find the position of the "."
from
i := uri.count
until
i = 0 or else uri.item (i) = '.'
loop
i := i - 1
end
Result := uri.substring (i+1, uri.count)
end
feature {NONE}
make
do
create content_types.make (30)
content_types.put ("text/html", "html")
content_types.put ("text/html", "htm")
content_types.put ("image/gif", "gif")
content_types.put ("image/jpeg", "jpeg")
content_types.put ("image/png", "jpg")
content_types.put ("image/png", "png")
end
feature -- Access: Encoding
urlencode (s: STRING): STRING
-- URL encode `s'
do
Result := s.string
Result.replace_substring_all ("#", "%%23")
Result.replace_substring_all (" ", "%%20")
Result.replace_substring_all ("%T", "%%09")
Result.replace_substring_all ("%N", "%%0A")
Result.replace_substring_all ("/", "%%2F")
Result.replace_substring_all ("&", "%%26")
Result.replace_substring_all ("<", "%%3C")
Result.replace_substring_all ("=", "%%3D")
Result.replace_substring_all (">", "%%3E")
Result.replace_substring_all ("%"", "%%22")
Result.replace_substring_all ("%'", "%%27")
end
urldecode (s: STRING): STRING
-- URL decode `s'
do
Result := s.string
Result.replace_substring_all ("%%23", "#")
Result.replace_substring_all ("%%20", " ")
Result.replace_substring_all ("%%09", "%T")
Result.replace_substring_all ("%%0A", "%N")
Result.replace_substring_all ("%%2F", "/")
Result.replace_substring_all ("%%26", "&")
Result.replace_substring_all ("%%3C", "<")
Result.replace_substring_all ("%%3D", "=")
Result.replace_substring_all ("%%3E", ">")
Result.replace_substring_all ("%%22", "%"")
Result.replace_substring_all ("%%27", "%'")
end
stripslashes (s: STRING): STRING
do
Result := s.string
Result.replace_substring_all ("\%"", "%"")
Result.replace_substring_all ("\'", "'")
Result.replace_substring_all ("\/", "/")
Result.replace_substring_all ("\\", "\")
end
note
copyright: "2011-2011, Javier Velilla and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-12-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-12-0 http://www.eiffel.com/developers/xml/configuration-1-12-0.xsd" name="nino" uuid="32C1D67D-33DE-4F1E-864B-D45388F2E3E6" library_target="nino">
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="nino" uuid="32C1D67D-33DE-4F1E-864B-D45388F2E3E6" library_target="nino">
<target name="nino">
<root all_classes="true"/>
<file_rule>
@@ -8,28 +8,13 @@
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
<option warning="true" is_attached_by_default="true" void_safety="all">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="concurrency" value="thread"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<cluster name="nino" location=".\library\" recursive="true">
<file_rule>
<exclude>spec</exclude>
</file_rule>
<file_rule>
<exclude>tcp_stream_socket.e</exclude>
<condition>
<version type="compiler" max="15.01.9.6506"/>
</condition>
</file_rule>
</cluster>
<cluster name="spec_before_15_01" location=".\library\spec\before_15_01\" recursive="true">
<condition>
<version type="compiler" max="15.01.9.6506"/>
</condition>
</cluster>
<cluster name="nino" location=".\library\" recursive="true"/>
</target>
</system>

View File

@@ -15,21 +15,6 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<cluster name="nino" location=".\library\" recursive="true">
<file_rule>
<exclude>spec</exclude>
</file_rule>
<file_rule>
<exclude>tcp_stream_socket.e</exclude>
<condition>
<version type="compiler" max="15.01.9.6506"/>
</condition>
</file_rule>
</cluster>
<cluster name="spec_before_15_01" location=".\library\spec\before_15_01\" recursive="true">
<condition>
<version type="compiler" max="15.01.9.6506"/>
</condition>
</cluster>
<cluster name="nino" location=".\library\" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1 @@

View File

@@ -1,15 +0,0 @@
package nino
project
nino = "nino-safe.ecf"
nino = "nino.ecf"
note
title: Eiffel Nino Web Server
description: Simple HTTPd server written in Eiffel
tags: web, httpd, server
copyright: Javier Velilla, Jocelyn Fiat and Eiffel Software.
license: Eiffel Forum v2
link[license]: http://www.eiffel.com/licensing/forum.txt
end

View File

@@ -1,38 +1,38 @@
Eiffel Nino HTTPD
=================
Eiffel Nino is and HTTPD server. It's a work in progress, so maybe it will be refactored.
The goal of is to provide a simple web server for development (like Java, Python and Ruby provide)
The code is based on Xebra and Emu Web Server.
Goal
========
HTTPD server for development, support for HTTP 1.1.
Testing
=======
To test the HTTPD server, you could run the [example https://github.com/jvelilla/EiffelWebNino/tree/master/example/SimpleWebServer]
The server work fine in Windows and Linux.
Run the server and point your browser to one of the following URIs
1) http://localhost:9000/post/index.html
2) http://localhost:9000/demo1/template.html
3) http://localhost:9000/demo2/demo.html
4) http://localhost:9000/example/html/index.html
5) http://localhost:9000/html/simple.html
6) http://localhost:9000/html/images.html
7) http://localhost:9000/html/images.html
8) http://localhost:9000/html5/dataset.html
Known Issues
============
Eiffel Nino HTTPD
=================
Eiffel Nino is and HTTPD server. It's a work in progress, so maybe it will be refactored.
The goal of is to provide a simple web server for development (like Java, Python and Ruby provide)
The code is based on Xebra and Emu Web Server.
Goal
========
HTTPD server for development, support for HTTP 1.1.
Testing
=======
To test the HTTPD server, you could run the [example https://github.com/jvelilla/EiffelWebNino/tree/master/example/SimpleWebServer]
The server work fine in Windows and Linux.
Run the server and point your browser to one of the following URIs
1) http://localhost:9000/post/index.html
2) http://localhost:9000/demo1/template.html
3) http://localhost:9000/demo2/demo.html
4) http://localhost:9000/example/html/index.html
5) http://localhost:9000/html/simple.html
6) http://localhost:9000/html/images.html
7) http://localhost:9000/html/images.html
8) http://localhost:9000/html5/dataset.html
Known Issues
============

View File

@@ -0,0 +1,2 @@
*.swp
EIFGENs

View File

@@ -0,0 +1,26 @@
History file for EJSON
======================
team: ""
date: "2011-07-06"
revision: "0.3.0"
+++++++++++++++++++++Important Changes since 0.2.0 version++++++++++++++++++++++++++++++++++++++++++++++
*Updated skip_white_spaces, now check %U and %T codes
*Undo changes to is_a_valid_number, because it's doesn't follow the
JSON spec. Tests : fail13.json, fail29.json and fail30.json are valid
with this implementation, so we go back to the previous
implementation.
*Added autotest test suite
*Added getest based test program
*Updated Eiffel configuration file, updated to the new clusters
*Added converters and factory classes
*Added new top level directories; library, test, build and example

View File

@@ -0,0 +1,20 @@
Copyright (c) 2010 Javier Velilla and others, http://ejson.origo.ethz.ch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,97 @@
Readme file for eJSON
=====================
team: "Javier Velilla,Jocelyn Fiat, Paul Cohen"
date: "$Date$"
revision: "$Revision$"
1. Introduction
---------------
eJSON stands for Eiffel JSON library and is a small Eiffel library for dealing
with the JSON format. The objective of the library is to provide two basic
features Eiffel2JSON and JSON2Eiffel.
2. Legal stuff
--------------
eJSON is copyrighted by the author Javier Velilla and others. It is licensed
under the MIT License. See the file license.txt in the same directory as this
readme file.
3. Versioning scheme
--------------------
eJSON version numbers has the form:
«major number».«minor number».«patch level»
eJSON will retain the major number 0 as long as it has beta status. A change in
major number indicates that a release is not backward compatible. A change in
minor number indicates that a release is backward compatible (within that major
number) but that new useful features may have been added. A change in patch
level simply indicates that the release contains bug fixes for the previous
release. Note that as long as eJSON is in beta status (0.Y.Z) backward
compatibility is not guranteed for changes in minor numbers!
4. Documentation
---------------
Currently the only documentation on eJSON is available at:
https://github.com/eiffelhub/json/wiki/User-guide
5. Requirements and installation
--------------------------------
EJSON requires that you have:
1. Gobo 3.9 installed or later
2. One of the following compiler combinations installed:
* ISE Eiffel 6.5 or later.
* gec [try to test]
* tecomp [try to test]
eJSON probably works fine with other versions of the above compilers.
There are no known platform dependencies (Windows, Linux).
To install eJSON simply extract the ejson-X.Y.Z.zip file to some appropriate
place on your hard disk. There are no requirements on environment variables or
registry variables.
To verify that everything works you should compile the example programs and/or
the test program.
6. Contents of eJSON
--------------------
All directory names below are relative to the root directory of your ejson
installation.
Directory Description
--------- -----------
doc Contains the eJSON.pdf documentation file.
examples Contains the two example programs.
ejson Contains the actual eJSON library classes.
test Contains a test program for eJSON.
7. Contacting the Team
----------------------
Contact the team:
Javier Velilla «javier.hector@gmail.com»
Paul Cohen «paco@seibostudios.se»
Jocelyn Fiat «jfiat@eiffel.com»
8. Releases
-----------
For more information on what was changed in each release look in the file
history.txt.
Version Date Description
------- ---- -----------
0.3.0 2011-07-06 JSON Factory Converters
0.2.0 2010-02-07 Adapted to EiffelStudio 6.4 or later, supports void-safety
0.1.0 2010-02-07 First release, Adapted to SmartEiffel 1.2r7 and EiffelStudio 6.2 or previous

View File

@@ -0,0 +1,38 @@
note
description: "Objects that ..."
author: ""
date: "$Date$"
revision: "$Revision$"
class
JSON_FILE_READER
feature -- Access
read_json_from (a_path: STRING): detachable STRING
local
l_file: PLAIN_TEXT_FILE
template_content: STRING
l_last_string: detachable STRING
do
create l_file.make (a_path)
-- We perform several checks until we make a real attempt to open the file.
if not l_file.exists then
print ("error: '" + a_path + "' does not exist%N")
else
if not l_file.is_readable then
print ("error: '" + a_path + "' is not readable.%N")
else
l_file.open_read
create template_content.make_empty
l_file.read_stream (l_file.count)
l_last_string := l_file.last_string
check l_last_string /= Void end -- implied by postcondition of `l_file.read_stream'
template_content.append (l_last_string.string)
Result := template_content
l_file.close
end
end
end
end

View File

@@ -0,0 +1,175 @@
note
description: "JSON_PRETTY_STRING_VISITOR Generates the JSON-String for a JSON_VALUE"
revision: "0.1"
class
JSON_PRETTY_STRING_VISITOR
inherit
JSON_VISITOR
create
make,
make_custom
feature -- Initialization
make (a_output: like output)
-- Create a new instance
do
make_custom (a_output, 1, 1)
end
make_custom (a_output: like output; a_object_count_inlining, a_array_count_inlining: INTEGER)
-- Create a new instance
do
output := a_output
create indentation.make_empty
indentation_step := "%T"
object_count_inlining := a_object_count_inlining
array_count_inlining := a_array_count_inlining
end
feature -- Access
output: STRING_32
-- JSON representation
indentation: like output
indentation_step: like indentation
line_number: INTEGER
indent
do
indentation.append (indentation_step)
end
exdent
do
indentation.remove_tail (indentation_step.count)
end
new_line
do
output.append ("%N")
output.append (indentation)
line_number := line_number + 1
end
object_count_inlining: INTEGER
array_count_inlining: INTEGER
feature -- Visitor Pattern
visit_json_array (a_json_array: JSON_ARRAY)
-- Visit `a_json_array'.
local
value: JSON_VALUE
l_json_array: ARRAYED_LIST [JSON_VALUE]
l_line: like line_number
l_multiple_lines: BOOLEAN
do
l_json_array := a_json_array.array_representation
l_multiple_lines := l_json_array.count >= array_count_inlining or across l_json_array as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
output.append ("[")
l_line := line_number
indent
from
l_json_array.start
until
l_json_array.off
loop
if
line_number > l_line or
l_multiple_lines
then
new_line
end
value := l_json_array.item
value.accept (Current)
l_json_array.forth
if not l_json_array.after then
output.append (", ")
end
end
exdent
if
line_number > l_line or
l_json_array.count >= array_count_inlining
then
new_line
end
output.append ("]")
end
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
-- Visit `a_json_boolean'.
do
output.append (a_json_boolean.item.out)
end
visit_json_null (a_json_null: JSON_NULL)
-- Visit `a_json_null'.
do
output.append ("null")
end
visit_json_number (a_json_number: JSON_NUMBER)
-- Visit `a_json_number'.
do
output.append (a_json_number.item)
end
visit_json_object (a_json_object: JSON_OBJECT)
-- Visit `a_json_object'.
local
l_pairs: HASH_TABLE [JSON_VALUE, JSON_STRING]
l_line: like line_number
l_multiple_lines: BOOLEAN
do
l_pairs := a_json_object.map_representation
l_multiple_lines := l_pairs.count >= object_count_inlining or across l_pairs as p some attached {JSON_OBJECT} p.item or attached {JSON_ARRAY} p.item end
output.append ("{")
l_line := line_number
indent
from
l_pairs.start
until
l_pairs.off
loop
if
line_number > l_line or
l_multiple_lines
then
new_line
end
l_pairs.key_for_iteration.accept (Current)
output.append (": ")
l_pairs.item_for_iteration.accept (Current)
l_pairs.forth
if not l_pairs.after then
output.append (", ")
end
end
exdent
if
line_number > l_line or
l_pairs.count >= object_count_inlining
then
new_line
end
output.append ("}")
end
visit_json_string (a_json_string: JSON_STRING)
-- Visit `a_json_string'.
do
output.append ("%"")
output.append (a_json_string.item)
output.append ("%"")
end
end

View File

@@ -0,0 +1,59 @@
note
description:
"JSON Visitor"
pattern: "Visitor"
author: "Javier Velilla"
license:"MIT (see http://www.opensource.org/licenses/mit-license.php)"
date: "2008/08/24"
revision: "Revision 0.1"
deferred class
JSON_VISITOR
feature -- Visitor Pattern
visit_json_array (a_json_array: JSON_ARRAY)
-- Visit `a_json_array'.
require
a_json_array_not_void: a_json_array /= Void
deferred
end
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
-- Visit `a_json_boolean'.
require
a_json_boolean_not_void: a_json_boolean /= Void
deferred
end
visit_json_null (a_json_null: JSON_NULL)
-- Visit `a_json_null'.
require
a_json_null_not_void: a_json_null /= Void
deferred
end
visit_json_number (a_json_number: JSON_NUMBER)
-- Visit `a_json_number'.
require
a_json_number_not_void: a_json_number /= Void
deferred
end
visit_json_object (a_json_object: JSON_OBJECT)
-- Visit `a_json_object'.
require
a_json_object_not_void: a_json_object /= Void
deferred
end
visit_json_string (a_json_string: JSON_STRING)
-- Visit `a_json_string'.
require
a_json_string_not_void: a_json_string /= Void
deferred
end
end

View File

@@ -0,0 +1,102 @@
note
description: "PRINT_JSON_VISITOR Generates the JSON-String for a JSON_VALUE"
author: "jvelilla"
date: "2008/08/24"
revision: "0.1"
class
PRINT_JSON_VISITOR
inherit
JSON_VISITOR
create make
feature -- Initialization
make
-- Create a new instance
do
create to_json.make_empty
end
feature -- Access
to_json: STRING
-- JSON representation
feature -- Visitor Pattern
visit_json_array (a_json_array: JSON_ARRAY)
-- Visit `a_json_array'.
local
value: JSON_VALUE
l_json_array: ARRAYED_LIST [JSON_VALUE]
do
l_json_array:=a_json_array.array_representation
to_json.append ("[")
from
l_json_array.start
until
l_json_array.off
loop
value := l_json_array.item
value.accept (Current)
l_json_array.forth
if not l_json_array.after then
to_json.append(",")
end
end
to_json.append ("]")
end
visit_json_boolean (a_json_boolean: JSON_BOOLEAN)
-- Visit `a_json_boolean'.
do
to_json.append (a_json_boolean.item.out)
end
visit_json_null (a_json_null: JSON_NULL)
-- Visit `a_json_null'.
do
to_json.append ("null")
end
visit_json_number (a_json_number: JSON_NUMBER)
-- Visit `a_json_number'.
do
to_json.append (a_json_number.item)
end
visit_json_object (a_json_object: JSON_OBJECT)
-- Visit `a_json_object'.
local
l_pairs: HASH_TABLE[JSON_VALUE,JSON_STRING]
do
l_pairs := a_json_object.map_representation
to_json.append ("{")
from
l_pairs.start
until
l_pairs.off
loop
l_pairs.key_for_iteration.accept (Current)
to_json.append (":")
l_pairs.item_for_iteration.accept (Current)
l_pairs.forth
if not l_pairs.after then
to_json.append (",")
end
end
to_json.append ("}")
end
visit_json_string (a_json_string: JSON_STRING)
-- Visit `a_json_string'.
do
to_json.append ("%"")
to_json.append (a_json_string.item)
to_json.append ("%"")
end
end

View File

@@ -0,0 +1,85 @@
note
description: "A JSON converter for DS_HASH_TABLE [ANY, HASHABLE]"
author: "Paul Cohen"
date: "$Date: $"
revision: "$Revision: $"
file: "$HeadURL: $"
class JSON_DS_HASH_TABLE_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
do
create object.make (0)
end
feature -- Access
value: JSON_OBJECT
object: DS_HASH_TABLE [ANY, HASHABLE]
feature -- Conversion
from_json (j: like value): detachable like object
local
keys: ARRAY [JSON_STRING]
i: INTEGER
h: HASHABLE
a: ANY
do
keys := j.current_keys
create Result.make (keys.count)
from
i := 1
until
i > keys.count
loop
h ?= json.object (keys [i], void)
check h /= Void end
a := json.object (j.item (keys [i]), Void)
Result.put (a, h)
i := i + 1
end
end
to_json (o: like object): like value
local
c: DS_HASH_TABLE_CURSOR [ANY, HASHABLE]
js: JSON_STRING
jv: JSON_VALUE
failed: BOOLEAN
do
create Result.make
from
c := o.new_cursor
c.start
until
c.after
loop
if attached {JSON_STRING} json.value (c.key) as l_key then
js := l_key
else
create js.make_json (c.key.out)
end
jv := json.value (c.item)
if jv /= Void then
Result.put (jv, js)
else
failed := True
end
c.forth
end
if failed then
Result := Void
end
end
end -- class JSON_DS_HASH_TABLE_CONVERTER

View File

@@ -0,0 +1,62 @@
note
description: "A JSON converter for DS_LINKED_LIST [ANY]"
author: "Paul Cohen"
date: "$Date: $"
revision: "$Revision: $"
file: "$HeadURL: $"
class JSON_DS_LINKED_LIST_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
do
create object.make
end
feature -- Access
value: JSON_ARRAY
object: DS_LINKED_LIST [ANY]
feature -- Conversion
from_json (j: like value): detachable like object
local
i: INTEGER
do
create Result.make
from
i := 1
until
i > j.count
loop
Result.put_last (json.object (j [i], Void))
i := i + 1
end
end
to_json (o: like object): like value
local
c: DS_LIST_CURSOR [ANY]
do
create Result.make_array
from
c := o.new_cursor
c.start
until
c.after
loop
Result.add (json.value (c.item))
c.forth
end
end
end -- class JSON_DS_LINKED_LIST_CONVERTER

View File

@@ -0,0 +1,32 @@
note
description: "[
Shared factory class for creating JSON objects. Maps JSON
objects to Gobo DS_HASH_TABLEs and JSON arrays to Gobo
DS_LINKED_LISTs. Use non-conforming inheritance from this
class to ensure that your classes share the same
JSON_FACTORY instance.
]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class SHARED_GOBO_EJSON
feature
json: EJSON
-- A shared EJSON instance with default converters for
-- DS_LINKED_LIST [ANY] and DS_HASH_TABLE [ANY, HASHABLE]
local
jllc: JSON_DS_LINKED_LIST_CONVERTER
jhtc: JSON_DS_HASH_TABLE_CONVERTER
once
create Result
create jllc.make
Result.add_converter (jllc)
create jhtc.make
Result.add_converter (jhtc)
end
end -- class SHARED_GOBO_EJSON

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
<target name="json">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard" namespace="EJSON.Library">
<assertions/>
<warning name="export_class_missing" enabled="false"/>
<warning name="old_verbatim_strings" enabled="false"/>
<warning name="syntax" enabled="false"/>
<warning name="vjrv" enabled="false"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf" readonly="true"/>
<cluster name="json" location=".\" recursive="true">
<file_rule>
<exclude>^/gobo$</exclude>
<exclude>^/kernel$</exclude>
<exclude>^/extras$</exclude>
</file_rule>
<cluster name="kernel" location=".\kernel\" recursive="true"/>
<cluster name="extras" location=".\extras\" recursive="true"/>
</cluster>
</target>
</system>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="json" uuid="4E21C3BD-7951-4C6E-A673-431E762D7414" library_target="json">
<target name="json">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" void_safety="none" syntax="standard" namespace="EJSON.Library">
<assertions/>
<warning name="export_class_missing" enabled="false"/>
<warning name="old_verbatim_strings" enabled="false"/>
<warning name="syntax" enabled="false"/>
<warning name="vjrv" enabled="false"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf" readonly="true"/>
<cluster name="json" location=".\" recursive="true">
<file_rule>
<exclude>^/gobo$</exclude>
<exclude>^/kernel$</exclude>
<exclude>^/extras$</exclude>
</file_rule>
<cluster name="kernel" location=".\kernel\" recursive="true"/>
<cluster name="extras" location=".\extras\" recursive="true"/>
</cluster>
</target>
</system>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="json_gobo" uuid="437195AB-8B3C-4238-8998-A932A1423449" library_target="json_gobo">
<target name="json_gobo">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option trace="false" profile="false" debug="false" warning="true" full_class_checking="true" void_safety="none" syntax="standard" namespace="EJSON.Library">
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf" readonly="true"/>
<library name="json" location="json.ecf" readonly="true"/>
<library name="gobo_structure" location="$ISE_LIBRARY\library\gobo\gobo_structure.ecf"/>
<cluster name="json_gobo" location=".\gobo" recursive="true" />
</target>
</system>

View File

@@ -0,0 +1,30 @@
note
description: "A JSON converter for ARRAYED_LIST [ANY]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class JSON_ARRAYED_LIST_CONVERTER
inherit
JSON_LIST_CONVERTER
redefine
object
end
create
make
feature -- Access
object: ARRAYED_LIST [detachable ANY]
feature {NONE} -- Factory
new_object (nb: INTEGER): like object
do
create Result.make (nb)
end
end -- class JSON_ARRAYED_LIST_CONVERTER

View File

@@ -0,0 +1,36 @@
note
description: "A JSON converter"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
deferred class JSON_CONVERTER
inherit
SHARED_EJSON
feature -- Access
object: ANY
-- Eiffel object
deferred
end
feature -- Conversion
from_json (j: attached like to_json): detachable like object
-- Convert from JSON value.
-- Returns Void if unable to convert
deferred
end
to_json (o: like object): detachable JSON_VALUE
-- Convert to JSON value
deferred
end
invariant
has_eiffel_object: object /= Void -- An empty object must be created at creation time!
end

View File

@@ -0,0 +1,92 @@
note
description: "A JSON converter for HASH_TABLE [ANY, HASHABLE]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class JSON_HASH_TABLE_CONVERTER
inherit
JSON_CONVERTER
create
make
feature {NONE} -- Initialization
make
do
create object.make (0)
end
feature -- Access
object: HASH_TABLE [ANY, HASHABLE]
feature -- Conversion
from_json (j: attached like to_json): like object
local
keys: ARRAY [JSON_STRING]
i: INTEGER
h: detachable HASHABLE
jv: detachable JSON_VALUE
a: detachable ANY
do
keys := j.current_keys
create Result.make (keys.count)
from
i := 1
until
i > keys.count
loop
h ?= json.object (keys [i], Void)
check h /= Void end
jv := j.item (keys [i])
if jv /= Void then
a := json.object (jv, Void)
if a /= Void then
Result.put (a, h)
else
check a_attached: a /= Void end
end
else
check j_has_item: False end
end
i := i + 1
end
end
to_json (o: like object): detachable JSON_OBJECT
local
c: HASH_TABLE_ITERATION_CURSOR [ANY, HASHABLE]
js: JSON_STRING
jv: detachable JSON_VALUE
failed: BOOLEAN
do
create Result.make
from
c := o.new_cursor
until
c.after
loop
if attached {JSON_STRING} json.value (c.key) as l_key then
js := l_key
else
create js.make_json (c.key.out)
end
jv := json.value (c.item)
if jv /= Void then
Result.put (jv, js)
else
failed := True
end
c.forth
end
if failed then
Result := Void
end
end
end -- class JSON_HASH_TABLE_CONVERTER

View File

@@ -0,0 +1,30 @@
note
description: "A JSON converter for LINKED_LIST [ANY]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class JSON_LINKED_LIST_CONVERTER
inherit
JSON_LIST_CONVERTER
redefine
object
end
create
make
feature -- Access
object: LINKED_LIST [detachable ANY]
feature {NONE} -- Factory
new_object (nb: INTEGER): like object
do
create Result.make
end
end -- class JSON_LINKED_LIST_CONVERTER

View File

@@ -0,0 +1,74 @@
note
description: "A JSON converter for LIST [ANY]"
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
deferred class JSON_LIST_CONVERTER
inherit
JSON_CONVERTER
feature {NONE} -- Initialization
make
do
object := new_object (0)
end
feature -- Access
object: LIST [detachable ANY]
feature {NONE} -- Factory
new_object (nb: INTEGER): like object
deferred
ensure
Result /= Void
end
feature -- Conversion
from_json (j: attached like to_json): detachable like object
local
i: INTEGER
do
Result := new_object (j.count)
from
i := 1
until
i > j.count
loop
Result.extend (json.object (j [i], Void))
i := i + 1
end
end
to_json (o: like object): detachable JSON_ARRAY
local
c: ITERATION_CURSOR [detachable ANY]
jv: detachable JSON_VALUE
failed: BOOLEAN
do
create Result.make_array
from
c := o.new_cursor
until
c.after
loop
jv := json.value (c.item)
if jv /= Void then
Result.add (jv)
else
failed := True
end
c.forth
end
if failed then
Result := Void
end
end
end -- class JSON_ARRAYED_LIST_CONVERTER

View File

@@ -0,0 +1,268 @@
note
description: "Core factory class for creating JSON objects and corresponding Eiffel objects."
author: "Paul Cohen"
date: "$Date$"
revision: "$Revision$"
file: "$HeadURL: $"
class EJSON
inherit
EXCEPTIONS
feature -- Access
value (an_object: detachable ANY): detachable JSON_VALUE
-- JSON value from Eiffel object. Raises an "eJSON exception" if
-- unable to convert value.
local
i: INTEGER
ja: JSON_ARRAY
do
-- Try to convert from basic Eiffel types. Note that we check with
-- `conforms_to' since the client may have subclassed the base class
-- that these basic types are derived from.
if an_object = Void then
create {JSON_NULL} Result
elseif attached {BOOLEAN} an_object as b then
create {JSON_BOOLEAN} Result.make_boolean (b)
elseif attached {INTEGER_8} an_object as i8 then
create {JSON_NUMBER} Result.make_integer (i8)
elseif attached {INTEGER_16} an_object as i16 then
create {JSON_NUMBER} Result.make_integer (i16)
elseif attached {INTEGER_32} an_object as i32 then
create {JSON_NUMBER} Result.make_integer (i32)
elseif attached {INTEGER_64} an_object as i64 then
create {JSON_NUMBER} Result.make_integer (i64)
elseif attached {NATURAL_8} an_object as n8 then
create {JSON_NUMBER} Result.make_natural (n8)
elseif attached {NATURAL_16} an_object as n16 then
create {JSON_NUMBER} Result.make_natural (n16)
elseif attached {NATURAL_32} an_object as n32 then
create {JSON_NUMBER} Result.make_natural (n32)
elseif attached {NATURAL_64} an_object as n64 then
create {JSON_NUMBER} Result.make_natural (n64)
elseif attached {REAL_32} an_object as r32 then
create {JSON_NUMBER} Result.make_real (r32)
elseif attached {REAL_64} an_object as r64 then
create {JSON_NUMBER} Result.make_real (r64)
elseif attached {ARRAY [detachable ANY]} an_object as a then
create ja.make_array
from
i := a.lower
until
i > a.upper
loop
if attached value (a @ i) as v then
ja.add (v)
else
check value_attached: False end
end
i := i + 1
end
Result := ja
elseif attached {CHARACTER_8} an_object as c8 then
create {JSON_STRING} Result.make_json (c8.out)
elseif attached {CHARACTER_32} an_object as c32 then
create {JSON_STRING} Result.make_json (c32.out)
elseif attached {STRING_8} an_object as s8 then
create {JSON_STRING} Result.make_json (s8)
elseif attached {STRING_32} an_object as s32 then
create {JSON_STRING} Result.make_json_from_string_32 (s32)
end
if Result = Void then
-- Now check the converters
if an_object /= Void and then attached converter_for (an_object) as jc then
Result := jc.to_json (an_object)
else
raise (exception_failed_to_convert_to_json (an_object))
end
end
end
object (a_value: detachable JSON_VALUE; base_class: detachable STRING): detachable ANY
-- Eiffel object from JSON value. If `base_class' /= Void an eiffel
-- object based on `base_class' will be returned. Raises an "eJSON
-- exception" if unable to convert value.
local
i: INTEGER
ll: LINKED_LIST [detachable ANY]
t: HASH_TABLE [detachable ANY, STRING_GENERAL]
keys: ARRAY [JSON_STRING]
do
if a_value = Void then
Result := Void
else
if base_class = Void then
if a_value = Void then
Result := Void
elseif attached {JSON_NULL} a_value then
Result := Void
elseif attached {JSON_BOOLEAN} a_value as jb then
Result := jb.item
elseif attached {JSON_NUMBER} a_value as jn then
if jn.item.is_integer_8 then
Result := jn.item.to_integer_8
elseif jn.item.is_integer_16 then
Result := jn.item.to_integer_16
elseif jn.item.is_integer_32 then
Result := jn.item.to_integer_32
elseif jn.item.is_integer_64 then
Result := jn.item.to_integer_64
elseif jn.item.is_natural_64 then
Result := jn.item.to_natural_64
elseif jn.item.is_double then
Result := jn.item.to_double
end
elseif attached {JSON_STRING} a_value as js then
create {STRING_32} Result.make_from_string (js.unescaped_string_32)
elseif attached {JSON_ARRAY} a_value as ja then
from
create ll.make
i := 1
until
i > ja.count
loop
ll.extend (object (ja [i], Void))
i := i + 1
end
Result := ll
elseif attached {JSON_OBJECT} a_value as jo then
keys := jo.current_keys
create t.make (keys.count)
from
i := keys.lower
until
i > keys.upper
loop
if attached {STRING_GENERAL} object (keys [i], Void) as s then
t.put (object (jo.item (keys [i]), Void), s)
end
i := i + 1
end
Result := t
end
else
if converters.has_key (base_class) and then attached converters.found_item as jc then
Result := jc.from_json (a_value)
else
raise (exception_failed_to_convert_to_eiffel (a_value, base_class))
end
end
end
end
object_from_json (json: STRING; base_class: detachable STRING): detachable ANY
-- Eiffel object from JSON representation. If `base_class' /= Void an
-- Eiffel object based on `base_class' will be returned. Raises an
-- "eJSON exception" if unable to convert value.
require
json_not_void: json /= Void
local
jv: detachable JSON_VALUE
do
json_parser.set_representation (json)
jv := json_parser.parse
if jv /= Void then
Result := object (jv, base_class)
end
end
converter_for (an_object: ANY): detachable JSON_CONVERTER
-- Converter for objects. Returns Void if none found.
require
an_object_not_void: an_object /= Void
do
if converters.has_key (an_object.generator) then
Result := converters.found_item
end
end
json_reference (s: STRING): JSON_OBJECT
-- A JSON (Dojo style) reference object using `s' as the
-- reference value. The caller is responsable for ensuring
-- the validity of `s' as a json reference.
require
s_not_void: s /= Void
local
js_key, js_value: JSON_STRING
do
create Result.make
create js_key.make_json ("$ref")
create js_value.make_json (s)
Result.put (js_value, js_key)
end
json_references (l: LIST [STRING]): JSON_ARRAY
-- A JSON array of JSON (Dojo style) reference objects using the
-- strings in `l' as reference values. The caller is responsable
-- for ensuring the validity of all strings in `l' as json
-- references.
require
l_not_void: l /= Void
local
c: ITERATION_CURSOR [STRING]
do
create Result.make_array
from
c := l.new_cursor
until
c.after
loop
Result.add (json_reference (c.item))
c.forth
end
end
feature -- Change
add_converter (jc: JSON_CONVERTER)
-- Add the converter `jc'.
require
jc_not_void: jc /= Void
do
converters.force (jc, jc.object.generator)
ensure
has_converter: converter_for (jc.object) /= Void
end
feature {NONE} -- Implementation
converters: HASH_TABLE [JSON_CONVERTER, STRING]
-- Converters hashed by generator (base class)
once
create Result.make (10)
end
feature {NONE} -- Implementation (Exceptions)
exception_prefix: STRING = "eJSON exception: "
exception_failed_to_convert_to_eiffel (a_value: JSON_VALUE; base_class: detachable STRING): STRING
-- Exception message for failing to convert a JSON_VALUE to an instance of `a'.
do
Result := exception_prefix + "Failed to convert JSON_VALUE to an Eiffel object: " + a_value.generator
if base_class /= Void then
Result.append (" -> {" + base_class + "}")
end
end
exception_failed_to_convert_to_json (an_object: detachable ANY): STRING
-- Exception message for failing to convert `a' to a JSON_VALUE.
do
Result := exception_prefix + "Failed to convert Eiffel object to a JSON_VALUE"
if an_object /= Void then
Result.append (" : {" + an_object.generator + "}")
end
end
feature {NONE} -- Implementation (JSON parser)
json_parser: JSON_PARSER
once
create Result.make_parser ("")
end
end -- class EJSON

View File

@@ -0,0 +1,141 @@
note
description: "[
JSON_ARRAY represent an array in JSON.
An array in JSON is an ordered set of names.
Examples
array
[]
[elements]
]"
author: "Javier Velilla"
date: "2008/08/24"
revision: "Revision 0.1"
class
JSON_ARRAY
inherit
JSON_VALUE
DEBUG_OUTPUT
create
make_array
feature {NONE} -- Initialization
make_array
-- Initialize JSON Array
do
create values.make (10)
end
feature -- Access
i_th alias "[]" (i: INTEGER): JSON_VALUE
-- Item at `i'-th position
require
is_valid_index: valid_index (i)
do
Result := values.i_th (i)
end
representation: STRING
local
i: INTEGER
do
Result := "["
from
i := 1
until
i > count
loop
Result.append (i_th (i).representation)
i := i + 1
if i <= count then
Result.append_character (',')
end
end
Result.append_character (']')
end
feature -- Visitor pattern
accept (a_visitor: JSON_VISITOR)
-- Accept `a_visitor'.
-- (Call `visit_json_array' procedure on `a_visitor'.)
do
a_visitor.visit_json_array (Current)
end
feature -- Mesurement
count: INTEGER
-- Number of items.
do
Result := values.count
end
feature -- Status report
valid_index (i: INTEGER): BOOLEAN
-- Is `i' a valid index?
do
Result := (1 <= i) and (i <= count)
end
feature -- Change Element
add (value: JSON_VALUE)
require
value_not_null: value /= void
do
values.extend (value)
ensure
has_new_value: old values.count + 1 = values.count and
values.has (value)
end
feature -- Report
hash_code: INTEGER
-- Hash code value
do
from
values.start
Result := values.item.hash_code
until
values.off
loop
Result:= ((Result \\ 8388593) |<< 8) + values.item.hash_code
values.forth
end
Result := Result \\ values.count
end
feature -- Conversion
array_representation: ARRAYED_LIST [JSON_VALUE]
-- Representation as a sequences of values
do
Result := values
end
feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
Result := count.out
end
feature {NONE} -- Implementation
values: ARRAYED_LIST [JSON_VALUE]
-- Value container
invariant
value_not_void: values /= Void
end

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