Compare commits

..

1449 Commits

Author SHA1 Message Date
6f200bbf22 Allow forcing multipart/form-data or application/x-www-form-urlencoded to choose how the form data should be sent. 2017-03-08 22:01:04 +01:00
8bb9675719 Update email notification storage classes. 2017-03-08 14:10:55 +01:00
4e21adc41f Fixed the notification_email_file_storage.
Added a new notification_email_directory_storage.
2017-03-08 10:33:16 +01:00
9c207f4c9b Added put_content_type_utf_8_text_html to HTTP_HEADER .
Improved the directory index access denied message.
2017-03-07 14:36:16 +01:00
b2e795d2d1 removed useless local variable. 2017-03-07 13:14:47 +01:00
f2ecccce4f Improved NOTIFICATION_SMTP_MAILER.make (..) to support user:password@...
Propage error in notification_chain_mailer.
2017-03-07 13:14:16 +01:00
5988d9d74b Updated code related to force_single_threaded setting to mark it obsolete, and for now, have coherent value 1 vs 0 among the standalone code and the httpd library. 2017-03-02 09:59:14 +01:00
c160f63ddc Updated restbuck example and fixed the policy driven variant. 2017-02-16 16:56:47 +01:00
ae7aeaea30 Added test to the simple db lib, and depending on config, exclude or not json or memory database. 2017-02-16 14:53:55 +01:00
ad3fe2fc7b Updated restbuck example to avoid using the new (since 17.01) JSON serialization component. 2017-02-16 11:26:22 +01:00
Jocelyn Fiat
1792c956f4 New location for the workbook doc. 2017-02-15 18:02:13 +01:00
Jocelyn Fiat
56f48d8c72 workbook moved from doc/workbook to docs/workbook 2017-02-15 17:59:47 +01:00
Jocelyn Fiat
e0d3ceb4e8 Removed extra indentations. 2017-02-15 17:54:17 +01:00
Jocelyn Fiat
94f3c3b849 Updated workbook content.
cosmetic.
2017-02-15 17:49:31 +01:00
Jocelyn Fiat
fa2fa6f35c use workbook.md as main entry. 2017-02-15 17:35:01 +01:00
Jocelyn Fiat
e0d95ee4bd Fixed jekyll syntax. 2017-02-15 17:28:06 +01:00
Jocelyn Fiat
2cac9c73d1 Try again to have github pages fixed. 2017-02-15 17:24:14 +01:00
Jocelyn Fiat
5f96e56386 Use {{ site.url }} instead of page.base_url. 2017-02-15 17:21:30 +01:00
Jocelyn Fiat
687402930a Fixed the jeykill page.baseurl variable name. 2017-02-15 17:16:17 +01:00
Jocelyn Fiat
7dbecc7f38 Removed jekyll specific code from the workbook files. 2017-02-15 17:11:07 +01:00
Jocelyn Fiat
a90780fde2 Have the github pages source in the same branch. 2017-02-15 17:06:34 +01:00
f66dbc3ad4 Declared code as eiffel code. 2017-02-14 19:52:18 +01:00
ff8da87fe3 Removed extra indentations in code. 2017-02-14 19:51:23 +01:00
f216e98430 Updated markdown syntax. 2017-02-14 19:43:54 +01:00
5dc9d82df7 Added wsf_html documentation in the doc/workbook.
Also improved the structure of `wsf_html` library.
Added a few widgets.
2017-02-14 19:37:03 +01:00
b93cb17f7c Added readme files to the examples.
Minor changes in various ecf file and code.
Moved filter example under _update_needed since it has obsolete code.
2017-02-14 11:21:32 +01:00
fbdf034b9b Conflict response can also have a payload to help the client understand the source of the conflict. 2017-02-13 17:36:10 +01:00
d6f3e500b8 Fixed implementation. 2017-02-13 17:35:14 +01:00
b56aec67a9 Updated, improved and cleaned RESTbucks example.
Moved it under "rest" subfolder.
2017-02-13 16:23:38 +01:00
a44c4d9a16 Minor changes. 2017-02-12 12:42:25 +01:00
7be394c689 Fixed more markdown syntax usage issue. 2017-02-12 12:29:58 +01:00
4d4bc89129 Fixed markdown syntax [..]() by .. . 2017-02-12 12:24:14 +01:00
Jocelyn Fiat
847b890b48 Merge pull request #176 from jvelilla/ewf_doc
Updated EWF documentation
2017-02-12 12:00:07 +01:00
Javier Velilla
14e260bea4 Cosmetic 2017-02-10 20:37:01 -03:00
Javier Velilla
5f1bb64d26 Update generating_response.md 2017-02-10 20:32:49 -03:00
Javier Velilla
c6de55b903 Cosmetic 2017-02-10 20:31:08 -03:00
Javier Velilla
65e1b1bfed Cosmetic 2017-02-10 19:55:18 -03:00
Javier Velilla
91a5fb2886 Cosmetic 2017-02-10 19:37:35 -03:00
Javier Velilla
b456f02a14 Updated documentation
Cosmetic, style, typos.
2017-02-10 18:55:38 -03:00
Javier Velilla
6596959724 Cosmetic 2017-02-10 18:32:48 -03:00
Javier Velilla
828c75f0c2 Cosmetic 2017-02-10 18:04:39 -03:00
Javier Velilla
7662afc17b Fixed typos
Updated document, fixed typos.
2017-02-10 18:02:17 -03:00
0786f1700f Added an example demonstrating the WSF_FORM component from wsf_html library. 2017-02-09 16:19:22 +01:00
08440b5c0c Use WSF_REQUEST.absolute_script_url (...) to compute expected url. 2017-01-26 22:26:45 +01:00
7f50409d08 Follow redirection only for redirection http status 3** . 2017-01-26 22:18:14 +01:00
681151e9b9 Fixed http_client EiffelNet implementation when port is not the default one.
- previously the client was not sending the complete `host:port` but only `host` as `host` http header.
2017-01-26 21:56:21 +01:00
1b24fb63f7 Fixed temporary restbucks example.
- use concurrency none to workaround a concurrency issue of DB_ACCESS
- use console_application for convenience
- use default http client, to use net implementation if curl is not available.
2017-01-26 09:52:44 +01:00
a6245351ef Updated http_client README. 2017-01-16 21:36:03 +01:00
d09d452ad5 Added test cases for PATH_INFO and percent_encoded_path_info for root url cases.
Removed obsolete calls from TEST_EXECUTION_I .
2017-01-10 12:37:37 +01:00
56fa773b30 If PATH_INFO is "/", the percent encoded path info is also "/". No need for complex computation.
Note this fixes an issue with libfcgi app not hosted as root url such as "/sub/app.fcgi" on (old) IIS server.
2017-01-10 11:59:48 +01:00
ee9746449c If PATH_INFO is empty, the percent encoded path info is also empty. No need for complex computation.
Note this fixes an issue with libfcgi app not hosted as root url such as "/sub/app.fcgi".
2017-01-10 00:16:50 +01:00
9f04c52265 Updated wsf_js_widget example ecf files. 2016-12-06 12:51:37 +01:00
54ebafba0d Updated doc workbook ecf files. 2016-12-06 12:37:41 +01:00
c70d3124df Updated tutorial ecf files to compile with 16.05 and upcoming release. 2016-12-06 12:29:17 +01:00
cad33e124d Fixed a few compilation issue with 16.11 . 2016-12-06 12:15:36 +01:00
ece6607bcf Disable debug clause for the wsf tests suite.
Removed useless dep on EiffelThread
2016-12-05 21:50:02 +01:00
f56aa22c29 Fixed compilation of proxy and simple examples.
Made the websocket client library scoop capable.
2016-12-05 15:56:46 +01:00
186e5514eb If the count for put_file_content is not positive (i.e <= 0), do not send anything.
Output/log more information for request handling when standalone httpd server has verbose enabled.
2016-12-01 21:20:14 +01:00
9fd53b9b1f Fixed debug.ecf file from debug example. 2016-12-01 21:08:13 +01:00
27c77721fd Fixed a few void-safety issue, attribute not initialized before computing agent objects. 2016-12-01 20:41:03 +01:00
c2202e82f6 Fixed compilation of desktop app example. 2016-12-01 18:43:22 +01:00
72a40a2673 Fixed potential void-safety issue in descendants related to initialization of router and filter. 2016-12-01 18:14:07 +01:00
2fbffd0c1e Fixed compilation. 2016-12-01 16:09:41 +01:00
9e5fec9c34 Removed unwanted files. 2016-12-01 15:02:40 +01:00
ca8f95a594 Made library ecf compilable in scoop concurrency mode by default.
So ecf files are compilable with 16.05 and 16.11 .
2016-12-01 14:56:56 +01:00
5a9ccce558 Made library ecf compilable in scoop concurrency mode by default.
Except nino related projects that depends on EiffelThread.
2016-11-01 14:30:19 +01:00
d05c919668 Made the notification_email library compilable with 16.05 and upcoming 16.11 . 2016-11-01 14:22:48 +01:00
087b5d49bb Fixed wsf_js_widget compilation. 2016-11-01 14:01:50 +01:00
c7b1d4bb4c Use the theoretical version number of EiffelStudio when we inserted new features to EiffelNet. 2016-10-31 17:12:55 +01:00
193f22ebc8 Fixed wsf tests project.
Added ini config support to simple_file example.
2016-10-25 15:22:18 +02:00
5e79751522 Updated WGI_OUTPUT_STREAM.put_file_content . 2016-10-25 13:44:44 +02:00
ac908e4efd Fixed expiration, and cache-control: max-age implementation.
Also use `FILE.date` instead of `FILE.change_date` (`change_date` is the date of the last status change, quite often same as creation date, while `date` is the last modification date).
2016-10-24 12:51:21 +02:00
885195dbaa Added WSF_RESPONSE.put_file_content (f: FILE, a_offset: INTEGER; a_count: INTEGER) to allow potential future optimization. 2016-10-24 12:47:33 +02:00
2e49febca8 Fixed the EiffelStudio EiffelWeb wizard. 2016-10-21 19:40:13 +02:00
53f4f64596 Added feature to manipulate easily the chain of filters. 2016-10-21 19:39:42 +02:00
dff9007aa6 Updated (un)install script to include new network, httpd, and websocket libraries. 2016-10-18 13:29:47 +02:00
c34f89df9b Added connection header related functions.
- WSF_REQUEST.is_keep_alive_http_connection: BOOLEAN
  - HTTP_HEADER_MODIFIER.put_connection_keep_alive
  - HTTP_HEADER_MODIFIER.put_connection_close
In Standalone request handler code, better detection of Connection: keep-alive header.
2016-10-18 13:22:32 +02:00
Jocelyn Fiat
4a47a00747 Better all-safe.ecf file under wsf/connector . 2016-10-15 22:37:16 +02:00
Jocelyn Fiat
12508c8e21 Updated to use new standalone option names. 2016-10-15 22:19:19 +02:00
Jocelyn Fiat
3d58ef84fa Fixed void-safety settings on web_socket_protocol.ecf . 2016-10-15 22:14:03 +02:00
Jocelyn Fiat
3a120f3311 Updated http_client library to benefit from http_network library. 2016-10-15 21:42:51 +02:00
Jocelyn Fiat
d45b90e52a Fixed ecf to get them compiled. 2016-10-14 17:57:02 +02:00
c74b9e0c45 The network classes are now under http_network library, thus renamed the header file as ew_network.h . 2016-10-14 16:46:26 +02:00
b8aee435dd Updated simple_ssl example to use directly the standalone connector,
and use the new WSF_STANDALONE_SERVICE_OPTIONS class.
Added WSF_STANDALONE_SERVICE to make it easy to use directly.
2016-10-14 15:13:27 +02:00
Jocelyn Fiat
a4d737d548 Be sure to use ecf custom variable "ssl_enabled" and not the variant "httpd_ssl_enabled" or else.
Include again the openssl include folder for EiffelStudio before 16.11, otherwise eif_openssl is not found.
2016-10-14 14:32:04 +02:00
Jocelyn Fiat
16f667af2c Reverted a few ecf files from ecf version 1-16-0 to ecf version 1-15-0.
Added target "http_network_ssl" to test http_network with ssl support.
2016-10-14 14:00:03 +02:00
Jocelyn Fiat
27a5c9d969 Fixed http_network compilation for EiffelStudio before version 16.11. 2016-10-14 13:51:57 +02:00
32ad7f0c65 Merged changes related to websocket and restructured httpd, http_
network libraries.
2016-10-14 13:17:17 +02:00
78f24ecb37 Updated ws.ini (for now, keep is_secure False, due to remaining issue with websocket and SSL implementation). 2016-10-14 13:11:26 +02:00
1161e541fa Accept "yes" or "true" in wsf launcher option boolean values.
Set socket_error when network occurs in `read_to_managed_pointer_noexception`.
2016-10-14 13:10:44 +02:00
d4ec640ac8 Renamed many classes and feature to use "secure" term instead of "ssl". (note, the .ecf are still using the "ssl" terminologie).
Provided easy way to set secure settings for Standalone.
For wsf launcher boolean option accept "true" or "yes" for True boolean, anything else is False.
2016-10-14 11:52:48 +02:00
01a9d02586 Added websocket examples for the server and client. 2016-10-13 22:01:50 +02:00
1e4203111f Use socket .._noexception functions in websocket networking. 2016-10-13 21:55:53 +02:00
b84f4838f5 Added new WSF_STANDALONE_SERVICE_OPTIONS, a descendant of WSF_SERVICE_LAUNCHER_OPTIONS specialized for standalone connectors. 2016-10-13 21:55:16 +02:00
8b43cb909a Do not use put_readable_string_8_noexception, and just update put_string_8_noexception to accept READABLE_STRING_8. 2016-10-13 21:53:12 +02:00
897f64e4fe Reuse http_network library.
Reintroduced HTTPD_STREAM_SOCKET for backward compatibility, and ease of usage.
Added websocket libraries (client, and protocol).
2016-10-13 16:25:11 +02:00
981942b2d6 Extracted network socket classes from httpd folder, and created a new library/network/http_network library.
Renamed HTTPD_STREAM_SOCKET as HTTP_STREAM_SOCKET.
Made http_client (net) library use the new http_network library.
2016-10-12 23:27:55 +02:00
c132d7734b Moved httpd library from ewsgi/connectors/standalone/lib/httpd to httpd.
Reused the http_network library as well inside httpd library.
2016-10-12 22:54:21 +02:00
Jocelyn Fiat
b66cfce138 Use custom variable net_ssl_enabled instead of httpd_ssl_enabled for the http_netword lib. 2016-10-12 22:23:26 +02:00
d28f794828 Implemented chunked Transfer-Encoding in net_http_client.
Implemented support for buffer_size and chunk_size for net_http_client.
2016-10-12 16:49:08 +02:00
9e92b8c0fa Fixed typo in restbuck name. 2016-10-12 11:21:42 +02:00
ef704790a8 Fixed the "wsf_tests" autocase suite, which was wrong for cookies, and other minor changes. 2016-10-12 11:21:27 +02:00
57b1691243 Added support for debug.ini to debug example. 2016-10-12 11:19:54 +02:00
29590b1c0d Fixed potential issue related to PATH_INFO, and percent_encoded_path_info computing , when script name is in different path. 2016-10-12 11:19:23 +02:00
ed959042d7 Fixed issue with input using "Transfer-Encoding: chunked". 2016-10-12 11:12:37 +02:00
1170417e54 Fixed regression with persistent connection, be sure to keep the remote_info data for all successive requests within a same persistent connection. 2016-10-11 17:34:07 +02:00
2cfe00e61b Updated desktop_app example with embedded standalone web server. 2016-10-11 17:30:50 +02:00
a498a167ed Updated desktop application example for scoop concurrency mode. 2016-10-11 16:20:04 +02:00
f12158e535 Use the ..._noexception network features in the WGI standalone input and output classes. 2016-10-11 10:57:05 +02:00
080881368a Also check for SOCKET.was_error when accessing the socket data. 2016-10-11 10:29:38 +02:00
Jocelyn Fiat
3e935c7e33 Use `was_error' to get expected behavior on Linux. 2016-10-10 22:27:45 +02:00
Jocelyn Fiat
ad2bb0d1a7 Fixed C compilation on non Windows platform for EiffelStudio until 16.05 .
(the required c function are coming with EiffelNet from EiffelStudio 16.11 ).
2016-10-10 22:17:41 +02:00
7a546622bc Updated deprecated EiffelWeb nino to make it compilable with upcoming EiffelStudio 16.11.
Updated various projects to make them up-to-date and compilable with this latest EiffelWeb.
2016-10-10 21:40:15 +02:00
aed7461faf Improved networking implementation for httpd server and sockets.
Use new EiffelNet routines that do not raise exception on error.
Made compilable with 16.05 and dev-and-upcoming release 16.11.
Fixed various minor issues related to base_url, and added comments.
2016-10-08 01:10:16 +02:00
56819d6793 Replace Nino by Standalone whenever it is relevant. 2016-10-08 01:02:12 +02:00
b4fd04ad9f Updated has_incoming_data comment. 2016-10-05 16:19:48 +02:00
71a98f3c28 Make EiffelWeb standalone easier to debug by using in some locations error instead of exception for network error.
- Added C external to use C `recv` feature with error (as opposed to have exception raised on network error).
2016-10-05 10:45:57 +02:00
ed22be2551 Commented the execute_bad_request, since it is not ready and will trigger error most of the time. 2016-10-05 00:04:21 +02:00
77085364ee Improve socket management for EiffelWeb standalone connector. 2016-10-04 18:49:48 +02:00
0217c6d3f4 First attempt to response with bad request message when bad request is detected. 2016-10-04 13:00:38 +02:00
55fec2423c Added ssl test case for standalone wsf connector. 2016-10-04 12:59:56 +02:00
1f7a81a2d6 Updated workbook, minor changes (removed mention about nino, added libfcgi info). 2016-10-04 12:56:11 +02:00
612ff243c1 Also display SSL information when verbose is enabled for EiffelWeb standalone connector. 2016-10-02 20:05:44 +02:00
40fb3893af Include wsf_proxy to the installation process. 2016-09-27 16:18:06 +02:00
21407f8dcf Fixed SSL support on the httpd component, and also on the EiffelWeb standalone connector.
- the standalone connector support for SSL, is using certicate files for now (no in-memory support).
  - to enable ssl support, set ecf variable `httpd_ssl_enabled=true`.
  - added the `simple_ssl` example to demonstrate how to have standalone ssl server.
    (be careful when using EiffelNet SSL and the http_client library, disable the libcurl
      via ecf variable `libcurl_http_client_disabled=true` )

Added support for recv timeout to the EiffelWeb standalone connector.
  - made EiffelWeb compilable with 16.05 and upcoming 16.11.
    Done via ecfs condition on version to accept EiffelNet with recv_timeout (from 16.11), and without (until 16.05).
  - adding recv timeout prevents server to hang for ever if a client wait too long to send data.

Updated various comments.
2016-09-27 16:11:47 +02:00
356eb143ea Fixed the non void-safe ecf for wsf_proxy. 2016-09-26 17:42:49 +02:00
df551d4a4f Use latest API from http_client using DEFAULT_HTTP_CLIENT,
that could use libcurl or EiffelNet depending on the configuration (.ecf).
2016-09-26 13:13:57 +02:00
f010da04e9 Merge branch 'reverse_proxy' 2016-09-19 22:19:21 +02:00
5029049ef0 Replaced host+port by uri (http://remotemachine:port/path).
Added support for SSL (https).
2016-08-08 12:30:28 +02:00
80254b2278 When possible keep ecf location relative within the same EiffelWeb directory structure. 2016-08-06 10:07:42 +02:00
210fae5000 First step towards SSL support. 2016-08-06 10:04:45 +02:00
9cc9b95190 Added a simple reverse proxy handler.
- For now, it does not support SSL connection on the target yet.
- No external config file support, this is all about coding.
2016-08-05 11:38:35 +02:00
8b172b5d33 Revisited WSF_REQUEST.read_input_data* functions:
- read_input_data_into_file now accepts a IO_MEDIUM argument instead of just FILE.
- cleaned the implementation, and make sure that eventual `raw_input_data` is containing only the raw input data.
2016-08-05 11:32:14 +02:00
cc2d7dbb1c Ignore empty header line. 2016-08-05 11:28:59 +02:00
c88394b9fd Added support for category in ATOM format (input and output). 2016-06-24 13:03:09 +02:00
4283662f43 Removed unwanted .ecf file. 2016-06-22 10:55:41 +02:00
1b951376f9 Added more application logic for the example. 2016-06-22 10:52:36 +02:00
193cc3cbde Renamed WGI_STANDALONE_CONNECTOR_ACCESS as WGI_STANDALONE_CONNECTOR_EXPORTER.
Isolate the websocket implementation in descendant of {WEB_SOCKET_EVENT_I}.
Added very simple echo websocket example.
+ code cleaning.
2016-06-22 10:46:15 +02:00
b49e841ac7 Added WSF standalone_websocket connector, that provides websocket on top of standalone connector. 2016-06-21 23:37:48 +02:00
8ba74e1c90 Log when a persistent connection is reused.
Use anchor type on `{WGI_STANDALONE_CONNECTOR}.configuration` and `{WSF_STANDALONE_SERVICE_LAUNCHER}.connector`.
Add access to the socket of standalone input stream from `{WSF_STANDALONE_CONNECTOR_ACCESS}`.
Removed a useless redefination in `WSF_EXECUTION`.
2016-06-21 23:36:22 +02:00
0cecb9594c Fixed signature of {HTTPD_CONFIGURATION_I}.set_ca_key . 2016-06-16 10:37:26 +02:00
e384a6d6ed Make it easier to reuse the http network classes.
This is to make it easier for websocket solution to reuse httpd implementation.
2016-06-16 10:23:30 +02:00
71a5c086a5 Moved httpd from src to lib, under standalone connector. 2016-06-15 18:04:00 +02:00
dfa60bf8f5 Prepared httpd_stream to be useable for client too.
Fixed obsolete tests/dev compilation (mainly to avoid wrong failure reports).
added package.iron files.
2016-06-15 17:56:22 +02:00
113aa69efc Added advanced settings for standalone connector
- max_concurrent_connections=100
- keep_alive_timeout=15
- max_tcp_clients=100
- socket_timeout=300
- max_keep_alive_requests=300
And then can be set via the options as well, and via .ini file.
Also improved the verbose console output system.
2016-06-15 09:19:23 +02:00
af5fc75743 Using passive regions.
Improve connector options mainly for standalone connector.
Updated "simple" example to return a timestamp.
2016-06-14 16:01:37 +02:00
Jocelyn Fiat
e53c960a89 Added libfcgi target, in addition to standalone target for the upload_image example. 2016-05-31 22:24:26 +02:00
Jocelyn Fiat
63be2c278c Fixed bad usage of {SOCKET}.socket_ok that resulted in bad behavior on linux. 2016-05-31 22:19:52 +02:00
Jocelyn Fiat
f8ba741aa2 Using -lfcgi as external linker flag, rather than /usr/lib/libfcgi.so .
Note on Ubuntu: apt-get install libfcgi-dev
2016-05-31 18:51:15 +02:00
Jocelyn Fiat
fe07af587d Updated link to github pages documentation. 2016-05-31 16:57:06 +02:00
Jocelyn Fiat
a3a9dd1393 Fixed link to image or source code in markdown workbook text. 2016-05-31 16:51:20 +02:00
Jocelyn Fiat
fbb860024d Updated markdown text to conform strictly to kramdown syntax. 2016-05-31 16:39:50 +02:00
Jocelyn Fiat
a14488346f Updated to kramdown markdown syntax (i.e github).
Updated various content and nav links.
2016-05-27 09:51:24 +02:00
Jocelyn Fiat
f74d1b3069 Updated markdown relative links. 2016-05-26 23:11:19 +02:00
Jocelyn Fiat
1ba3528974 Added readme.md in /doc/. And updated workbook readme.md itself. 2016-05-26 10:41:07 +02:00
5890ca6f73 Removed warning about unknown class in export clause. 2016-05-25 22:51:45 +02:00
7f4bf09d84 updated readme.md to link to workbook. 2016-05-25 19:17:38 +02:00
Colin Adams
ad90e7c135 Fix for missing error reporting in WSF_PUT/POST_HELPER 2016-05-20 17:37:47 +02:00
cc3c8af6b4 Updated HTTP_COOKIE implementation
- by default the Cookie does not set max-age and expires, so it defines a Session Cookie.
   (max_age and expires attributes are not included in the response)
 - set_* and unset_* features to define max_age and expire attributes.
 - marked old features as obsolete.
Updated test cases.

Signed-off-by: jvelilla <javier.hector@gmail.com>
2016-05-04 12:26:17 +02:00
b35ec65577 Updated EWF Windows tools to install EWF into EiffelStudio source tree. 2016-02-03 18:03:43 +01:00
4482520a86 Removed useless library declarations. 2016-02-03 15:12:54 +01:00
e9afc9ad17 Updated package.iron files. 2016-02-02 09:57:03 +01:00
55ab6969ee Do not html escape ' with &apos;
reason: the named character reference &apos; (the apostrophe, U+0027) was introduced in XML 1.0 but does not appear in HTML. Authors should therefore use &#39; instead of &apos; to work as expected in HTML 4 user agents.
2016-01-20 17:53:06 +01:00
d982bc06ad Eiffel code and ECFs update to support new agent notations. 2016-01-18 21:42:59 +01:00
2ca87d53b8 Added process_transfer to implement process_file. This way, it is easier to redefine the transfert implementation, or the process_file directly, if needed. 2016-01-18 17:05:35 +01:00
1a4db1d7c6 Eiffel code and ECFs update to support new agent notations.
Removed contrib/library/.../json library.
2016-01-18 16:41:10 +01:00
3bb9101b07 Improved error library by refactorying the sync as two way propagation.
Now one can setup error handler propagation in one way, or two way (sync).
The "reset" applies in both way, even if this is a one way propagation to fit current existing usage.
Added optional id for the error handlers.
Feature renaming according to design changes.
Added related autotest cases.
2016-01-12 16:09:29 +01:00
1b2496b7f0 Better EMAIL.message computing.
Send end of input file for stdin mode.
2016-01-12 16:04:24 +01:00
d20c377580 Fixed Reply-To: implementation in notification mailer.
Added helper routines to query additional header, and reset Cc:, and Bcc: values.
2016-01-08 21:46:01 +01:00
166d0839b7 Fixed end_of_input by using SOCKET.readable. 2015-12-28 23:45:04 +01:00
fbe0732210 Removed uuid in wsf_session ecf files. 2015-12-28 18:05:18 +01:00
b5d6a75155 Fixed table item output by appending html attribute for WSF widget table item. 2015-12-28 17:40:59 +01:00
4fc4b02449 Made WSF_TABLE a TABLE_ITERABLE. 2015-12-28 17:40:20 +01:00
5276bd1479 Fixed URI mapping with regard to trailing slash handling. 2015-12-28 17:39:54 +01:00
Javier Velilla
81ab31b19a Updated workbook
Added EWF Deployment title
2015-12-22 11:44:21 -03:00
Javier Velilla
e21e30ff74 Updated workbook
Added deployment document
2015-12-22 11:43:17 -03:00
Javier Velilla
3a9ba75717 Initial commit Deployment file 2015-12-22 11:37:25 -03:00
7d94413297 removed non void-safe tests.ecf for feeds library 2015-11-05 21:48:17 +01:00
35855941e6 Comment and code cleaning. 2015-11-05 21:37:44 +01:00
50ba8ca703 Fixed various unicode issue related to query and form parameters.
(Especially for the multipart/form-data encoding.)
Factorized code related to smart parameters computing (handling list , table, ...) in WSF_VALUE_UTILITIES.
Fixed an issue with percent_encoded_path_info computation from request_uri.
Fixed issue with cookie addition having same cookie name.
Fixed unicode support for uploaded file.
WSF_STRING is reusing WSF_PERCENT_ENCODER.
Use unicode output for WSF_DEBUG_HANDLER.
Code cleaning
2015-11-05 21:32:24 +01:00
dde6a0b7de Added specific configuration file, so that it is easier to use either libcurl or net implementation. 2015-10-19 08:46:31 +02:00
b64a281d75 Fixed timeout issue due to too many "ready_for_reading".
Fixed Connection behavior.
Fixed Content-Type settings.
Removed condition on POST or PUT, since code also applied to any request methods.
Added verbose output implementation.
2015-10-19 08:46:30 +02:00
b69b8aaaf9 Added first support for persistent connection in NET http client implementation.
Various improvement related to eventual errors.
2015-10-19 08:46:29 +02:00
65b28ed877 Updated README.md with configuration topics related to libcurl or net disabling.
Fixed ssl test by precising insecure ssl.
2015-10-19 08:46:27 +02:00
6c7637716b Updated a few comments
Removed useless NULL_HTTP_CLIENT.
Extracted mime code from NET_HTTP_CLIENT_REQUEST.response into specific routine.
2015-10-19 08:46:26 +02:00
ff9a238f5c Added https support with Net implementation.
Added notion of default HTTP_CLIENT, to be able to build portable code among http client implementation.
2015-10-19 08:46:25 +02:00
eec3cbdba1 Added null http client for upcoming changes.
Refactored NET request implementation.
  - fixed potential issue with header conflict.
  - simplified, and extract parts of the code into routine.
  - Implemented read of chunked Transfer-Encoding
  - Fixed potential issue with socket handling.
First steps to be able to exclude net or libcurl implementation when using http_client lib.
Removed from NET implementation the hack related to PUT and upload data (it was used to workaround an issue with libcurl).
2015-10-19 08:46:23 +02:00
29c4931dc0 Added support for chunked transfer-encoding response.
Implemented correctly the redirection support for NET_HTTP_CLIENT...
Added the possibility to use HTTP/1.0 .
Splitted the manual tests that were using during development.
First step to redesign and clean the new code.
2015-10-19 08:46:22 +02:00
Florian Jacky
9cd0f0b117 Fixed configuration files 2015-10-19 08:46:21 +02:00
Florian Jacky
aa0eb4fc43 Fixed configuration files 2015-10-19 08:46:20 +02:00
Florian Jacky
dbdc594b59 config files 2015-10-19 08:46:18 +02:00
Florian Jacky
4176a8c68b correct password for authentication test 2015-10-19 08:46:17 +02:00
Florian Jacky
0557d1ee2d added remaining features 2015-10-19 08:46:16 +02:00
Florian Jacky
eed8af9a0a now supports sending requests, receiving headers, receiving message text, redirection, agent header, cookies, basic http authorization, sending data using post using url-encoding, sending file as post as data, sending put data 2015-10-19 08:46:15 +02:00
Florian Jacky
1b881c4f60 implemented http authorization, support for redirection and user-agent 2015-10-19 08:46:14 +02:00
Florian Jacky
770488dbd3 implemented http authorization, support for redirection and user-agent 2015-10-19 08:46:12 +02:00
3f69081d32 Added postcondition to ensure the result of {HTTP_CLIENT_REQUEST}.response is attached.
(useless with void-safety compilation, but keep it for non void-safe execution).
2015-10-19 08:46:11 +02:00
7033db7dc4 Removed useless redefination of is_equal. 2015-10-19 08:46:10 +02:00
a1a16b4a22 Fixing http_client.ecf file with correct locations. 2015-10-19 08:46:09 +02:00
98e92ee0fe Basic initial Eiffel NET implementation. 2015-10-19 08:46:07 +02:00
29b55f36cf Added skeleton for Eiffel Net implementation of HTTP_CLIENT solution.
This is work in progress.
2015-10-19 08:46:06 +02:00
061e88c9fe Added FEED.prune (a_item: FEED_ITEM). 2015-10-14 17:40:38 +02:00
66f204b1f2 Make custom error interface more flexible with READABLE_STRING_... instead of STRING_... 2015-10-10 00:58:07 +02:00
c92b1b8c3b Added feed to xhtml visitor.
Updated interfaces, mainly related to date attributes.
2015-10-09 19:08:53 +02:00
98c12b8fb9 Made HTTP_DATE more flexible and support UTC+0000, GMT+0000 and now also +0000.
Added comments.
2015-10-08 11:00:01 +02:00
5fee483fd9 Added FEED + FEED operator to merge two feeds.
Added FEED sorting routine.
Added FEED_ITEM.link: detachable FEED_LINK that represents the main feed link.
Comments.
2015-10-08 10:10:08 +02:00
f7a7afccd6 Fixed compilation of non void-safe feed.ecf 2015-10-05 22:58:58 +02:00
e2c70e6d70 Updated a few comments.
Renamed generator to follow *_FEED_GENERATOR naming.
Renamed feed entry as feed item.
Made FEED conforms to ITERABLE [FEED_ITEM] for convenience.
2015-09-16 10:02:09 +02:00
a5e150d1c0 Improved feed library with comments, bug fixes and code factorization. 2015-09-08 21:45:27 +02:00
39887c8bdb Added initial ATOM and RSS feed parser and generator.
(work in progress)
2015-09-07 19:22:50 +02:00
jvelilla
1f1e2abbda Removed support for SSLv3 2015-08-26 11:56:24 -03:00
1796d9631f Added target "all_stable_with_ssl" to check compilation with ssl enabled. 2015-08-26 13:38:50 +02:00
389975e409 Merge branch 'v1' 2015-08-24 16:13:01 +02:00
6c51590369 Updated installation location of openid and http_authorization in ISE package.
Added iron package file for ewsgi.
2015-08-24 16:12:25 +02:00
jvelilla
cc65bae644 Fixed typo: Aug instead of Aou. 2015-08-06 10:45:47 +02:00
jvelilla
c824f707cf Fixed typo: Aug instead of Aou. 2015-08-06 10:42:15 +02:00
47c5b798b3 Cosmetic true -> True 2015-08-04 13:24:03 +02:00
f0cba1d536 Fixing script_url' that wrongly used path_info' instead of `percent_encoded_path_info'.
(issue on script_url when path info contains unicode character).
2015-08-04 13:21:36 +02:00
ed891546bc Updated set_value for WSF_FORM_SELECTABLE_INPUT (for example a checkbox).
Call the feature set_checked_by_value iff the the current value exist in the
list of values, in other case set checked in Flase.
If we call set_checked_by_value without filter, previous checked values will be
set in False.
2015-08-04 13:21:07 +02:00
8651ff6e1e Fixing script_url' that wrongly used path_info' instead of `percent_encoded_path_info'.
(issue on script_url when path info contains unicode character).
2015-08-04 13:03:51 +02:00
629edea991 Merge remote-tracking branch 'javier/ewf_html_form' into v1 2015-08-04 13:00:08 +02:00
jvelilla
1e10ce8518 Updated set_value for WSF_FORM_SELECTABLE_INPUT (for example a checkbox).
Call the feature set_checked_by_value iff the the current value exist in the
list of values, in other case set checked in Flase.
If we call set_checked_by_value without filter, previous checked values will be
set in False.
2015-07-31 11:55:23 -03:00
4f8f17ad48 Fixed various compilation issues.
Ensure the obsolete/v0 ecf has new UUID.
2015-07-03 20:02:13 +02:00
148518984e Added the possibility to provide the sendmail location in NOTIFICATION_SENDMAIL_MAILER.
Added NOTIFICATION_STORAGE_MAILER which allow to store the email in a storage (could be just output, file, database ...)
Added SMTP implementation, based on EiffelNet SMTP_PROTOCOL.
   note: it is possible to exclude this by setting ecf variable "smtp_notification_email_disabled" to "True"
   this way help to manage dependencies, since the Eiffel Net library would not be included neither.
Fixed Date header value computation.
2015-07-03 10:02:56 +02:00
33150e34d6 Reverted previous changed related to redefinition of set_status_code which was against existing assertions. 2015-07-02 15:11:33 +02:00
af60a5719e Updated eiffelstudio locations for EWF libraries. 2015-07-02 13:06:38 +02:00
31557cfc33 Fixed WGI_HTTPD_REQUEST_HANDLER.process_rescue
Fixed WGI_STANDALONE_OUTPUT_STREAM.is_available
Added WGI_STANDALONE_RESPONSE_STREAM.is_persistent_connection_supported
2015-07-02 10:50:41 +02:00
78c0cd5b0d Merge branch 'v1' of https://github.com/EiffelWebFramework/EWF into v1 2015-07-01 21:48:47 +02:00
412534d0be Fixed compilation of all*-safe.ecf files.
Corrected a few comments.
2015-07-01 21:43:54 +02:00
jvelilla
0f6aa8d7ae Merge branch 'jvelilla-ewf_v1_workbook' into v1 2015-06-30 09:58:40 -03:00
jvelilla
2c745c63d3 Updated workbook: generating response, handling cookies and headers documents. 2015-06-30 09:21:12 -03:00
jvelilla
efd80c1287 Updated workbook form document 2015-06-30 09:00:47 -03:00
jvelilla
01f649fd88 Updated: workbook headers document.
Removed: unnecessary files.
2015-06-30 08:57:00 -03:00
jvelilla
f23aeb6412 Updated Workbook basic documentation. 2015-06-30 08:42:29 -03:00
jvelilla
1a4596c79b Merge branch 'ewf_v1_workbook' of https://github.com/jvelilla/EWF into ewf_v1_workbook 2015-06-29 19:05:25 -03:00
jvelilla
b16e4aa570 Updated basic documentation 2015-06-29 19:03:54 -03:00
Javier Velilla
5255b15fa9 Update basics.md 2015-06-29 18:36:44 -03:00
jvelilla
57048373f4 Update basic document 2015-06-29 18:30:11 -03:00
Javier Velilla
9e06fb2ab8 Update basics.md 2015-06-29 16:24:09 -03:00
Javier Velilla
f2405e0ccd Update basics.md 2015-06-29 16:22:01 -03:00
Javier Velilla
6e3a7deb6e Update workbook.md 2015-06-29 16:20:19 -03:00
jvelilla
f254b599c0 Update basic document to the new EWF concurrent design 2015-06-29 16:17:43 -03:00
99a05b95ba Improved code related to cookie management (avoid duplicated cookie). 2015-06-22 22:06:16 +02:00
54dd43c38a Synchronized wsf-safe.ecf and wsf.ecf 2015-06-18 14:53:19 +02:00
903f925a79 Changed the way SSL is supported with standalone connector (httpd lib).
Now by default, SSL is not supported,
  and if an application wants the SSL support,
  the related .ecf has to set custom variable "httpd_ssl_enabled" to "true"
2015-06-17 17:22:59 +02:00
80709578d6 Updated workbook Eiffel code to follow new EWF concurrent design. 2015-06-16 20:34:57 +02:00
c0d5b7c968 Added make_from_execution procedure to ease implementing various use cases. 2015-06-16 15:02:17 +02:00
7bea163f46 Updated ecf from obsolete v0 folder to include the "_v0" suffix in the library names. 2015-06-14 21:34:41 +02:00
8992dbc515 Added wsf_html in the obsolete v0 folder.
mostly because it is also dependent on "wsf", so it has to be using the obsolete v0 ecf.
2015-06-12 19:01:35 +02:00
c2d3ea6138 Simplified file names, and harmonized with estudio wizards. 2015-06-12 12:56:46 +02:00
9e336deb49 Updated EWF estudio wizard. 2015-06-12 12:43:54 +02:00
0160ce05dd Updated wizard template ecf to take into account current limitation, or known issue related to libcurl and ssl. 2015-06-12 12:00:54 +02:00
7d089a88c2 Made compilable without SSL enabled
(i.e when variable named "httpd_ssl_disabled" is set to "true")
2015-06-11 10:08:44 +02:00
ab0bc7b314 Marked most of the *_with_request_methods procedure obsolete by the same feature name without the "_with_request_methods".
Added argument passing request methods to feature without the _with_request_methods.
Prefer "thread" concurrency for now in examples.
2015-06-10 17:52:26 +02:00
0e3e97a7fd Added a few example based on the obsolete libraries (v0).
Updated the tutorial example.
Added WSF_MESSAGE_EXECUTION.
2015-06-10 16:49:23 +02:00
b790c7fd21 cosmetic, cleaning. 2015-06-10 10:59:24 +02:00
d0836d49a4 Merge branch 'v1' 2015-06-10 09:49:28 +02:00
9424b1e369 Merge branch 'master' into v1 2015-06-08 10:10:51 +02:00
64463df552 Fixed various compilation error or warning. 2015-06-05 12:17:53 +02:00
jvelilla
61f90bba38 Merge branch 'jvelilla-ewf_wsf_html5' 2015-05-29 15:38:30 -03:00
jvelilla
fac3dd3946 Merge branch 'ewf_wsf_html5' of https://github.com/jvelilla/EWF into jvelilla-ewf_wsf_html5 2015-05-29 15:38:08 -03:00
jvelilla
e1b583a2b3 Updated code based on comments 2015-05-28 10:07:40 -03:00
jvelilla
8c8dfdd4a3 Updated code based on review 2015-05-28 10:04:13 -03:00
jvelilla
857397e226 Updated code inherit from SHARED_HTML_ENCODER instead of creating new objects. 2015-05-28 09:39:14 -03:00
jvelilla
94340c1c01 Updated html5 classes based on review 2015-05-28 09:19:21 -03:00
8b60ab08e3 Added WSF_FILE_UTILITIES.new_file (p: PATH): detachable G
in order to provide non existing file, but not only for temporary files purpose.
2015-05-22 22:27:28 +02:00
jvelilla
28e51cc314 Initial import HTML5 support for attributes and input types.
Attributes
- Added support for new HTML5 attributes.
missing support for : form, list, and multiple attributes.

Input types: added the all the new input types.

Added test cases, still in progress.
2015-05-21 12:32:08 -03:00
jvelilla
a7c8d40b3e Moved EWF workbook from ewf_example to EWF main repository. 2015-05-18 11:06:04 -03:00
d4c0ff03b4 Added package.iron for nino library. 2015-05-12 19:04:36 +02:00
7fbfda3a66 Refactored wsf router dispatching implementation.
Now the path to take into account during dispatching is computed once
  in WSF_ROUTER.path_to_dispatch (req: WSF_REQUEST): READABLE_STRING_8
  And this function could be redefined in descendant of WSF_ROUTER.
2015-05-12 18:37:25 +02:00
9e467689df improved nino port number validation 2015-05-12 18:25:22 +02:00
dd5c89e31c Fixed compilation of SSL_TCP_STREAM_SOCKET with recent do_accept changes. 2015-05-07 10:44:38 +02:00
fffa763d05 Updated a few comments. 2015-05-06 22:37:55 +02:00
d015c065f6 Updated readme. 2015-05-06 22:18:27 +02:00
8ea443c115 Added abstraction WSF_ROUTED, and WSF_FILTERED.
Added under library/server/obsolete/v0 the previous non concurrent friendly version of EWF/WSF, for backward compatiblity.
Removed WSF_CALLBACK_SERVICE and WSF_TO_WGI_SERVICE which are not need with new EWF.
2015-05-06 22:17:37 +02:00
019393fdb1 Fixed typo. 2015-05-06 22:17:35 +02:00
da8028f8b3 Fixed a typo. 2015-05-06 22:17:33 +02:00
20ed000879 Added a few descriptions and comments. 2015-05-06 22:16:57 +02:00
jvelilla
24620b228c Added feature comments.
Added missing postconditions.
2015-05-06 22:16:10 +02:00
jvelilla
9c7e29b836 Added descriptions and comments 2015-05-06 22:16:08 +02:00
jvelilla
a0e9a41e21 Added descriptions and feature comments. 2015-05-06 22:16:07 +02:00
jvelilla
dd9aff03d3 Added features comments. 2015-05-06 22:16:05 +02:00
jvelilla
dc35925eb0 Added Missing Class and feature descriptions.
Removed author entry.
2015-05-06 22:16:03 +02:00
a1a620a9c3 Export request and response from WGI_EXECUTION to itself.
Added WSF_FILTERED_ROUTED_SKELETON_EXECUTION
2015-05-06 22:16:00 +02:00
d8ea9ba63c renamed keep_alive_requested as is_persistent_connection_requested. 2015-05-06 22:15:59 +02:00
c42af5b2de Following the spec, use "keep-alive" and "close" in lowercase for Connection header. 2015-05-06 22:15:57 +02:00
d9cbc72058 Better support for HTTP/1.0 and also related to persistent connection. 2015-05-06 22:15:56 +02:00
7e057b20b1 Improved support for HTTP/1.0 persistent connection. 2015-05-06 22:15:54 +02:00
3165c1e5c6 Enable support for persistent connections.
(test: works fine with curl -k , but weird behavior with ab -k ...)
2015-05-06 22:15:53 +02:00
89e26519e4 First step to improve a bit error handling related to socket disconnection.
Mainly in standalone connector for now.
2015-05-06 22:15:51 +02:00
9d20e85c03 Improved the simple_file example with image, and not found message.
Use standalone connector in SCOOP concurrency mode.
2015-05-06 22:15:50 +02:00
48cb99498c Cleaned simple example, and made the standalone target with SCOOP concurrency. 2015-05-06 22:15:48 +02:00
8246bc1444 Updated various indexing notes.
Removed a few obsolete classes.
Cosmetics
2015-05-06 22:15:46 +02:00
9e1083eba8 Added migration note. 2015-05-06 22:15:44 +02:00
4907bc3085 Migrated most of the example and library to new design. 2015-05-06 22:15:43 +02:00
7d2ce8a77f Implemented support for base url in httpd connector. 2015-05-06 22:15:38 +02:00
b4a9c92ffc Migrated simple, simple_file and upload_image example.
Adapted EWF accordingly.
2015-05-06 22:14:48 +02:00
bf0eb9a02d Added SCOOP support for WSF.
WSF_SERVICE is deeply changed, and addition of WSF_EXECUTION.
Todo: code cleaning, removing useless things.
2015-05-06 22:13:22 +02:00
ddf73077b3 Support for concurrencies: none, thread and SCOOP 2015-05-06 22:13:19 +02:00
3da80fce0d Finally SCOOP supported. 2015-05-06 22:13:17 +02:00
0970de5dc6 Experiment to avoid pseudo sequential execution 2015-05-06 22:13:15 +02:00
557b11f4e6 First attempt to use `{NETWORK_STREAM_SOCKET}.accept_to' 2015-05-06 22:13:13 +02:00
7f27a6c797 First steps to provide a concurrent compliant EWF connector. 2015-05-06 22:13:11 +02:00
c778e454cd Renamed a few index.md as README.md 2015-05-05 11:13:12 +02:00
44757b73eb Renamed Home.md as README.md 2015-05-05 11:10:36 +02:00
525978db1d Update doc structure, and fixed a few links. 2015-05-05 10:57:58 +02:00
71c90a2f39 Updated mediawiki and markdown link to local pages,
in order to use those files as browseable documentation, and close the github wiki.
2015-05-05 10:22:21 +02:00
8057dca032 Merge remote-tracking branch 'ewf_wiki/master' 2015-05-05 10:06:12 +02:00
91d7b956b9 update README to add google groups info. 2015-05-05 09:58:36 +02:00
881625a0f6 Updated code to remove obsolete call on recent version of json library.
Updated upload_image example to use PATH instead of DIRECTORY_NAME or similar.
Removed unused local variables.
2015-04-07 19:27:30 +02:00
b7a12eddaf Merge branch 'master' of https://github.com/eiffelhub/json 2015-04-07 18:36:38 +02:00
jvelilla
44b1ccbc3c Merge branch 'jvelilla-ewf_cookie' 2015-03-20 09:35:51 -03:00
jvelilla
30261632f6 Updated HTTP_COOKIE, enable to add a cookie with empty value.
Added feature to check if a date is valid rcf1123 is_valid_rfc1123_date.
Added test cases related to valid cookie dates.
Updated wsf_response add_cookie basedo on review comments.
2015-03-19 15:23:06 -03:00
jvelilla
08db0748f4 Updated is_valid_character, using NATURAL_32 as an argument to avoid multiple conversions.
Updated add_cookie, added features has_cookie_name and is_cookie line to avoid the use of
STRING.split and STRING.start_with.
2015-03-19 09:39:41 -03:00
jvelilla
9dc22bee24 Updated HTTP_COOKIE class based on comments.
Added missing descriptions in test classes
2015-03-17 17:00:07 -03:00
jvelilla
c4d362ff31 Added the add_cookie feature
Added test cases to check cookies in WSF_RESPONSE-
Added mock classes use for test cases.
2015-03-17 14:27:53 -03:00
jvelilla
4a35ff7b77 Updated code based on Jocelyn's comments. 2015-03-13 17:41:48 -03:00
jvelilla
871e9792a5 Added HTTP_COOKIE and test cases.
Added WSF_COOKIE class, inherit from HTTP_COOKIE.
2015-03-13 15:28:38 -03:00
5f4ab50bf9 Completed configuration setting to be compilable with recent changes in EiffelNet / NETWORK_STREAM_SOCKET interface. 2015-03-12 22:16:28 +01:00
f0a49aaf0a fixed location of before_15_01 folder. 2015-03-11 14:52:14 +01:00
1aae58e00b Removed the -safe since now new project should be void-safe 2015-03-05 20:37:28 +01:00
f81e5251e8 moved wizard under tools/estudio_wizard 2015-03-05 16:01:45 +01:00
b26504b4a1 moved wizard from tools to helpers 2015-03-05 16:00:43 +01:00
4eddad0bcb Updated script to install wizard in current EiffelStudio installation. 2015-03-05 15:27:29 +01:00
1b9aa0c598 Updated the ewf estudio wizard to have a console and a graphical wizard.
Usage:  wizard -callback file.cb path-to-rootdir folder.
2015-03-05 15:23:13 +01:00
6e52774507 Prepare nino ecf to be compilable with upcoming changes in EiffelNet / NETWORK_STREAM_SOCKET interface.
As EiffelNet release is related to EiffelStudio release,
   the condition "compiler version <= 15.02) is used,
   which means that before for release 15.01 and previous EiffelStudio
   releases, the project uses a specific TCP_STREAM_SOCKET, and for
   upcoming releases, it will use another version of that class).
  (see rev#96640 from eiffelstudio subversion repository)
2015-02-18 10:14:08 +01:00
e5403462bc Prepare nino ecf to be compilable with upcoming changes in EiffelNet / NETWORK_STREAM_SOCKET interface.
(see rev#96640 from eiffelstudio subversion repository)
2015-02-18 10:08:36 +01:00
33b555ff27 Fixed implementation of JSON_PARSER.is_valid_number (STRING): BOOLEAN 2015-01-08 18:57:31 +01:00
4c552671c1 Updated install_ewf.bat to use the new "ecf_tool" from https://svn.eiffel.com/eiffelstudio/trunk/Src/tools/ecf_tool . 2014-12-02 10:51:08 +01:00
25a362d043 Added more test cases for cookies. 2014-12-02 10:50:29 +01:00
023e03bb8f Completed change on debug handler and filter, to use WSF_DEBUG_INFORMATION. 2014-12-02 10:45:33 +01:00
0caad2105f Merge branch 'fix_cgi_value' of github.com:jocelyn/EWF 2014-12-01 15:53:45 +01:00
f14fdc2a69 Added assertions on router helpers, and also agent handler.
Closes issue #159
2014-12-01 15:44:49 +01:00
440d3f9c91 Fixing issues related to status code. 2014-11-28 16:10:50 +01:00
975ef90bab Better code for restbucks ORDER_HANDLER related to allowed_cross_origins and last_modified. 2014-11-28 16:06:30 +01:00
8c63e74b81 Fixed compilation of restbucks example using the policy driven framework. 2014-11-25 22:19:46 +01:00
6b9d248542 WSF_TRACE_RESPONSE should include "Content-Type: message/http" header
Close issue #145
2014-11-25 15:55:48 +01:00
6d2318ac9b Fixed issue#157 (WSF_REQUEST.cookies_table does not terminate on cookies without a value, or ending with semi-colon)
Added related autotest.
2014-11-24 22:22:12 +01:00
Colin Adams
0f76518b63 Added {WSF_REQUEST}.http_content_encoding 2014-11-19 14:41:50 +00:00
Colin Adams
bb5faec3c6 Issue #154 (documentation error in {WSF_SKELETON_HANDLER}.check_request) 2014-11-19 10:35:06 +00:00
Colin Adams
22301fc15d issue #149 (Simple CORS support for GET requests in policy-driven framework) 2014-11-18 16:02:10 +00:00
Colin Adams
f482ef06d5 Issue #150 (VARY header set to header contents rather than heqader name) 2014-11-18 13:48:38 +00:00
Colin Adams
4f62da8f90 Issue #144 (Add last_modified to WSF_SKELETON_HANDLER) 2014-11-18 10:37:36 +00:00
Jocelyn Fiat
eaa3dd435a Merge pull request #148 from colin-adams/response-code-411
Policy-driven framework should reject PUT requests that contain a Content-Range header

Close Issue #143
2014-11-17 17:37:06 +01:00
Colin Adams
e1d1d52260 Issue #143 2014-11-17 16:20:28 +00:00
0cc0ba047f Reintroduced parse_object as obsolete, to avoid breaking existing code. 2014-11-17 16:05:33 +01:00
641e114fed Converted ecf file to complete void-safe.
Improved JSON_PRETTY_STRING_VISITOR to support STRING_8 or STRING_32 output.
Added examples.
Added doc in the folder "doc".
Updated Readme and other files.
Added package.iron file.
2014-11-17 11:22:33 +01:00
73d45c9817 Updated WSF_FILE_UTILITIES with class comment,
and avoid having expanded generic class.
2014-10-28 12:52:23 +01:00
519b959073 Fixed compilation issue for wsf_js_widget package. 2014-10-10 16:06:03 +02:00
2cc751f326 Fixed compilation for wsf tests. 2014-10-10 14:26:50 +02:00
99588faf40 fixed compilation of filter example. 2014-10-10 13:51:20 +02:00
Jocelyn Fiat
9c6b6b978a Merge pull request #11 from jocelyn/improved_sept_2014
Fixed various issue with parsing string (such as \t and related),
    Implemented escaping of slash '/' only in case of '</' to avoid potential issue with javascript and </script>
    Many feature renaming to match Eiffel style and naming convention, kept previous feature as obsolete.
    Restructured the library to make easy extraction of "converter" classes if needed in the future.
    Marked converters classes as obsolete.
    Updated part of the code to use new feature names.
    Updated license and copyright.
    Updated classes with bottom indexing notes related to copyright and license.
2014-10-03 18:46:00 +02:00
0647a74875 Ensure backward compatibility for parse' / is_parsed'. 2014-10-03 18:44:09 +02:00
Jocelyn Fiat
de9d99e6bc Merge pull request #140 from jvelilla/ewf_router
Updated WSF_ROUTER, to import an existing router definition.
2014-10-01 19:41:38 +02:00
ae9f67391c Marked converters classes as obsolete. 2014-09-30 10:46:28 +02:00
82f832a556 Updated license and copyright.
Updated classes with bottom indexing notes related to copyright and license.
2014-09-30 10:46:12 +02:00
19dbbf89e7 Fixed various issue with parsing string (such as \t and related),
Implemented escaping of slash '/' only in case of '</' to avoid potential issue with javascript and </script>
Many feature renaming to match Eiffel style and naming convention, kept previous feature as obsolete.
Restructured the library to make easy extraction of "converter" classes if needed in the future.
Updated part of the code to use new feature names.
2014-09-24 20:08:12 +02:00
Olivier Ligot
5d6e3c69ee Fix filter example: logging filter must be the last one 2014-09-18 13:29:24 +02:00
Olivier Ligot
984d04e972 Filter example: add fcgi target 2014-09-17 17:11:37 +02:00
Olivier Ligot
83486ae0cc Fix authentication filter: use {HTTP_AUTHORIZATION}.is_basic 2014-09-17 15:40:43 +02:00
jvelilla
4fe5c5da7e Updated WSF_ROUTER.import feature. 2014-09-12 10:54:22 -03:00
jvelilla
ec1d8ca52f Updated WSF_ROUTER, to import an existing router definition. 2014-09-10 12:57:34 -03:00
Olivier Ligot
0404627153 Merge remote-tracking branch 'upstream/master' 2014-07-11 15:00:20 +02:00
jvelilla
de282948e6 Merge pull request #9 from Conaclos/working
Apply pretty tool.
2014-07-08 17:25:35 +02:00
Jocelyn Fiat
93f1fed997 Merge pull request #139 from jocelyn/widget_integration
Added custom-template in examples, as a base template to integrate easily other JS widgets.
2014-07-07 12:30:10 +02:00
f6ebd414d6 Added custom-template in examples, as a base template to integrate easily other JS widgets.
Added custom example (based on custom-template project) that demonstrates how to integrate a thirdparty JS component such as d3 within the application using wsf_js_widget.

Removed various unecessary ecf dependencies.
2014-07-07 12:15:18 +02:00
ff19adc6c8 Improved comment related to PATH_INFO and stripping multiple slashes sequence to single slash. 2014-07-07 11:27:31 +02:00
Jocelyn Fiat
41d24c91b4 Merge pull request #138 from jocelyn/widget_integration
Integrated WSF_JS_Widget library provided by Yassin Nasir Hassan and Severin Munger as an ETH student project.
It was updated to better support Unicode, and other minor changes, this is still under "draft" folder, as it may need various modifications on the interface and implementation.
2014-07-07 11:19:43 +02:00
0427f7a8d3 Fixed compilation issue related to old usage of modified JSON library. 2014-07-07 11:14:36 +02:00
985a5e5ce7 Merge branch 'master' of github.com:EiffelWebFramework/EWF into widget_integration 2014-07-07 10:30:42 +02:00
fe4c283336 Move wsf_js_widget library under draft/library/server/wsf_js_widget 2014-07-07 10:26:10 +02:00
Conaclos
20e704604a Apply pretty print tool.
Apply on each class in test suite and library.
2014-07-04 17:59:05 +02:00
jvelilla
0db02a8c52 Merge pull request #8 from Conaclos/working
Tests - Update syntax and improve implementation
2014-07-04 14:07:41 +02:00
1b4b50ee80 Replace any multiple slash sequence by a single slash character for PATH_INFO. 2014-07-02 11:36:43 +02:00
446c692f97 Various changes related to new WSF_DEBUG_INFORMATION and WSF_DEBUG_HANDLER. 2014-07-01 19:59:08 +02:00
7dfc6ea67a Fixed various issues related to unicode and CGI variables (assuming that CGI variables are utf-8 encoded, and sometime percent encoded).
Delayed computation of `value' and `name' from WSF_STRING.
Fixed computation of REQUEST_URI when the server does not provide it (this is rare, but possible).
   compute it as SERVER_NAME + encoded-PATH_INFO + {? + QUERY_STRING}
2014-07-01 19:57:14 +02:00
jvelilla
a5a257f452 Update format 2014-07-01 04:47:23 -07:00
jvelilla
bde0e2900b Created Deployment (markdown) 2014-07-01 04:42:56 -07:00
Conaclos
361773101e Add documentation and contracts for domain types. 2014-06-30 18:32:14 +02:00
Conaclos
052860b62c Improve converters.
Replace old syntax with new one and improve
implementation.
2014-06-30 18:31:42 +02:00
Conaclos
c5e1b1ee69 Syntax update.
Replace assigment attempt with object test.
2014-06-30 18:28:13 +02:00
0b1697f20d Verbose mode for the WSF_DEBUG_HANDLER. 2014-06-30 15:45:54 +02:00
add71543a4 Fixed error introduced during refactorying on WSF_DEBUG_FILTER 2014-06-30 15:21:03 +02:00
66a1e0629c Improved the debug example, so that it outputs more information. 2014-06-30 15:16:31 +02:00
425c976032 Ensure that PATH_INFO and REQUEST_URI are following the CGI specifications:
- PATH_INFO is percent decoded but still utf-8 encoded,
  this is available via WGI.path_info and WSF_REQUEST.utf_8_path_info.
- Added WSF_REQUEST.percent_encoded_path_info
- and WSF_REQUEST.path_info remains the unicode value for PATH_INFO

Added cgi_variables: WGI_REQUEST_CGI_VARIABLES to have a simple and quick view on CGI variables
Added execution_variables to be able to iterate on execution variables.
Added PERCENT_ENCODER.percent_decoded_utf_8_string
Improved the WSF_DEBUG_HANDLER to provide more information thanks to WSF_DEBUG_INFORMATION object.
2014-06-30 15:13:47 +02:00
Jocelyn Fiat
397dcc6128 Merge pull request #133 from jocelyn/better_uploading_file
Improved the uploading of file in regard to temporary filename.
2014-06-23 16:06:29 +02:00
a3c403323d Raised the void-safety level to "complete"
Added comments.
2014-06-23 16:05:20 +02:00
942896aa0c Fixed library location for http 2014-06-12 20:02:57 +02:00
93c92c0e38 Avoid decoding PATH_INFO and PATH_TRANSLATED to follow CGI spec. 2014-06-12 19:54:30 +02:00
394ca46f03 Added example to help debugging EWF
This is mainly a kind of echo server .. that return the request information.
2014-06-12 19:52:41 +02:00
67641da44d Improved the uploading of file in regard to temporary filename.
Avoid to overwrite the same file for concurrent requests uploading the same filename.
2014-06-11 16:52:22 +02:00
Olivier Ligot
a826051979 Merge remote-tracking branch 'upstream/master' 2014-05-22 22:09:00 +02:00
Jocelyn Fiat
ce4c62a989 Merge pull request #131 from jocelyn/void-safe
Make sure to be able to compile in complete void-safe for 14.05 and still compile with 13.11
2014-05-14 16:21:21 +02:00
b59966595e Make sure to be able to compile in complete void-safe for 14.05 and still compile with 13.11 2014-05-14 16:18:10 +02:00
fcf8b63666 Make sure to be able to compile in complete void-safe for 14.05 and still compile with 13.11 2014-05-14 16:16:32 +02:00
cad9322839 Merge branch 'master' into void-safe 2014-05-14 11:32:28 +02:00
31fcd61401 Make sure to be able to compile in complete void-safe for 14.05 and still compile with 13.11 2014-05-14 10:14:51 +02:00
Jocelyn Fiat
0b11663da4 Merge pull request #128 from jocelyn/response_header
Extracting HTTP_HEADER_BUILDER from HTTP_HEADER
Improving wsf session usage
Various unicode related improvement for router and error library.
2014-05-14 10:06:58 +02:00
5a179f514c Minor change to avoid unecessary conversion from eventual immutable string 8 to string 8. 2014-05-14 10:04:17 +02:00
f099a70b87 Apply recent change on error_handler interface to support unicode error message in response. 2014-05-14 10:03:15 +02:00
1163b99f39 Support for unicode error message for the ERROR_HANDLER.as_string_representation: STRING_32
and as well for debug_output, this avoid unecessary unicode string truncation.
2014-05-14 10:02:38 +02:00
ca6ccc7291 debug_output can return a string 32, so avoid truncated unicode value by returning a string 32 value for `debug_output' . 2014-05-14 09:59:29 +02:00
bb11c24681 check that cookies data is valid string 8 to follow assertions. 2014-05-14 09:53:04 +02:00
d158579bdc Replaced notion of session uuid by session id which is more generic (could be a uuid, or something else).
Use STRING_TABLE for the implementation of session data container.
Added a few missing comments.
2014-05-14 09:45:15 +02:00
02f5a09689 Added comment to explain why conversion to string 8 is safe 2014-05-14 09:36:22 +02:00
cb3de17be9 renamed HTTP_HEADER_BUILDER as HTTP_HEADER_MODIFIER 2014-05-14 09:35:55 +02:00
fd66d79ecb Updated ecf files toward complete void-safety
Added iron package files.
Added libfcgi files to compile .lib and .dll on Windows
2014-04-22 21:47:29 +02:00
d6b77e938b Added more tests for uri-template matching, especially with url that contains %2F i.e the percent encoded slash '/' 2014-04-22 19:25:07 +02:00
3c8dc0a9e1 Fixed various Unicode text handling.
Moved example folder inside the library, and renamed it "demo"
Improved example code.
2014-04-22 16:36:29 +02:00
fdfeea508e Merge branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki 2014-04-22 15:50:44 +02:00
99d0340e1b Merge branch 'master' of https://github.com/eiffelhub/json 2014-04-22 15:50:30 +02:00
a74cda2f33 Added support for UTF-8 during decoding.
The JSON specification does not require it, but some json encoders are using utf-8 encoding for json encoding.
Added related autotest case.
2014-04-22 15:45:31 +02:00
322fd80f40 Be sure to reset `is_https' to False, in case the wsf_request object is reused by the implementation. 2014-04-22 10:18:16 +02:00
7168941495 is_https should not rely on REQUEST_SCHEME which may still be "http" for SSL connection. 2014-04-22 10:09:03 +02:00
161607cf8a better comments. 2014-04-22 10:01:27 +02:00
d45cd032a7 Corrected support of https request in `server_url' (and callers).
Added query `is_https' to indicate if the request is done via a https connection or not.
2014-04-22 09:59:18 +02:00
Jocelyn Fiat
9db9a4957a Updated Documentation__Request (markdown) 2014-04-17 07:24:13 -07:00
Jocelyn Fiat
d089921ef5 Updated Documentation__Request (markdown) 2014-04-17 07:23:54 -07:00
Jocelyn Fiat
7f3ece2da9 Updated Documentation__Request (markdown) 2014-04-17 07:23:33 -07:00
4b497060a0 Added an example to embed EWF nino service into a Vision2 desktop application.
This is locally consumed via the embedded web browser component.
2014-04-10 15:28:19 +02:00
d40131f863 Updated encoder library, especially URL encoders to reuse implementation of percent_encoder.e
Fixed JSON_ENCODER for %T and related.
Updated related autotest cases.
2014-04-09 18:10:51 +02:00
9999b5e400 Moved implementation of WSF_PERCENT_ENCODER into "encoder" library, and added the *partial* variant. 2014-04-09 17:19:09 +02:00
6e27f66306 Improved BASE64 to update has_error when decoding.
Added manual tests.
2014-04-09 16:56:40 +02:00
a4c1263190 fixed code for test_url_encoder 2014-04-09 16:22:42 +02:00
46920fb991 Do not try to read more bytes from input than provided Content-Length value. 2014-04-09 12:27:31 +02:00
d50b3cb28c For maintenance filter, response with http status code {HTTP_STATUS_CODE}.service_unavailable 2014-04-09 12:22:36 +02:00
6481d2ec7d Fixed all-stable-safe.ecf fusion 2014-04-09 12:22:25 +02:00
f94820c824 Fixing JSON encoding code to include among other TAB (%T <-> \t) 2014-04-09 08:34:43 +02:00
1d0a2363d8 Fixed issue with URL_ENCODER encoding (and small optimization) 2014-04-08 21:52:37 +02:00
Jocelyn Fiat
2100b856b0 Updated Documentation__Request (markdown) 2014-04-02 01:52:31 -07:00
Jocelyn Fiat
e687affd17 Updated Documentation__Request (markdown) 2014-04-02 01:52:00 -07:00
Jocelyn Fiat
195f3b4f68 Updated Documentation__Request (markdown) 2014-04-02 01:51:04 -07:00
cc7d268610 Code improvement
Cosmetic (comments, names, formatting)
2014-03-26 10:18:02 +01:00
hassany
acc8cda04f Fix STRING_32 issues 2014-03-19 23:13:16 +01:00
hassany
7c5637c063 Add javascript function 2014-03-19 21:37:07 +01:00
severin
b87392906b Updated readme 2014-03-19 16:58:08 +01:00
severin
4e7e1e9c45 Added more comments and assertions to all classes; clean up 2014-03-19 16:49:24 +01:00
da92d2d365 Added alias "[]" to `item', to get header value for a header name.
Added assigner for `item' to make it easier to add header item without confusing key and value.
Better parameter names (more explicit)
2014-03-18 14:13:16 +01:00
ae0ba66416 Added comments, used better parameter names. 2014-03-17 21:30:34 +01:00
718cebc700 Extracting HTTP_HEADER_BUILDER from HTTP_HEADER
to provide useful interface on WSF_RESPONSE,
  and make WSF_SESSION easier to use.
2014-03-17 18:10:55 +01:00
a2cbcbbbc6 Updated demo_basic example to be easier to read, and demonstrate various scenario. 2014-03-13 13:06:57 +01:00
hassany
c5363c948c Extend documentation 2014-03-12 21:51:15 +01:00
severin
4f7086a6de Updated comments and added contracts for core controls in webcontrol 2014-03-12 17:21:39 +01:00
severin
3c4e15b386 Merge branch 'widget' of github.com:ynh/EWF into widget 2014-03-12 13:54:45 +01:00
hassany
6685b3679b Add file definition 2014-03-12 13:54:20 +01:00
severin
d6a27c26aa Added assets to library 2014-03-05 15:58:10 +01:00
severin
e7c4b949f5 Merge branch 'widget' of github.com:ynh/EWF into widget 2014-03-05 15:57:24 +01:00
severin
f89e0abe69 Simplified WSF_EMAIL_VALIDATOR regexp 2014-03-05 15:57:16 +01:00
YNH Webdev
cbcf9550f8 Rename WSF_FILE to WSF_FILE_DEFINITION 2014-03-05 15:07:21 +01:00
YNH Webdev
d4b877f18e Add Basepath 2014-03-05 15:05:26 +01:00
YNH Webdev
605a094910 Change STRING TO STRING_32 2014-03-05 14:54:45 +01:00
Jocelyn Fiat
a16a7358d1 Update README.md 2014-03-03 17:59:26 +01:00
Olivier Ligot
655c95158f json: comment '* text=auto' in .gitattributes 2014-03-03 14:18:07 +01:00
9eca723dc5 Added a demo application server for basic http autorization 2014-03-03 12:45:41 +01:00
bbc2bab0eb Removed usage of remote anchor types. 2014-02-28 14:25:13 +01:00
Jocelyn Fiat
fe913b0072 added anchor link for wiki and jekyl engine 2014-02-27 06:48:24 -08:00
Jocelyn Fiat
9ec2baf7d3 used <a name=".."></a> instead of <a name=".."/> form (jekill has trouble with it) 2014-02-27 06:39:28 -08:00
cc6d2f3023 Merge branch 'master' of https://github.com/eiffelhub/json 2014-02-27 09:16:48 +01:00
2ac717592d Merge branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki 2014-02-27 09:16:19 +01:00
YNH Webdev
7ca62463b7 Rename progress_source 2014-02-26 10:55:33 +01:00
95971618ca Fixed autotests cases compilation of http_authorization library. 2014-02-24 22:07:24 +01:00
cb881877ac Fixed the ecf to test global compilation of EWF. 2014-02-24 21:56:23 +01:00
YNH Webdev
2cc26f98c6 Add class description to validators
Rename Wsf_progresssource
2014-02-23 19:10:23 +01:00
YNH Webdev
47b4357a72 Extend upload demo 2014-02-23 13:36:55 +01:00
YNH Webdev
a60bd19e58 Fix state transition 2014-02-23 13:14:09 +01:00
severin
439e43fad9 Began with class documentation 2014-02-21 00:23:35 +01:00
colin-adams
7abbc96347 Removed warning about not being part of release. 2014-02-11 00:39:03 -08:00
Jocelyn Fiat
e9b4a8abd5 Updated Home (markdown) 2014-02-03 09:38:20 -08:00
cb7c20a0b7 Udated to highest level of void-safety.
Fixed obsolete calls.
2014-02-03 09:52:09 +01:00
f5c2f9e017 Updated README.md 2014-01-27 10:10:41 +01:00
YNH Webdev
45ddc47b0e Finalize WSF_DYNAMIC_MULTI_CONTROL 2014-01-26 22:07:15 +01:00
YNH Webdev
8f148f2a5e Add dynamic multicontrol 2014-01-26 15:02:06 +01:00
YNH Webdev
5c9edeeae8 Image preview 2014-01-25 23:43:18 +01:00
YNH Webdev
13349d07a8 Fix upload state 2014-01-25 18:00:31 +01:00
991389e9b9 Update restbucksCRUD example to use "crypto" library rather than "eel".
Updated readme.md to add curl command to test the server.
2014-01-24 11:06:01 +01:00
d8487e6c12 Added PUT processing for image_uploader EWF example. 2014-01-24 11:06:00 +01:00
jvelilla
b7750b9d06 Udated to highest level of void-safety.
Fixed obsolete calls.
2014-01-12 16:56:16 -03:00
severin
d82cacc18f Merge branch 'widget' of github.com:ynh/EWF into widget 2014-01-11 12:53:59 +01:00
YNH Webdev
564248284a Add set value to value controls 2014-01-11 01:10:24 +01:00
severin
ee473d8844 Included time library to set current date in date picker 2014-01-11 00:19:04 +01:00
severin
2fb0d73439 Added ability to form element to get value (for convenience/completion) 2014-01-10 15:32:05 +01:00
severin
5dd8a83081 Added ability to show/hide border of form elements 2014-01-08 22:12:02 +01:00
severin
f83a8db25c Small change on date picker control, removed date input 2014-01-08 20:29:09 +01:00
jvelilla
a3e5da052e Merge pull request #127 from jvelilla/master
Fixed error with identity encoding.
2014-01-07 10:21:05 -08:00
jvelilla
942db6d708 Fixed error with identity encoding. 2014-01-07 15:09:54 -03:00
Jocelyn Fiat
48deb869de Created Documentation__Connector (markdown) 2014-01-07 05:12:09 -08:00
Jocelyn Fiat
69b67b3b4b Updated Documentation (markdown) 2014-01-07 05:11:40 -08:00
Jocelyn Fiat
6acdcb4e6d Created Documentation__Router (markdown) 2014-01-07 05:10:44 -08:00
Jocelyn Fiat
e832478b76 Updated Documentation _Router (markdown) 2014-01-07 05:10:23 -08:00
Jocelyn Fiat
c8e9a835f5 Created Documentation__Response (markdown) 2014-01-07 05:10:14 -08:00
Jocelyn Fiat
06c5f068db Created Documentation__Request (markdown) 2014-01-07 05:10:04 -08:00
Jocelyn Fiat
b81207e42e Created Documentation _Router (markdown) 2014-01-07 05:09:21 -08:00
Jocelyn Fiat
b312d69afa Updated Documentation (markdown) 2014-01-07 05:08:47 -08:00
Jocelyn Fiat
d1238a441d Created Documentation__Service (markdown) 2014-01-07 05:06:13 -08:00
Jocelyn Fiat
580739d0b4 Updated Home (markdown) 2014-01-07 04:52:59 -08:00
Jocelyn Fiat
093dec1808 Updated Documentation (markdown) 2014-01-07 04:22:11 -08:00
Jocelyn Fiat
2fb521aa42 Updated Documentation (markdown) 2014-01-07 03:37:03 -08:00
Jocelyn Fiat
992504a49f Updated Documentation (markdown) 2014-01-07 03:33:37 -08:00
Jocelyn Fiat
8696681710 Updated Documentation (markdown) 2014-01-07 03:28:25 -08:00
Jocelyn Fiat
73ce700ece Updated Documentation (markdown) 2014-01-07 03:17:44 -08:00
Jocelyn Fiat
c766881052 Updated Documentation (markdown) 2014-01-07 03:17:15 -08:00
Jocelyn Fiat
8bd14f5f21 Updated Documentation (markdown) 2014-01-07 03:13:06 -08:00
Jocelyn Fiat
45cd633e12 Updated Documentation (markdown) 2014-01-07 03:10:50 -08:00
Jocelyn Fiat
0744e13132 draft 2014-01-07 03:04:19 -08:00
severin
320584a693 Modified datepicker control 2014-01-06 01:36:32 +01:00
severin
514a44e022 Removed country chooser widget 2014-01-05 15:01:14 +01:00
severin
191a00649f fixed js 2014-01-05 02:00:46 +01:00
severin
ecfd5738ce modified country and date/time chooser 2014-01-05 01:26:11 +01:00
severin
25fe7c8725 Included bootstrap datetimepicker 2014-01-04 16:33:08 +01:00
severin
dbcb1def29 Added date chooser widget 2014-01-04 16:14:30 +01:00
severin
c4acbf563f Added precondition in layout control 2014-01-04 14:15:05 +01:00
severin
c9599f449f Removed add_dropdown methods from navbar, some cleanup in different controls 2014-01-04 13:43:51 +01:00
severin
e675e8aad9 ATTENTION: ugly append_attributes added to stateless control, replaces set_attributes -> maybe improve 2014-01-04 10:51:07 +01:00
severin
37aac7053a Moved set_attributes from BASIC_CONTROL to STATELESS_CONTROL 2014-01-04 10:30:34 +01:00
severin
9c9a132329 Merge branch 'widget' of github.com:ynh/EWF into widget 2014-01-03 12:06:53 +01:00
YNH Webdev
ce305d4e54 Add disable option 2014-01-02 18:19:59 +01:00
YNH Webdev
d3c66cd7fe Allow remove 2014-01-02 03:20:57 +01:00
YNH Webdev
7bf95cd927 Add serverside file id to file structure 2014-01-01 23:50:12 +01:00
YNH Webdev
05d4f24f6f Allow detached values 2014-01-01 23:48:56 +01:00
YNH Webdev
d9c837918b Demo upload 2014-01-01 20:41:28 +01:00
severin
5adee83350 Merge branch 'widget' of github.com:ynh/EWF into widget 2014-01-01 14:44:30 +01:00
severin
720e26d19d Small page control change 2014-01-01 14:44:22 +01:00
YNH Webdev
29356c0b61 Workin file upload 2014-01-01 01:35:43 +01:00
YNH Webdev
b39dd5c40d Change parameter type 2013-12-31 21:25:01 +01:00
YNH Webdev
1ae44e74e7 File upload implementation part1 2013-12-31 16:03:24 +01:00
YNH Webdev
7a5d1e378d Fix dropdown list, clean up actions 2013-12-31 12:10:05 +01:00
c68f6a30e6 Fixed and improved {WSF_REQUEST}.read_input_data_into_file.
Now use the content length to get exactly what is expected from the request.
Added check assertion
2013-12-03 10:46:22 +01:00
07ec0d001f Fixed various issues with libfcgi on Linux, mainly related to stdout,stderr,stdin, feof and related.
Added `reset' to the libfcgi input stream so that it is possible to reset previous errors.
2013-12-03 10:45:52 +01:00
4f15745647 For Nino connector, ensured that environment variables are percent-encoded in meta variables. 2013-12-02 10:26:23 +01:00
20367851cc fixed compilation of libfcgi tests. 2013-11-20 09:17:41 +01:00
2978ec33b7 Accept again detachable argument for HTTP_AUTHORIZATION.make (..) to avoid breaking existing code.
Note that HTTP_AUTHORIZATION.http_authorization is now detachable.
2013-11-20 09:17:28 +01:00
3d126b04a9 fixed compilation of the filter example 2013-11-20 09:16:28 +01:00
33fd3c8009 The "not implemented" response, now also precise the request method. 2013-11-19 22:08:06 +01:00
ea1c8a23cd http_client: changed some default settings connect_timeout' and timeout' to 0 (never timeout)
Updated comments
2013-11-19 22:07:29 +01:00
1827723ccc Fixed compilation of restbucksCRUD for the policy driven framework target. 2013-11-19 22:00:33 +01:00
Jocelyn Fiat
949d3514b8 Merge branch 'master' of https://github.com/Eiffel-World/EiffelWebNino 2013-11-18 17:41:19 +00:00
Jocelyn Fiat
7818b9dc1c removed CRLF eol in many files 2013-11-18 17:40:32 +00:00
Jocelyn Fiat
d15da0ffd4 merged wiki page changes 2013-11-18 17:34:03 +00:00
Jocelyn Fiat
a0665313ed Merge branch 'master' of https://github.com/eiffelhub/json 2013-11-18 17:30:37 +00:00
Jocelyn Fiat
8a7bd30ce0 native eol 2013-11-18 17:28:37 +00:00
f2da98c387 Fixed wrong assertion related to upload_data and upload_filename in HTTP_CLIENT_REQUEST_CONTEXT .
Fixed issue #124
Enable all assertion for the related autotest cases.
2013-11-12 21:37:39 +01:00
YNH Webdev
51c4e8ab9e Rename files 2013-11-11 08:28:08 +01:00
YNH Webdev
f369b26d88 Rename validators, Make forms resizable 2013-11-10 17:22:28 +01:00
YNH Webdev
40bb88a55f Validate all fields and make regexp stricter 2013-11-10 16:53:21 +01:00
YNH Webdev
72e7493842 Fix event handler 2013-11-10 16:39:04 +01:00
YNH Webdev
6213021f45 Fix form element control 2013-11-10 15:10:00 +01:00
YNH Webdev
eb3fb7e5f7 Update sample app 2013-11-10 13:58:44 +01:00
YNH Webdev
1ec14ec397 Fix email validation and min and max validator 2013-11-10 13:53:20 +01:00
YNH Webdev
38f422896d Fix slider 2013-11-09 17:14:58 +01:00
YNH Webdev
3895cf4399 Fix assert path 2013-11-09 14:42:17 +01:00
YNH Webdev
7e69fddac9 Fix rendering issue. Add active class 2013-11-08 23:03:30 +01:00
e6f1a06545 Fixed issue with unicode login:password
Added EIS info
Added testing cases.
2013-11-08 18:14:40 +01:00
e20dd076c3 Updated gewf source code to allow custom settings,
and in particular the location of the templates.
Fixed compilation of application launcher, and make it more flexible.
2013-11-08 16:16:45 +01:00
jvelilla
a2cc3d8b29 Added DEBUG_OUTPUT to JSON_OBJECT 2013-11-08 10:38:44 -03:00
jvelilla
fa4cbd8fa8 Updated readme file 2013-11-08 09:57:27 -03:00
jvelilla
884b6b1339 Merge branch 'master' of https://github.com/eiffelhub/json 2013-11-08 09:55:21 -03:00
jvelilla
9576779cce Merge pull request #7 from ynh/simplify_json_object
Simplify the json object by adding type specific put and replace
2013-11-08 04:54:59 -08:00
YNH Webdev
0721384b60 Adjust layout control and fix navlist 2013-11-08 09:27:56 +01:00
YNH Webdev
0d79799a5d Fix autocomplete 2013-11-08 00:09:09 +01:00
YNH Webdev
86339d8163 Redesign states and implement generated control_name 2013-11-08 00:03:02 +01:00
jvelilla
64bde6220c Merge branch 'master' of https://github.com/eiffelhub/json 2013-11-07 19:19:50 -03:00
jvelilla
3406780f65 Updated comments, add DEBUG_OUPUT to JSON_ARRAY. 2013-11-07 19:18:20 -03:00
Jocelyn Fiat
597e0e82b9 cosmetic and indexing note description 2013-11-07 23:14:50 +01:00
jvelilla
137af843af Fixed normalized line endings 2013-11-07 18:14:59 -03:00
jvelilla
8a96ed87b1 Normalize line endings 2013-11-07 17:55:15 -03:00
jvelilla
59b0d0d9fa Added gitattribute configuration file 2013-11-07 17:38:02 -03:00
YNH Webdev
c9102af0aa Add stateless widgets 2013-11-06 15:44:31 +01:00
severin
6838089570 Fix Layout Control 2013-11-05 16:14:15 +01:00
severin
aba60a473a Added navlist widget 2013-11-05 16:05:24 +01:00
YNH Webdev
9a392ba292 Fix project 2013-11-05 15:50:28 +01:00
severin
85369d5247 Added WSF_LAYOUT_CONTROL 2013-11-05 15:39:42 +01:00
YNH Webdev
7c11de3073 Fix navbar state problem 2013-11-04 00:22:42 +01:00
YNH Webdev
4d07a6330d Add item alias 2013-11-03 12:51:35 +01:00
severin
dad4191c40 Fixed js 2013-11-02 23:02:07 +01:00
severin
b70450cfe9 Added dropdown control 2013-11-02 22:36:21 +01:00
severin
10b950a7e7 Fixed creation procedures (make) 2013-11-02 18:34:48 +01:00
YNH Webdev
1b831375ef Fix image sizes 2013-10-30 13:35:53 +01:00
YNH Webdev
a979bf24d4 Fix slider code 2013-10-30 13:14:48 +01:00
severin
4b11bbb73d Slider fix 2013-10-30 13:02:49 +01:00
YNH Webdev
f1cefd6173 Fix path 2013-10-29 23:14:45 +01:00
severin
ac31e1c29e Merge branch 'widget_slider' into widget
Conflicts:
	draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e
	examples/widgetapp/base_page.e
2013-10-29 15:39:32 +01:00
severin
61f032a819 Fixed WSF_MULTI_CONTROL (wrong order of subcontrols), completed navbar, improved slider 2013-10-29 15:32:57 +01:00
026f8ae608 Fixed WSF_FILE_SYSTEM_HANDLER.process_index (..) 2013-10-25 16:09:43 +02:00
ab07c2e0ce Added content_negotiation to official EWF release. 2013-10-25 16:08:16 +02:00
637303930a Removed trimmed_string function and callers, and for now, use (left_|right_)adjust 2013-10-24 17:33:27 +02:00
Jocelyn Fiat
78ee9872bd Merge pull request #83 from jvelilla/master
Contracts, comments and cosmetic
2013-10-23 03:48:26 -07:00
4dd1731e60 Removed trimmed_string function and callers, and for now, use (left_|right_)adjust 2013-10-23 12:46:36 +02:00
jvelilla
2c2770b4f1 Reuse trimmed_string from HTTP_HEADER_UTILITIES.
Added description to FITNESS_AND_QUALITY.
2013-10-22 08:35:03 -03:00
jvelilla
8c04a9183f Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-10-21 08:50:17 -03:00
Jocelyn Fiat
373e13208f Updated Tasks Roadmap (markdown) 2013-10-21 02:52:38 -07:00
Jocelyn Fiat
250d41c2d7 Updated roadmap (markdown) 2013-10-21 02:51:50 -07:00
Jocelyn Fiat
9329ea946e Created roadmap (markdown) 2013-10-21 02:51:37 -07:00
ddd19023b0 Merge branch 'content_nego_review'
Conflicts:
	library/network/protocol/content_negotiation/src/conneg_server_side.e
	library/network/protocol/content_negotiation/src/parsers/common_accept_header_parser.e
	library/network/protocol/content_negotiation/test/conneg_server_side_test.e
2013-10-18 21:30:10 +02:00
9b329c8b8a Merge branch 'master' of github.com:EiffelWebFramework/EWF 2013-10-18 21:05:26 +02:00
6f48cf80f2 Added content_negotiation in "wsf" library 2013-10-18 21:04:00 +02:00
464cbcae80 Minor changes in wsf test cases. 2013-10-18 21:02:55 +02:00
8c57856232 Reintroduced WSF_SERVICE.to_wgi_service: WGI_SERVICE
since it was used in the "WSF" test cases.
2013-10-18 21:02:05 +02:00
4f490aaacc Fixed issue related to {WSF_WGI_DELAYED_HEADER_RESPONSE} and filter response like the logger response wrapper.
issue#82
2013-10-18 21:01:23 +02:00
3065637c80 Fixed an issue with one short chunk and empty trailer
issue#81
2013-10-18 20:59:29 +02:00
cf01756c1c Using the new Content Negotiation library to implement WSF_REQUEST.is_content_type_accepted 2013-10-18 20:46:08 +02:00
58dc2ec792 Updated README.md for conneg 2013-10-18 20:44:36 +02:00
88e6837222 Class renaming for content_negotiation
Splitted SERVER_CONTENT_NEGOTIATION in 4 differents classes for each kind of negotiation
Changed to use ITERABLE over LIST for supported variants arguments
Factorized some code for http parameter parsing such as q=1.0;note="blabla"  and so on
Integrated within EWF
2013-10-18 16:18:22 +02:00
d376f99832 Updated content_negotiation with better class names and feature names.
Minor semantic changes in VARIANTS classes
Factorized some code in HTTP_ACCEPT_LANGUAGE
2013-10-15 23:19:12 +02:00
3072ce7dec Enabled assertion on content_negotiation during autotests
The tests project is now void-safe

Using force instead of put_left seems to work fine
  and is better for performance,
  and no need to check for precondition "not before"
2013-10-14 18:54:36 +02:00
jvelilla
82fdd53adb revert previous change 2013-10-04 12:53:31 -03:00
jvelilla
b97073b14a Assertions turn on. 2013-10-04 12:32:37 -03:00
jvelilla
9a10e6f2a3 Merge pull request #80 from jvelilla/master
Fixed issue# 79 Bug in CONNEG_SERVER_SIDE
2013-10-04 06:29:25 -07:00
jvelilla
60d77892e5 Fixed issue# 79 Bug in CONNEG_SERVER_SIDE 2013-10-04 10:24:19 -03:00
Jocelyn Fiat
9e11931b44 Merge pull request #78 from colin-adams/errors
When custom error is created in check_resource_exists, use it
2013-10-02 13:21:44 -07:00
Colin Adams
8fe7f4db82 When custom error is created in check_resource_exists, use it 2013-10-01 08:40:16 +01:00
Severin
26e6a62e6b Test 2013-09-29 02:24:33 +02:00
Olivier Ligot
d26c68cd1e Start to write documentation about connectors 2013-09-28 16:40:02 +02:00
YNH Webdev
01327a4b06 Add codeview 2013-09-28 16:24:51 +02:00
YNH Webdev
d3299f8e06 Fix news datasource 2013-09-28 09:49:53 +02:00
YNH Webdev
1100328fee Fix load state error 2013-09-28 09:44:39 +02:00
YNH Webdev
cb1a4825d2 Implement lazy js load wraper 2013-09-28 00:45:27 +02:00
YNH Webdev
aa9f4c4ed8 Load needed libraries dynamically 2013-09-28 00:30:29 +02:00
Severin Münger
c6d59d3366 Fixed slider 2013-09-27 18:13:55 +02:00
YNH Webdev
8353f34c45 Adjust widgetapp 2013-09-27 11:02:10 +02:00
YNH Webdev
b6c082e1fe Create new JSON_OBJECT 2013-09-27 10:57:40 +02:00
YNH Webdev
48251fb872 Add boolean 2013-09-27 10:25:36 +02:00
jvelilla
f14728c1a7 Merge pull request #76 from jvelilla/master
Fixed Issue #75 CONNEG doesn't handle accept encodings correcty
2013-09-25 12:20:04 -07:00
jvelilla
295e6e9198 Added more scenarios to test accept encoding with identity. 2013-09-25 16:15:27 -03:00
jvelilla
e21af4a0e8 Fixed Issue #75 CONNEG doesn't handle accept encodings correcty 2013-09-25 15:22:57 -03:00
YNH Webdev
805ac5dacf Remove remaining detachable variables 2013-09-25 12:52:17 +02:00
YNH Webdev
93f8cd789f Make types attached 2013-09-25 12:50:17 +02:00
YNH Webdev
7b0d264aab Fix formating 2013-09-25 10:08:10 +02:00
YNH Webdev
4d0dc964da Rename procedures. Change input type of replace_with_string and
put_string
2013-09-25 10:03:38 +02:00
YNH Webdev
95fd5f93fc Simplify the json object by adding type specific put and replace 2013-09-24 21:50:36 +02:00
0f7dca0701 Removed unwanted call to RT_DEBUGGER in WSF_DEBUG_HANDLER.
This line was committed by error.
2013-09-24 17:19:29 +02:00
843955b7b8 Reused string constants from HTTP_HEADER_NAMES 2013-09-24 15:27:02 +02:00
88192335b6 Added implicit conversion from agent to WSF_URI_TEMPLATE_AGENT_HANDLER
Mainly for convenience.
2013-09-24 15:26:16 +02:00
b04159fb35 Use WSF_RESPONSE.put_header_lines (header_object) when possible, instead of put_header_text (header_object.string) 2013-09-24 15:24:34 +02:00
1d0eb14918 Added WSF_SELF_DOCUMENTED_AGENT_HANDLER and variants for uri, uri_template, starts_with, ...
to provide a way to documentate easily wsf agent handler.
2013-09-24 15:23:15 +02:00
YNH Webdev
113df6efe1 Merge branch 'widget' of github.com:souvarin/EWF into widget 2013-09-24 15:20:43 +02:00
Jocelyn Fiat
e7951338c9 Merge pull request #74 from jvelilla/master
Added description to results classes.
Removed unnecessary classes
Clean code: removed feature out, updated corresponding test cases.
2013-09-24 06:18:20 -07:00
Severin Münger
83329ca4b7 Moved to draft 2013-09-24 15:18:14 +02:00
Severin Münger
f51201eae1 Removed WSF_STATELESS_MULTI_CONTROL 2013-09-24 15:02:33 +02:00
Severin Münger
c52a513378 Changed slider 2013-09-24 14:38:01 +02:00
Severin Münger
6908bfe7bf Added slider demo 2013-09-24 02:38:36 +02:00
Severin Münger
a5fa428e98 Added simple image slider widget 2013-09-24 01:28:29 +02:00
YNH Webdev
24f760c043 Add table title 2013-09-24 00:22:56 +02:00
YNH Webdev
3f089d6811 Implement remove 2013-09-24 00:18:38 +02:00
YNH Webdev
7e673b4628 Stop interval if deleted 2013-09-23 00:40:40 +02:00
YNH Webdev
ca633d3524 Introduce actions
First working modal
2013-09-23 00:15:43 +02:00
YNH Webdev
7dd726ca42 Set url within page class 2013-09-22 22:47:29 +02:00
YNH Webdev
3f6caa76dc Fix confict 2013-09-22 19:14:19 +02:00
YNH Webdev
5a18cb4246 Merge branch 'widget' of github.com:souvarin/EWF into widget_state_redesign
Conflicts:
	examples/widgetapp/base_page.e
2013-09-22 19:11:46 +02:00
YNH Webdev
b33de9985f Implement control isolation 2013-09-22 19:11:07 +02:00
YNH Webdev
3a9ede6e8c Restructure callbacks 2013-09-22 18:30:48 +02:00
Severin Münger
87569ccee9 Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-22 18:20:53 +02:00
Severin Münger
16b79ef193 Improved Navbar, changed attribute handling 2013-09-22 18:20:17 +02:00
YNH Webdev
f360e8a867 Add comments to grid controls 2013-09-22 14:35:26 +02:00
Severin Münger
57dd4ce259 Added comments to autocompletion, input, navbar, progressbar, validator, webcontrol. Some more little changes. 2013-09-21 23:01:36 +02:00
YNH Webdev
252b5ff758 Use append 2013-09-20 20:53:51 +02:00
YNH Webdev
b19598d902 Fix tuple 2013-09-20 20:51:19 +02:00
YNH Webdev
b5ef1fbbb5 Make recommended changes
- Implicit casting
- Use same_string
2013-09-20 20:49:03 +02:00
jvelilla
bc864bde39 Added description to results classes.
Removed unnecessary class
Clean code: removed feature out, updated corresponding test cases.
2013-09-20 15:34:00 -03:00
YNH Webdev
0a2883e040 Rename clusters to singular names 2013-09-20 19:22:46 +02:00
YNH Webdev
24474e6b31 Move project to wsf_js_widget 2013-09-20 19:19:34 +02:00
dd31970b01 Renamed content_negotation' as content_negotiation' (fixed typo)
Updated .ecf and Eiffel code depending on previous CONNEG
2013-09-20 15:18:56 +02:00
f31ed103d0 Integrated changes on content negociation library 2013-09-20 15:04:50 +02:00
ynh
6c0eeebf27 Merge pull request #2 from jocelyn/widget_first_review
Minor changes
2013-09-20 03:34:36 -07:00
48f5cb78d5 Minor changes
- using http_client library instead of libcurl directly
 - using implicit conversion to JSON_STRING to improve code readability
 - use ARRAYED_LIST instead of LINKED_LIST .. for performance.
 - cosmetic .. but still a lot of feature clauses are missing, comments, assertions ...
2013-09-20 10:27:00 +02:00
jvelilla
20a768749f Forgot to add class description 2013-09-19 15:16:26 -03:00
jvelilla
2d964b1137 Removed http classes related to http expectations.
Updated code based on the code review.
Still work in progress
2013-09-19 13:44:03 -03:00
jvelilla
a1245b77fd New directory structure (variants, results, parsers)
Refactor STRING to READABLE_STRING_8.
Clean code, added documentation and EIS references.
2013-09-17 10:09:46 -03:00
jvelilla
f2ee91764d Renamed CONNEG to content_negotiation.
Update MIME_PARSER to use HTTP_MEDIA_TYPE.
2013-09-16 23:56:01 -03:00
fff08a29e7 Accepts "*" as valid media type (interpreted as */* to be flexible) 2013-09-16 22:33:18 +02:00
jvelilla
a6260ed5a2 Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-09-16 13:08:09 -03:00
2f3a462c42 Fixed type having a semicolon in a parameter value such as
"text/plain; param1=%"something;foo=bar%"; param2=%"another-thing%"
2013-09-16 18:04:43 +02:00
jvelilla
37e6d74a34 Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-09-16 11:26:18 -03:00
f8a0bbf88b Added autotests to http library in relation with mime type and content type.
Fixed an issue with more than one parameter.
2013-09-16 16:24:05 +02:00
jvelilla
cbd7dc8176 Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-09-16 09:16:38 -03:00
YNH Webdev
1da678f726 Slow down fetching 2013-09-16 00:01:31 +02:00
Severin Münger
fccb6776b0 Fixed progressbar 2013-09-15 23:47:04 +02:00
Severin Münger
f2e85aca42 Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-15 22:14:07 +02:00
Severin Münger
2fbffb8c9e Added progress callback 2013-09-15 22:13:51 +02:00
YNH Webdev
dd8bddd45c Make js files local 2013-09-15 18:33:39 +02:00
YNH Webdev
358fe04699 Add all countries to flag list
Set encoding (Must be changed to UTF-8 in future)
2013-09-15 17:32:23 +02:00
YNH Webdev
647beea245 Rearrange demo
Add contact autocompletion
2013-09-15 15:25:13 +02:00
YNH Webdev
251974fd2f Create basepage 2013-09-15 14:16:18 +02:00
YNH Webdev
81952e7898 Merge branch 'widget_grid' into widget
Conflicts:
	examples/widgetapp/widget.coffee
	examples/widgetapp/widget.js
2013-09-15 14:04:45 +02:00
YNH Webdev
1ba9792547 Fix suggestions 2013-09-15 13:33:43 +02:00
Severin Münger
45e3a6d7cc Small changes 2013-09-15 13:25:01 +02:00
Severin Münger
be05edac7d Added Progress Control 2013-09-15 01:57:03 +02:00
Severin Münger
6761d22fa8 Added Progress Control 2013-09-15 01:55:17 +02:00
Severin Münger
9db93cf4c9 Included navbar example 2013-09-15 00:44:20 +02:00
YNH Webdev
15dd993b95 Fix change event 2013-09-14 22:45:58 +02:00
YNH Webdev
0f8444a585 Remove column from grid 2013-09-14 20:39:07 +02:00
YNH Webdev
6230d643c8 Style demo pages 2013-09-14 19:39:08 +02:00
YNH Webdev
cfe452543a Implement repeater 2013-09-14 18:41:49 +02:00
YNH Webdev
26ec7d94c6 Google news example 2013-09-14 17:46:57 +02:00
YNH Webdev
95f823e7a1 - Add event paramenter
- Implement Paging control
2013-09-14 14:27:11 +02:00
Severin Münger
09544ba6d2 Fixed rendering, added navbar 2013-09-13 23:24:49 +02:00
YNH Webdev
15676a7c9e Fix path in project 2013-09-13 19:42:24 +02:00
b5bdf88bf4 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2013-09-13 14:50:29 +02:00
74e96d7816 Added PATCH support in http_client, and provided custom_with_upload_data and custom_with_upload_file. 2013-09-13 14:50:07 +02:00
527e877b30 forget about older version of Eiffel cURL 2013-09-13 14:49:09 +02:00
Severin Münger
efc1550ab9 Merge branch 'widget' of github.com:ynh/EWF into widget
Conflicts:
	library/server/wsf_html/webcontrol/wsf_control.e
2013-09-13 01:12:26 +02:00
Severin Münger
f53974b138 Small changes/fixes 2013-09-13 01:08:18 +02:00
YNH Webdev
6860860161 Fix render function 2013-09-13 01:05:35 +02:00
Severin Münger
9c65194d91 Small fix removed DOCTYPE 2013-09-13 00:41:31 +02:00
Severin Münger
b1cf630443 New Control structure 2013-09-13 00:28:37 +02:00
YNH Webdev
b3e383ea82 Merge branch 'widget' of github.com:souvarin/EWF into widget
Conflicts:
	library/server/wsf_html/wsf_html-safe.ecf
2013-09-13 00:21:58 +02:00
YNH Webdev
36368aff0b Add Grid Widget 2013-09-13 00:20:27 +02:00
Severin Münger
162735b328 Extended autocompletion with customized templates 2013-09-12 17:15:05 +02:00
Severin Münger
27023283e7 Autocompletion 2013-09-12 14:58:35 +02:00
Severin Münger
8fc405fef1 Changed structure 2013-09-12 11:38:31 +02:00
oligot
44d8903a10 Created Filter (markdown) 2013-09-12 02:18:05 -07:00
Olivier Ligot
113c52f6b0 README.md: Remove dot in the community section 2013-09-12 10:27:45 +02:00
Olivier Ligot
e29a4c8c8a Added Community section to the README.md file 2013-09-12 10:25:17 +02:00
9499601daf Fixing handling of query parameter without value
Issue#70 https://github.com/EiffelWebFramework/EWF/issues/70
2013-09-09 15:51:20 +02:00
jvelilla
0887f7d22f Moved Selenium web driver to WebDriver-Eiffel repository 2013-09-08 11:44:46 -03:00
jvelilla
327ecff63a Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-09-06 21:57:43 -03:00
Severin Münger
55e91bff7f Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-06 23:34:50 +02:00
YNH Webdev
8b179fd98d Min/Max validator 2013-09-06 21:47:02 +02:00
Severin Münger
e5841f2dad Merge branch 'widget' of github.com:ynh/EWF into widget
Conflicts:
	examples/widgetapp/sample_page.e
2013-09-06 20:40:43 +02:00
Severin Münger
d45405f261 Some small changes 2013-09-06 20:36:04 +02:00
YNH Webdev
133ed9a0be Show server side error in validation box 2013-09-06 18:52:59 +02:00
YNH Webdev
33220b2b8e Add HTML control 2013-09-06 18:45:14 +02:00
YNH Webdev
f542975872 Small render fix 2013-09-06 18:13:23 +02:00
ed9fac0545 fixed compilation of wsf_extension 2013-09-06 18:13:05 +02:00
YNH Webdev
4dd4678b65 Comment js code 2013-09-06 18:09:39 +02:00
YNH Webdev
bbd48d24e4 Implement serverside and client side validatation 2013-09-06 18:06:43 +02:00
3b66d77ddc Merge branch 'master' of github.com:EiffelWebFramework/EWF 2013-09-06 15:40:23 +02:00
fc5ef995bc Added WSF_CUSTOM_HEADER_FILTER which provide a convenient way to add a custom header from a filter.
Added to wsf_extension WSF_DEBUG_FILTER and WSF_DEBUG_HANDLER that could be convenient to test specific requests
Restructured wsf_extension
2013-09-06 15:39:04 +02:00
4c5fa0ed61 added policy driven license .lic files 2013-09-06 15:35:09 +02:00
ea9161b2f2 Added WSF_WIDGET_RAW_TEXT to render text via html encoding.
Added WSF_WIDGET_COMPOSITE.extend_html_text (READABLE_STRING_8) that should replace the now obsolete "extend_text"
Added WSF_WIDGET_COMPOSITE.extend_raw_text (READABLE_STRING_GENERAL), for text that need to be html encoded during html rendering.
Made WSF_FORM_RAW_TEXT obsolete.
2013-09-06 15:34:38 +02:00
3c139315e5 removed useless (and unused) function {WSF_SERVICE}.to_wgi_service: WGI_SERVICE 2013-09-06 15:32:05 +02:00
15a96a402d Fixed bad output 2013-09-06 15:31:26 +02:00
5959099c55 Used res.put_header_lines (h) rather than res.put_header_text (h.string) 2013-09-06 15:31:11 +02:00
YNH Webdev
9f40c6355c First working checkbox list 2013-09-06 14:22:23 +02:00
YNH Webdev
0fcb80aa29 Merge branch 'widget' of github.com:souvarin/EWF into widget 2013-09-06 12:29:14 +02:00
Severin Münger
59a12dcac1 Added checkbox list, modified form validation 2013-09-06 01:20:41 +02:00
YNH Webdev
eb47c101ca Merge branch 'widget' of github.com:souvarin/EWF into widget 2013-09-05 23:37:19 +02:00
Severin Münger
c67a7f4982 Added validators for decimals and mails 2013-09-05 22:57:56 +02:00
Severin Münger
aba394502c Added Regexp validation (later used for mail, numbers...) 2013-09-05 22:09:08 +02:00
YNH Webdev
0c265f4f78 Fix form and textarea bug 2013-09-05 17:43:46 +02:00
YNH Webdev
32518cfb41 Merge branch 'widget' of github.com:souvarin/EWF into widget
Conflicts:
	library/server/wsf_html/webcontrol/wsf_control.e
2013-09-05 17:20:40 +02:00
YNH Webdev
225f821206 Test the new controls 2013-09-05 17:18:46 +02:00
Severin Münger
f506d9e925 Implemented WSF_CHECKBOX_CONTROL, added id attribute to rendering of WSF_CONTROL 2013-09-05 17:16:56 +02:00
YNH Webdev
edce18fb1f Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-05 16:53:29 +02:00
YNH Webdev
ad15ab13c5 Fix render function 2013-09-05 16:53:05 +02:00
Severin Münger
f52f6512a0 Restructured validators, fixed form element rendering 2013-09-05 16:51:51 +02:00
YNH Webdev
7bdafbd21e Fix render function 2013-09-05 16:51:37 +02:00
YNH Webdev
6486c8c472 Merge branch 'widget' of github.com:souvarin/EWF into widget 2013-09-05 16:28:21 +02:00
YNH Webdev
fb345c5f0c Add bootstrap 2013-09-05 16:27:55 +02:00
Severin Münger
deaeaa434d Implemented WSF_FORM_ELEMENT_CONTROL 2013-09-05 16:25:44 +02:00
Severin Münger
f9cc0afb9e Merge branch 'widget' of github.com:ynh/EWF into widget
Conflicts:
	library/server/wsf_html/webcontrol/wsf_control.e
	library/server/wsf_html/webcontrol/wsf_text_control.e
2013-09-05 15:40:11 +02:00
Severin Münger
ee0400463f Began with implementation of form handling 2013-09-05 15:37:59 +02:00
YNH Webdev
fa35c22d2d Use render tag 2013-09-05 15:33:56 +02:00
Severin Münger
422b73058c Adapted rendering of multi control 2013-09-05 15:12:22 +02:00
Severin Münger
c50a46206d Merge branch 'widget' of github.com:ynh/EWF into widget 2013-09-05 15:08:24 +02:00
Severin Münger
f866c067cb Changed creation procedures 2013-09-05 15:08:02 +02:00
YNH Webdev
811d087d74 Generate tag 2013-09-05 14:55:52 +02:00
YNH Webdev
633243311d Change wsf control 2013-09-05 14:48:19 +02:00
oligot
f5d5381fae Updated Router (markdown) 2013-09-04 05:04:21 -07:00
oligot
bbc3249212 Updated Router (markdown) 2013-09-04 05:01:42 -07:00
oligot
625b8803df Updated Request and response (markdown) 2013-09-04 04:59:59 -07:00
oligot
0d8090b6f4 Updated Request and response (markdown) 2013-09-04 04:59:14 -07:00
oligot
718c0af085 Updated Request and response (markdown) 2013-09-04 04:59:04 -07:00
oligot
5a94264dc0 Created Router (markdown) 2013-09-04 04:55:14 -07:00
oligot
8269f3ea5b Updated Connectors (markdown) 2013-09-04 04:54:04 -07:00
oligot
d6333362a7 Created Request and response (markdown) 2013-09-04 04:53:30 -07:00
oligot
3e43fd52ae Created Connectors (markdown) 2013-09-04 04:52:22 -07:00
Olivier Ligot
1111333223 Contribute page 2013-09-04 13:38:44 +02:00
Severin Münger
ae9952a941 Added class for TextArea 2013-09-03 03:54:33 +02:00
Severin Münger
3b2ad80dc3 Added TextArea 2013-09-03 03:53:01 +02:00
Severin Münger
1c08439c1a forgot to add new files 2013-09-02 20:25:59 +02:00
Severin Münger
16c89180d2 Added generalized input control similiar to text 2013-09-02 03:44:30 +02:00
YNH Webdev
bc6b4f90c3 Only send changes back to client 2013-08-29 18:31:57 +02:00
YNH Webdev
275cc7aa21 Add comments
Use Precursor
2013-08-28 22:59:24 +02:00
YNH Webdev
e186475a81 Clean up code
Simplify event
2013-08-28 19:43:44 +02:00
YNH Webdev
595d0c501a Only callback if there is an event attached 2013-08-28 15:57:16 +02:00
YNH Webdev
4e09a15454 Remove ugly do nothing hack 2013-08-28 15:30:13 +02:00
YNH Webdev
b7ab840d71 Communication in both directions (Text control)
Code regrouping
2013-08-28 12:52:09 +02:00
YNH Webdev
b72e6871e8 Fix multi control
Use multi control in example
2013-08-28 11:04:54 +02:00
YNH Webdev
f14ea29636 Comment and reformat coffee script file 2013-08-28 00:34:25 +02:00
YNH Webdev
cb7f1f0ee3 First working callback 2013-08-28 00:04:42 +02:00
Severin Münger
ef34217a6d Added WSF_MULTI_CONTROL to support controls that consist of multiple separate controls. 2013-08-27 22:06:08 +02:00
Severin Münger
ab7ee8e4c3 Created first working sample page application. 2013-08-27 16:48:20 +02:00
YNH Webdev
1a1df35ff1 Remove content length 2013-08-27 16:45:50 +02:00
YNH Webdev
0c0fb5c9c8 Add html body 2013-08-27 16:44:58 +02:00
YNH Webdev
c29a6ad195 Add assigner 2013-08-27 16:33:54 +02:00
YNH Webdev
6fdffb7418 Add post condition 2013-08-27 16:18:51 +02:00
YNH Webdev
8db642cf3b Move initalize controls 2013-08-27 16:07:06 +02:00
YNH Webdev
850a05d6bb Pretty Print 2013-08-27 16:00:24 +02:00
YNH Webdev
74995101d1 Add a json state to each control 2013-08-27 15:58:56 +02:00
YNH Webdev
fa5d13e19d Fix path 2013-08-27 15:01:57 +02:00
YNH Webdev
9f7e72f0a4 Page structure 2013-08-27 14:47:43 +02:00
YNH Webdev
c224bf1bb1 Test 2013-08-27 13:53:34 +02:00
Severin Münger
b5b71a3db0 Created widget-project testapp project. 2013-08-27 13:48:44 +02:00
oligot
cc1abfd1f9 Updated Web meeting 2012 09 18 (markdown) 2013-08-23 06:39:41 -07:00
oligot
771c91227e Updated Useful links (markdown) 2013-08-23 06:38:37 -07:00
oligot
1276ea0d1b Updated Tasks Roadmap (markdown) 2013-08-23 06:37:46 -07:00
oligot
611ce6eb9c Updated Projects new suggestions (markdown) 2013-08-23 06:31:09 -07:00
oligot
2870df8478 Updated Projects new suggestions (markdown) 2013-08-23 06:30:45 -07:00
oligot
59b2163a62 Updated Projects (markdown) 2013-08-23 06:29:39 -07:00
oligot
065318749b Updated Projects (markdown) 2013-08-23 06:28:49 -07:00
oligot
600ee095cc Updated Projects (markdown) 2013-08-23 06:27:03 -07:00
oligot
ecb49619da Updated Projects (markdown) 2013-08-23 06:25:31 -07:00
oligot
b73939d0a0 Updated Meetings (markdown) 2013-08-23 06:21:00 -07:00
oligot
6c83639149 Updated Home (markdown) 2013-08-23 06:16:24 -07:00
oligot
e77ee9bdf3 Updated Home (markdown) 2013-08-23 06:15:49 -07:00
oligot
9449f0d16e Updated Home (markdown) 2013-08-23 06:12:00 -07:00
oligot
4ff29e1fb3 Updated Home (markdown) 2013-08-23 06:11:23 -07:00
oligot
4de85df5b6 Updated EWSGI specification (markdown) 2013-08-23 06:07:26 -07:00
oligot
294ccb04d3 Updated EWSGI specification (markdown) 2013-08-23 06:06:49 -07:00
oligot
4f0567ad88 Updated EWSGI (markdown) 2013-08-23 06:05:10 -07:00
oligot
65c613d0a4 Links 2013-08-23 06:01:52 -07:00
oligot
a16bca2f29 Links 2013-08-23 05:48:02 -07:00
517720c99c Updated copyright for policy-driven classes, which is a contribution from Colin Adams. 2013-08-21 14:00:34 +02:00
jvelilla
86e942ae0a Merge branch 'master' of https://github.com/jocelyn/EWF 2013-08-21 08:33:53 -03:00
9938cc941d Merge branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki 2013-08-21 09:58:59 +02:00
2651171294 Extracted the policy driven classes into their own library for now "wsf_policy_driven.ecf"
Updated the restbucksCRUD example to demonstrate both approaches.
2013-08-20 17:27:57 +02:00
07f71dfc4e Moved recent policy-driven classes into "policy" sub folder 2013-08-20 13:26:55 +02:00
51730e0877 Merge branch 'handler' of github.com:colin-adams/EWF into colin-adams-handler 2013-08-20 13:17:01 +02:00
9958bb27a1 Removed WSF_ROUTING_HANDLER.make_with_router (a_router)
It was not used in existing code, and potentially dangerous, if coder reuses router by accident.
2013-08-20 13:15:37 +02:00
Colin Adams
37b94bbf0d Added header comment about redefining for extension methods 2013-08-19 11:48:49 +01:00
Colin Adams
3ae898476f Changed age to max_age 2013-08-16 04:50:48 +01:00
Colin Adams
eefe547553 Changed comment on execute to check assertion 2013-08-15 14:58:58 +01:00
Colin Adams
2903a1d3cd Improved comment to ensure_content_exists - take 2 2013-08-15 10:31:40 +01:00
Colin Adams
0755e2d2bc Improved comment to ensure_content_exists 2013-08-15 10:30:47 +01:00
Colin Adams
b5957d0f59 Removed empty feature clause 2013-08-15 08:57:54 +01:00
Colin Adams
143608fd85 Fixed recursion on router bug 2013-08-14 11:32:27 +01:00
colin-adams
b2d9fe1a4b Updated Writing the handlers (markdown) 2013-08-14 02:47:12 -07:00
colin-adams
aff7948c65 Updated Writing the handlers (markdown) 2013-08-14 02:23:53 -07:00
colin-adams
bcdfcdd468 Updated Writing the handlers (markdown) 2013-08-14 02:23:07 -07:00
colin-adams
5e62d82e9c Updated Wsf previous policy (markdown) 2013-08-14 02:22:22 -07:00
Colin Adams
275c26b55b Further use of constants for execution variables 2013-08-14 09:22:35 +01:00
colin-adams
123fc8252e Updated Writing the handlers (markdown) 2013-08-13 08:24:05 -07:00
Colin Adams
c93e50a7e2 Gave symbolic names to execution variables used by the framework 2013-08-13 15:47:59 +01:00
colin-adams
9c8bc59224 Updated Writing the handlers (markdown) 2013-08-13 00:54:45 -07:00
Colin Adams
b074570e99 Added some checks for custom erros being set. 2013-08-12 16:45:47 +01:00
colin-adams
bf5bae803d Updated Writing the handlers (markdown) 2013-08-12 01:49:11 -07:00
colin-adams
35224b1b17 Updated Writing the handlers (markdown) 2013-08-12 01:45:58 -07:00
Colin Adams
2ed362f5d3 refactored to allow etags to work properly when multiple representations are available 2013-08-12 09:27:00 +01:00
colin-adams
fe971d07ec Updated Using the policy driven framework (markdown) 2013-08-11 23:55:50 -07:00
Colin Adams
f82456f352 Found another TODO - write_error_response in GET processing 2013-08-08 17:13:38 +01:00
colin-adams
bbbf958d7d Updated Using the policy driven framework (markdown) 2013-08-08 02:41:27 -07:00
Colin Adams
4c901c3130 Implemented remaining error response calls 2013-08-08 10:39:46 +01:00
Colin Adams
eade6d584c Errors corrected that were discovered in the course of writing the tutorial 2013-08-08 09:33:21 +01:00
colin-adams
9c8a034a04 Updated Writing the handlers (markdown) 2013-08-08 01:32:31 -07:00
colin-adams
2dac1ff6c9 Updated Writing the handlers (markdown) 2013-08-08 01:25:29 -07:00
colin-adams
e9013e548b Updated Writing the handlers (markdown) 2013-08-08 00:56:14 -07:00
colin-adams
bc976c37b1 Updated Writing the handlers (markdown) 2013-08-08 00:26:56 -07:00
Colin Adams
3249c377f1 made deleted into an effective routine 2013-08-08 07:31:43 +01:00
colin-adams
2415a57ab0 Updated Writing the handlers (markdown) 2013-08-07 23:30:49 -07:00
colin-adams
7e4f51a7ce Updated Writing the handlers (markdown) 2013-08-07 09:58:42 -07:00
colin-adams
10caa4c1df Updated Writing the handlers (markdown) 2013-08-07 09:48:38 -07:00
colin-adams
a552b8fcfa Updated Writing the handlers (markdown) 2013-08-07 09:13:56 -07:00
colin-adams
9395e31c53 Updated Writing the handlers (markdown) 2013-08-07 08:50:31 -07:00
colin-adams
ce04737d46 Updated Writing the handlers (markdown) 2013-08-07 07:18:35 -07:00
colin-adams
259815467c Created Wsf caching policy (markdown) 2013-08-07 07:05:24 -07:00
colin-adams
3b517d3c53 Updated Writing the handlers (markdown) 2013-08-07 06:25:31 -07:00
colin-adams
c261f02c84 Created Wsf previous policy (markdown) 2013-08-07 06:24:45 -07:00
colin-adams
7815557f84 Updated Writing the handlers (markdown) 2013-08-07 06:14:24 -07:00
colin-adams
090e294f10 Updated WSF_OPTIONS_POLICY (markdown) 2013-08-07 06:06:15 -07:00
colin-adams
33d523e5bf Updated Writing the handlers (markdown) 2013-08-07 06:03:13 -07:00
colin-adams
7bc09bda8f Created WSF_OPTIONS_POLICY (markdown) 2013-08-07 06:02:42 -07:00
colin-adams
45fd51b4b5 Updated Writing the handlers (markdown) 2013-08-07 06:02:24 -07:00
colin-adams
f3849679e8 Updated Writing the handlers (markdown) 2013-08-07 06:00:37 -07:00
colin-adams
bf0a8e8efb Updated Writing the handlers (markdown) 2013-08-07 05:57:49 -07:00
colin-adams
84c3039806 Updated Using the policy driven framework (markdown) 2013-08-07 05:51:54 -07:00
colin-adams
0c4a410ac0 Created Writing the handlers (markdown) 2013-08-07 05:51:11 -07:00
colin-adams
b55f363651 Updated Using the policy driven framework (markdown) 2013-08-07 05:30:02 -07:00
colin-adams
7dd36014cc Updated Using the policy driven framework (markdown) 2013-08-07 03:56:52 -07:00
colin-adams
78ff0134c7 Created Using the policy driven framework (markdown) 2013-08-07 03:27:42 -07:00
Colin Adams
69da6c6d06 Fixes as picked up by code review 2013-08-07 11:03:22 +01:00
Colin Adams
277eb0b4b6 restbucksCRUD example changed to use policy-driven framework 2013-08-06 15:01:24 +01:00
Colin Adams
8dbd24afd1 Policy-driven URI template handlers 2013-08-06 13:57:12 +01:00
Colin Adams
0a9d208529 New routines added to WSF_REQUEST to support ploicy-driven framework 2013-08-06 13:51:43 +01:00
Colin Adams
8ab6dba1c8 New routines added to HTTP_HEADER to support ploicy-driven framework 2013-08-06 13:49:58 +01:00
Colin Adams
e0bfdab106 Add CONNEG to wsf*.ecf to support ploicy-driven framework 2013-08-06 13:47:07 +01:00
jvelilla
fd09b39c1d Merge pull request #6 from jocelyn/patch20130805
Enhanced interface of JSON_ARRAY and JSON_OBJECT and new JSON_ITERATOR
2013-08-05 14:16:28 -07:00
8e743f3253 Enhanced interface of JSON_ARRAY and JSON_OBJECT
Added JSON_ITERATOR
2013-08-05 12:07:07 +02:00
8d9dca1a94 removed building the Clib for Eiffel cUrl, since it is not anymore included in EWF. 2013-08-05 10:21:24 +02:00
5753af3e43 Cosmetic
(removed commented line and fixed bad indentation)
2013-08-05 10:20:41 +02:00
Jocelyn Fiat
63f1976663 Merge pull request #67 from berenddeboer/master
Remove invariant violation.
2013-08-05 01:16:39 -07:00
Berend de Boer
4b87a00637 Remove invariant violation. 2013-08-03 20:09:16 +12:00
Jocelyn Fiat
8d12d1c0bc Merge pull request #66 from oligot/fcgi-osx
FastCGI connector and OS X
2013-07-31 07:45:36 -07:00
Jocelyn Fiat
2c3d5b6f59 Update README.md 2013-07-30 16:06:06 +02:00
Olivier Ligot
e8c66fa769 Fix C compilation when using libfcgi connector on OS X (#65) 2013-07-19 18:51:43 +02:00
jvelilla
09f32e7025 Merge pull request #64 from oligot/all-tests
Tests compile again (fixes #63)
2013-07-11 13:02:45 -07:00
Olivier Ligot
0fca8daeb1 Tests compile again (fixes #63) 2013-07-11 16:46:38 +02:00
jvelilla
285e295b5a Merge branch 'master' of https://github.com/EiffelWebFramework/EWF
Conflicts:
	draft/application/cms/README.md
	draft/application/cms/src/cms_session.e
	draft/src/gewf/license.lic
	library/network/http_client/src/expectation/http_client_response_expectation.e
2013-07-08 18:08:35 -03:00
Colin Adams
e6371c7adc Merge branch 'master' into handler
pull from upstream
2013-07-08 10:17:44 +01:00
Colin Adams
ab7ff11cb6 Merge branch 'master' of github.com:EiffelWebFramework/EWF
Routine merge
2013-07-08 10:17:09 +01:00
Colin Adams
ba11e84ed6 prior to merging 2013-07-08 10:17:04 +01:00
2676b16425 Moved gewf under draft/src/gewf 2013-07-05 15:13:43 +02:00
f7012e5b85 added README for gewf 2013-07-05 15:12:21 +02:00
a149d8de97 licensing and copyright 2013-07-05 15:07:14 +02:00
eea8894724 First working (but limited) tool 2013-07-05 15:06:30 +02:00
5b988ab760 Added first attempt to provide a application builder.
For now only trying to have a generic template.

Do not expect anything working for now, this is just the start of a draft
2013-07-05 12:44:09 +02:00
88a38509de Merge branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki 2013-07-04 17:29:25 +02:00
Jocelyn Fiat
6dee9e85b5 Updated Doc_Getting_Started (mediawiki) 2013-07-04 07:28:37 -07:00
Jocelyn Fiat
2d795eb3c1 Updated Doc_Getting_Started (mediawiki) 2013-07-04 07:28:09 -07:00
Jocelyn Fiat
717b0f7ba8 Updated Doc_Getting_Started (mediawiki) 2013-07-04 07:27:51 -07:00
Jocelyn Fiat
2d373cab5b Updated Doc_Getting_Started (mediawiki) 2013-07-04 07:25:44 -07:00
Jocelyn Fiat
e20f45b2c3 Updated Doc_Getting_Started (mediawiki) 2013-07-04 07:08:54 -07:00
Jocelyn Fiat
917388b99e Updated Doc_Index (mediawiki) 2013-07-04 07:07:00 -07:00
Jocelyn Fiat
ed1f899534 Updated Doc_Index (mediawiki) 2013-07-04 07:05:20 -07:00
Jocelyn Fiat
60a80209dc Updated Doc_Index (mediawiki) 2013-07-04 07:04:51 -07:00
Jocelyn Fiat
e4f495b282 Created Doc_Getting_Started (mediawiki) 2013-07-04 07:04:18 -07:00
Jocelyn Fiat
0efcd3cd07 Created Doc_Index (mediawiki) 2013-07-04 07:03:22 -07:00
c216b96707 Moved the cms component to https://github.com/EiffelWebFramework/cms
This is now out of EWF repository.
2013-07-02 12:21:54 +02:00
cb3f983b91 improve file system handler to ignore .* *.swp *~ or using FUNCTION to compute the ignore behavior 2013-06-28 16:11:27 +02:00
dc25723a35 Improved Unicode support. 2013-06-28 11:32:12 +02:00
8040dd5826 Ensured that EWF compiles with 7.2
(note about ecf version
   1-10-0 void_safety="all" <-->  1-11-0 void_safety="transitional"
   1-10-0 void_safety="all" <---  1-11-1 void_safety="all"
)
2013-06-28 11:06:35 +02:00
jvelilla
42ba1588c6 Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-06-18 10:30:55 -03:00
859a13ae51 Cosmetic, improve readability of conditions 2013-06-18 15:29:07 +02:00
bce084b9db Removed wsf_support, which is useless and unused 2013-06-18 15:28:42 +02:00
23ed157a75 Better use append rather than copy here. 2013-06-18 15:12:53 +02:00
3723469d52 Try to send 500 Internal error when exception reachs this point 2013-06-18 15:09:34 +02:00
jvelilla
d0fda6de66 Merge branch 'master' of https://github.com/EiffelWebFramework/EWF
Conflicts:
	draft/application/cms/cms.ecf
	draft/application/cms/example/src/web_cms.e
	draft/application/cms/src/cms_configuration.e
	draft/application/cms/src/cms_default_setup.e
	draft/application/cms/src/cms_service.e
	draft/application/cms/src/cms_setup.e
	draft/application/cms/src/handler/cms_file_system_handler.e
	draft/application/cms/src/kernel/content/format/filters/cms_html_filter.e
	draft/application/cms/src/modules/debug/debug_module.e
	draft/application/cms/src/notification/cms_email.e
	draft/application/cms/src/notification/cms_storage_mailer.e
	draft/application/cms/src/storage/cms_sed_storage.e
	draft/application/cms/src/storage/cms_storage.e
	library/runtime/process/notification_email/notification_external_mailer.e
	tools/bin/ecf_updater.exe
2013-06-18 09:56:53 -03:00
218e73945d Updated ecf file as workaround to make autotest works fine. 2013-06-17 12:03:46 +02:00
4ab44a0c47 Added notification_email library as official EWF lib. 2013-06-13 09:47:09 +02:00
47dbe7fdbb Unicode support for notification_email library 2013-06-13 09:45:40 +02:00
2252971c3e Added HTTP_DATE.append_to...string conversion feature
Made HTTP_DATE.append_...to...string more flexible by acception STRING_GENERAL,
    so it is possible to append to STRING_32 (further more, it avoid potential implicit conversion)
2013-06-13 09:43:13 +02:00
28a6bb158a Removed a few obsolete usages, and benefit from new classes from EiffelStudio >= 7.2 2013-06-12 18:51:29 +02:00
f653507fc8 Updated WGI specification to ease future migration to unicode support.
Use STRING_TABLE, and better interface of READABLE_STRING_GENERAL,
    this way the signature are more flexible for unicode keys.

    Note that for now, unicode environment variables are not correctly supported in WGI
    especially the value of the variables.
    Any layer on top of EWGSI suffers from the same issues.

Better exception handling

+ code cleaning
2013-06-12 18:50:45 +02:00
225cda0af7 minor optimization avoiding to create temporary string that might be big 2013-06-12 18:23:18 +02:00
f3f5384d9b Updated CMS support for unicode. 2013-06-12 18:22:56 +02:00
110a95b786 Fixing compilation of CMS demo project. 2013-06-12 18:12:06 +02:00
cc4ef1a575 Better support for unicode path and values.
Added WSF_REQUEST.percent_encoded_path_info: READABLE_STRING_8
    to keep url encoded path info, as it is useful for specific component

The router is now using WSF_REQUEST.percent_encoded_path_info
    since URI_TEMPLATE are handling URI (and not IRI)
    this fixes an issue with unicode path parameters.

This should not break existing code, and this fixes various unicode related issues related
   to PATH parameter and path info
   but also any component using file names.

(required EiffelStudio >= 7.2)
2013-06-12 18:03:11 +02:00
Jocelyn Fiat
a982286dd4 Merge pull request #60 from oligot/notification
Extract notification email library from the CMS draft application
2013-06-12 06:43:10 -07:00
Olivier Ligot
c27f57adf1 Rename notification to notification_email 2013-06-12 13:55:14 +02:00
Olivier Ligot
6fbe66ff7b Extract notification library from the CMS draft application
The new library is located in library/runtime/process/notification.
This allows to use it apart from the CMS.
2013-06-12 11:31:31 +02:00
jvelilla
cef69039f5 merge 2013-06-11 11:33:27 -03:00
jvelilla
cdf3a25f88 Merge https://github.com/EiffelWebFramework/EWF 2013-06-11 11:12:15 -03:00
fa8b3fdccc Added HTTP_DATE.make_now_utc for convenience. 2013-06-11 11:49:45 +02:00
fbbd1f1eee Fixed various void-safety issue with recent compilers.
Note that EWF does now require EiffelStudio 7.2, and is compiling with 7.3
2013-06-07 15:40:50 +02:00
95f14c501c Merge branch 'master' of https://github.com/Eiffel-World/EiffelWebNino 2013-05-31 12:32:28 +02:00
f41e83c30c removed unused local variable 2013-05-31 12:28:58 +02:00
jvelilla
d1a0229944 Merge branch 'master' of https://github.com/jvelilla/EWF 2013-05-29 09:44:45 -03:00
jvelilla
63beaabfa0 Added command POST /session/:sessionId/modifier
Initial implementation of KeyBoard.
Added Mouse class, but not implemented.
2013-05-29 09:43:14 -03:00
Jocelyn Fiat
32cf1a5720 Merge pull request #10 from oligot/reuseaddr
Socket: reuse address to resolve the error "address already in use"
2013-05-29 03:04:53 -07:00
Olivier Ligot
b4ec6fdff8 Socket: reuse address to resolve the error "address already in use"
On Unix, when we stop the server, and then re-start it right away, we get an
error that the address is already in use:
http://www.softlab.ntua.gr/facilities/documentation/unix/unix-socket-faq/unix-socket-faq-4.html#ss4.1
This means that the sockets that were used by the first incarnation of the
server are still active.

One way to resolve this is to set the socket option SO_REUSEADDR:
http://www.softlab.ntua.gr/facilities/documentation/unix/unix-socket-faq/unix-socket-faq-4.html#ss4.5

Tested on Ubuntu 12.04 LTS
2013-05-29 11:14:58 +02:00
5b6c257fae Improved WGI_INPUT_STREAM.append_to_file (f: FILE; nb: INTEGER) 2013-05-28 15:04:50 +02:00
401bbc657a update cms style 2013-05-28 15:04:04 +02:00
f706e049bc Merge branch 'master' of github.com:EiffelWebFramework/EWF 2013-05-28 14:44:17 +02:00
eab8df7e10 Added WSF_REQUEST.read_input_data_into_file (FILE) 2013-05-28 14:42:11 +02:00
Jocelyn Fiat
28d158571c Merge pull request #57 from oligot/port
Use port number 9090 instead of 80
2013-05-27 04:34:25 -07:00
Olivier Ligot
35729b4ab6 Use port number 9090 instead of 80
Port 80 is often already used by standard webservers (Apache, nginx, ...).
Moreover, on Linux, ports below 1024 can only be opened by root.
2013-05-27 09:15:12 +02:00
jvelilla
caac696465 Update readme.md 2013-05-23 07:52:30 -03:00
jvelilla
c741e41597 Update readme.md 2013-05-23 07:50:18 -03:00
jvelilla
60fa076796 Update readme.md 2013-05-23 07:49:12 -03:00
jvelilla
7dbed3ade1 Updated command_executor
Added more examples.
2013-05-22 07:18:17 -03:00
jvelilla
a6cad7e811 Update find element examples.
Improved command executor
2013-05-20 10:46:06 -03:00
jvelilla
47da8c17ea Merge https://github.com/EiffelWebFramework/EWF 2013-05-19 10:17:52 -03:00
jvelilla
ad5b52f4e4 Added new selenium locator examples.
Fixed find_elements in WEB_DRIVER.
2013-05-18 23:12:37 -03:00
Jocelyn Fiat
af65519067 Merge pull request #56 from oligot/scrollbar
Fix the CSS so that we don't see the scrollbar
2013-05-17 08:34:45 -07:00
Olivier Ligot
c9b44414b1 Fix the CSS so that we don't see the scrollbar
This commit fixes the CSS so that we don't see the scrollbar anymore.
It just removes the width: 100% property on the div elements.
2013-05-17 16:33:00 +02:00
Jocelyn Fiat
b96a02d55d Merge pull request #55 from oligot/suggestion-method
Display suggestion is now configurable
2013-05-17 07:08:27 -07:00
Olivier Ligot
d8987f8718 Display suggestion is now configurable.
Commit 665772bda2 forces to display only
suggestion for the request's method (this was not the case before).

This commit allows to configure this behaviour: it keeps the current behaviour
but also allows to use the other behaviour where the suggestion is displayed
for each request method (as it was before).
2013-05-17 15:36:37 +02:00
430b34df4f removed unused local variable 2013-05-15 10:54:07 +02:00
1a518e4d27 use EWF_tmp- prefix for temp uploaded file name. 2013-05-15 10:52:32 +02:00
b09060315c fixed implementation of WSF_UPLOADED_FILE.append_content_to_string 2013-05-15 10:48:38 +02:00
899a32c86c Added WSF_UPLOADED_FILE.append_content_to_string (s: STRING) which can be used to get the content of the uploaded file. 2013-05-15 10:33:00 +02:00
7d5d55462f Added a way to customize the place to store temporary uploaded files 2013-05-15 10:31:05 +02:00
b083f1d596 code cleaning 2013-05-15 10:30:32 +02:00
c61afe77a0 removed unused local variable 2013-05-14 18:31:44 +02:00
654561bcbc Added WSF_REQUEST.has_execution_variable (a_name): BOOLEAN
Since the related value can be Void.
2013-05-14 18:17:48 +02:00
a065cfb2b5 Removed unused local variables. 2013-05-14 16:04:32 +02:00
5c51937b7e Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-05-14 15:58:17 +02:00
330d1462bf Reuse WSF_LAUNCHABLE_SERVICE code as ancestor of WSF_DEFAULT_SERVICE_I
Note that this way, it is easy to redefine `launch' in order to customize the launching instruction if needed (thinking about testing...)
This might breaks some code since it adds a `launch' feature, but it is easy to fix and unlikely to happen often.
2013-05-14 15:57:08 +02:00
jvelilla
7679898159 Move expectation classed under a expectation cluster, added a new expectation class
for header.
2013-05-14 09:29:50 -03:00
jvelilla
d344df6e7e Added examples find by id, name and class. 2013-05-14 09:28:21 -03:00
jvelilla
e0c3c783fa Updated selenium WEB_DRIVER_WAIT, the feature until_when now use a
predicate. Updated the related example.
2013-05-13 10:47:46 -03:00
jvelilla
30663dc9fb Merge branch 'master' of https://github.com/jvelilla/EWF 2013-05-10 09:49:17 -03:00
jvelilla
8db7d0daa3 Initial implementation of HTTP RESPONSE EXPECTATIONS.
Added a class to test http client with httpbin.org and expectations
2013-05-10 09:48:28 -03:00
Colin Adams
48bc71c6e3 Merge branch 'master' into handler 2013-05-10 09:27:23 +01:00
jvelilla
2d3dadc85e Update readme.md 2013-05-08 10:48:03 -03:00
jvelilla
e5765d356f Updated documentation
This documentation is based on Selinum http://docs.seleniumhq.org/
and adapted to the Eiffel implementation.
2013-05-08 10:38:25 -03:00
jvelilla
f8f1773d18 Update readme.md 2013-05-08 10:21:23 -03:00
jvelilla
15782c7795 Update readme.md 2013-05-08 10:20:48 -03:00
jvelilla
b777e81ab1 Updated WEB_DRIVER_WAIT class, still need to be improved.
Updated Readme and the example
2013-05-08 10:10:11 -03:00
jvelilla
e29346dec8 Merge https://github.com/EiffelWebFramework/EWF 2013-05-03 10:57:19 -03:00
jvelilla
8535a8378c Improve the example, Added a new class WEB_DRIVER_WAIT, still under development.
Update web driver, to define time outs.
2013-05-03 10:43:48 -03:00
Jocelyn Fiat
a75ab85356 Merge pull request #54 from colin-adams/master
Handle Precondition Failed for If-Match: * when no handler exists for the resource
2013-05-03 01:35:42 -07:00
jvelilla
dcdc700bac Added a simple search example.
Updated web_driver, use the API as delegation instead of inheritance.
Updated web_element class.
2013-04-30 10:19:34 -03:00
jvelilla
31c2be768f Created new classes to represent a web driver.
Added Examples, clean code
2013-04-29 18:02:33 -03:00
jvelilla
9180667ac4 Completed low level methods, clean code. 2013-04-24 14:39:08 -03:00
jvelilla
4f79bf2add Implemented more commands from REST API JSONWireProtocol
Refactor COMMAND_EXECUTOR.
2013-04-24 11:33:39 -03:00
Colin Adams
9eaada0bdb merged from master 2013-04-24 13:54:30 +01:00
jvelilla
c7e6fe38fb Added more command from JSONWireProtol. 2013-04-23 09:09:57 -03:00
jvelilla
9e8548d65a Added more commands from the JSONWireProtocol. 2013-04-23 08:26:02 -03:00
e8d96b3521 send the file date for download file response. 2013-04-22 21:06:29 +02:00
06088866e0 WSF_RESPONSE.put_header_text should use put_raw_header_data (and not append) 2013-04-22 21:06:06 +02:00
ad34ec1156 added header helper feature in the context interface
added HTTP_CLIENT_SESSION.custom (...)
to support any kind of request methods
2013-04-22 21:05:11 +02:00
jvelilla
3c41ca0864 Added new classes, implemented more methods from JSONWireProtol API.
Added test cases
2013-04-22 09:15:50 -03:00
Colin Adams
f52aa2ecff Made changes requested in review 2013-04-17 15:37:39 +01:00
jvelilla
c344ecceec Fixed errors in navigate_to_url command,
Fixed url templates in  json_wire_protocol_command.
Added test cases to AutoTest
2013-04-17 10:06:34 -03:00
jvelilla
ce2ca051f6 Fixed feature typo, improved commands, added AutoTest 2013-04-16 17:31:33 -03:00
jvelilla
c63e307179 Updated RestAPI commands 2013-04-15 16:16:16 -03:00
jvelilla
1daab0598a Improved error handling, implemented more methods from the REST API from Selenium2 2013-04-15 09:40:17 -03:00
Colin Adams
98ad77a57d If-Match implemented in skeleton handler 2013-04-13 14:49:03 +01:00
Colin Adams
b4ab4875fc If-Match implemented in skeleton handler 2013-04-13 14:48:28 +01:00
jvelilla
6ead464a6b Fixed configurations paths 2013-04-12 09:38:04 -03:00
jvelilla
3d36c353fc Initial import Selenium binding 2013-04-12 09:16:52 -03:00
a547cbaeb1 Fixed HTTP_CLIENT_RESPONSE when dealing with redirection
before it was storing some header in the body.
   now we added redirections: ..  which is a list of redirection informations:
     - status line
     - header
     - and eventual redirection body (but at least by default, libcurl does not cache body)

Enhanced the http_client library to be able to write directly the downloaded data into a file (or as convenient thanks to agent).
2013-04-11 15:53:46 +02:00
Colin Adams
77e2a7107f Merge branch 'master' of git://github.com/colin-adams/EWF 2013-04-11 12:07:59 +01:00
Colin Adams
3997efcd2d Fixed Use Proxy response 2013-04-11 12:07:29 +01:00
Colin Adams
024e5e4b04 Fixed Use Proxy response bug 2013-04-11 12:04:11 +01:00
Colin Adams
92ce80cd63 Fixed bug in 32/8 bit string existance 2013-04-11 10:28:14 +01:00
Colin Adams
137afab3d3 Removed illegal precondition 2013-04-11 10:01:01 +01:00
Colin Adams
31ba0a8828 Handle Precondition Failed for If-Match: * where there is no handler for the resource 2013-04-11 09:23:41 +01:00
47e028de2a Fixed feature comments 2013-04-10 09:42:09 +02:00
a65f8cbc9c Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-04-10 09:31:07 +02:00
f85dc7f550 Fixed HEAD request related issue
see https://github.com/EiffelWebFramework/EWF/issues/53
2013-04-10 09:27:58 +02:00
Jocelyn Fiat
47d98a1a11 Merge pull request #52 from colin-adams/master
Bad postcondition for handle_use_proxy
2013-04-08 09:24:38 -07:00
Colin Adams
1b94f58e7a Removed incorrect postcondition for handle_use_proxy 2013-04-05 12:41:13 +01:00
5fc34d947a Cosmetic
fixed various indentations
Removed useless dependencies for ewf_ise_wizard project.
2013-04-05 12:12:26 +02:00
Jocelyn Fiat
aee512a316 fixed name of file with class name 2013-03-30 08:57:54 +01:00
Jocelyn Fiat
57a695555a fixed typo in default name for maintenance 2013-03-29 23:15:54 +01:00
Jocelyn Fiat
a7e1be115a Added a maintenance filter 2013-03-29 23:01:37 +01:00
Jocelyn Fiat
5b4c498ba6 added WSF_AGENT_FILTER 2013-03-29 22:16:27 +01:00
Jocelyn Fiat
decb9d0f9b more info in debug_output for uploaded file 2013-03-29 21:22:56 +01:00
Jocelyn Fiat
e3e6fd7f62 better error output for CGI connector 2013-03-29 21:00:02 +01:00
Jocelyn Fiat
0ef31cead3 Added WSF_LAUNCHABLE_SERVICE which use a deferred `launch' feature.
This makes it easy to support multiple connectors support
2013-03-29 17:51:20 +01:00
Jocelyn Fiat
a8a3f3cb8b reuse implementation from WSF_REQUEST to get input data for MIME handlers. 2013-03-29 17:50:34 +01:00
Jocelyn Fiat
8647ae1cd3 Added assertion for mime helper 2013-03-29 15:53:04 +01:00
Jocelyn Fiat
ec2792b645 Do not change tmp_name from WSF_UPLOADED_FILE ... otherwise the file will be removed at the end of the request 2013-03-29 15:10:51 +01:00
Jocelyn Fiat
1470389600 Fixed MIME multipart form data handler
And use content-length value if provided.
2013-03-29 15:10:17 +01:00
Jocelyn Fiat
1fcc69b268 check against capacity not count 2013-03-29 15:09:34 +01:00
Jocelyn Fiat
3bc3e3b874 be sure we got the full content same as content length 2013-03-29 14:20:01 +01:00
Jocelyn Fiat
f5b23c2571 Added assertion to WSF_UPLOADED_FILE 2013-03-29 12:11:43 +01:00
Jocelyn Fiat
9b0ec8a55b Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-03-28 19:08:06 +01:00
Jocelyn Fiat
a0c000b50f at this point we have no garantie that the header are sent
this can be ensured only at {WGI_RESPONSE}.commit exit.
2013-03-28 19:06:55 +01:00
Jocelyn Fiat
91624258eb Merge pull request #49 from colin-adams/protocol_version
First attempt at WSF_HTTP_PROTOCOL_VERSION
2013-03-27 10:53:52 -07:00
Colin Adams
ba314cb3f5 First attempt at WSF_HTTP_PROTOCOL_VERSION 2013-03-27 17:18:16 +00:00
Jocelyn Fiat
44cb0ad98c Uncommented code to make recognized_methods supported by the method not allowed response.
Still need to see how to use it and set the recognized methods for the application.
2013-03-27 17:10:04 +01:00
Jocelyn Fiat
01cab452d8 Removed WSF_URI_*_ROUTER_HELPER and use instead the WSF_URI_*_HELPER_FOR_ROUTED_SERVICE
(the removed class were not in latest release, so this is safe to use the new name)
Cosmetic
2013-03-27 17:00:58 +01:00
Jocelyn Fiat
20d7009383 Merge pull request #46 from colin-adams/skeleton_router
Skeleton router

note :
 - wsf_method_not_allowed_response.e needs deeper review
 - tidy some helper classes
2013-03-27 08:43:27 -07:00
Colin Adams
5249275b23 Further changes in response to review comments by Jocelyn 2013-03-27 15:38:13 +00:00
Colin Adams
4875ca9ff1 now all-safe.ecf compiles again 2013-03-27 14:44:14 +00:00
Colin Adams
a74fcd0575 delete ecf 2013-03-27 14:37:56 +00:00
Jocelyn Fiat
ab9c304597 added wsf_html for (un)installation 2013-03-27 15:24:40 +01:00
Jocelyn Fiat
178a48cd7e Updated all-safe.ecf
(add all-stable-safe.ecf that includes only the library, examples and specific draft lib)
2013-03-27 15:22:32 +01:00
Jocelyn Fiat
9f132a7b72 new integration ecf file that includes most of the library .ecf of EWF
(note to include non library ecf, the related ecf should have a library_target)
2013-03-27 13:11:49 +01:00
Jocelyn Fiat
403b9f7bde better use a root class 2013-03-27 13:08:57 +01:00
Jocelyn Fiat
a05e08c207 corrected null-safe.ecf 2013-03-27 13:07:55 +01:00
Colin Adams
8c5400915d openid demo fixed 2013-03-27 10:28:20 +00:00
Colin Adams
8ebaf2a917 merging from upstream - stage 4 2013-03-26 17:33:50 +00:00
Colin Adams
0507a1d347 merging from upstream - stage 3 2013-03-26 17:19:04 +00:00
Colin Adams
7c6980860c merging from upstream - stage 2 2013-03-26 17:10:09 +00:00
Colin Adams
b321bee60e merging from upstream - stage 1 2013-03-26 17:04:49 +00:00
Colin Adams
14088f126b Use class URI 2013-03-26 16:10:32 +00:00
Jocelyn Fiat
c9d11b3adb fixed compilation 2013-03-26 16:31:59 +01:00
Jocelyn Fiat
c3c8c66f59 allow to to set html attribute to the select widget
(useful to add code like  onchange="this.form.submit()")
2013-03-26 15:27:23 +01:00
Jocelyn Fiat
a23871ff5b Moved more components from CMS to wsf_html.
This includes WSF_PAGER, and feature in WSF_THEME .. including WSF_API_OPTIONS
used to compute url and link.
2013-03-26 14:17:10 +01:00
Jocelyn Fiat
2eb9abeb37 Added remove_header_named (a_name) 2013-03-26 10:33:06 +01:00
Jocelyn Fiat
955272f505 Do not use socket_ok .. but readable (as specified in precondition of read_stream_thread_aware 2013-03-26 09:16:34 +01:00
Jocelyn Fiat
1ee6ffa725 Added self doc to the wsf file system handler
Allow to hide the wsf file system handler from self documentation
Better description format handling for the self doc
2013-03-25 19:13:55 +01:00
Colin Adams
ad5ccd6585 Corrected header comment 2013-03-23 17:15:17 +00:00
Jocelyn Fiat
da28baf872 use wsf_html lib in the demo 2013-03-22 20:15:27 +01:00
Jocelyn Fiat
3b87481c93 removed obsolete call 2013-03-22 20:15:09 +01:00
Jocelyn Fiat
53f848758a added wsf_html-safe.ecf to all-safe.ecf 2013-03-22 20:14:58 +01:00
Jocelyn Fiat
1f7f569d82 restored assertion removed by error 2013-03-22 20:12:12 +01:00
Jocelyn Fiat
52cc356f8e Extracted the WIDGET and FORM classes out of "cms" component
and build the wsf_html library which also include the previous css lib.
2013-03-22 20:11:44 +01:00
Jocelyn Fiat
de57e814c0 Added WSF_STARTS_WITH_AGENT_HANDLER 2013-03-22 16:07:23 +01:00
Jocelyn Fiat
273b4d13f5 Fixed default status code for redirection response message object. 2013-03-22 16:06:45 +01:00
Jocelyn Fiat
c44cf5e983 Fixed assertion that were broken with recent delayed header response.
Changed semantic of put_header_lines and add_header_lines,
Now the arguments are iterable of string (i.e the header line)

The previous features were not used, and were not well named.
So we removed them, and reused the names for adpated implementation.
2013-03-22 16:06:10 +01:00
Colin Adams
d96a76bffa Merge branch 'master' into skeleton_router 2013-03-22 14:28:01 +00:00
Jocelyn Fiat
665772bda2 Display only suggestion for request's method 2013-03-22 15:23:24 +01:00
Jocelyn Fiat
aa479af8fd Include cms and css into the all-safe.ecf 2013-03-22 15:11:30 +01:00
Jocelyn Fiat
9e2410c284 update CMS code due to CMS_CSS_* renaming 2013-03-22 15:10:49 +01:00
Jocelyn Fiat
eca868f10f Fixed self documentation when querying documentation related to a specific resource (uri, uri-template, ..)
Before it was showing only the first found
so if we had
  "/foo" GET -> FOO_GET_HANDLER
  "/foo" POST -> FOO_POST_HANDLER
It was showing only the first, now this is working as expected.
2013-03-22 15:10:26 +01:00
Jocelyn Fiat
a4095b4e16 Moved the *_CSS_* class in their own (draft) library, since they are not CMS specific. 2013-03-22 15:07:45 +01:00
Jocelyn Fiat
5eb1f89273 Fixing feature comments 2013-03-21 17:53:45 +01:00
Colin Adams
f11dbd9080 fix merge conflict from master 2013-03-21 15:55:14 +00:00
Jocelyn Fiat
07ac6a6742 cosmetic 2013-03-21 15:55:42 +01:00
Jocelyn Fiat
813caa15e0 Removed WSF_AGENT_HANDLER since it was an artificial notion,
as we have no common ancestor for WSF_HANDLER having
   execute (req: WSF_REQUEST; res: WSF_RESPONSE)
2013-03-21 15:50:10 +01:00
Jocelyn Fiat
de8d36d0db cosmetic 2013-03-21 15:48:07 +01:00
Jocelyn Fiat
62d880a7c1 Fixed signature of `set_next' to allow redefinition.
Added assertions
2013-03-21 15:47:52 +01:00
Jocelyn Fiat
1f76fd5360 Now WSF_FILTER_HANDLER is a handler and has formal generic G constrained to WSF_HANDLER
This eases implementation of potential descendants.
2013-03-21 15:47:10 +01:00
Jocelyn Fiat
19df76c332 Added WSF_HANDLER_FILTER_WRAPPER to build a bridge from router to filter. 2013-03-21 15:44:29 +01:00
Jocelyn Fiat
78c83a4b69 Added HTTP_AUTHORIZATION.is_basic: BOOLEAN query to know if this is a Basic HTTP Authorization. 2013-03-21 15:42:16 +01:00
Jocelyn Fiat
7c7bf9a3f8 Introduced WSF_ROUTER_SESSION
This fixes CQS violation from WSF_ROUTER.dispatch_and_return_handler (...): ? WSF_HANDLER
and related code, and this is more compliant with concurrency.

In addition, the WSF_ROUTER_SESSION can be enhanced in the future to answer more advanced needs.
2013-03-21 15:41:46 +01:00
Jocelyn Fiat
ade9a30c03 Fixed WSF_FILE_RESPONSE and WSF_DOWNLOAD_RESPONSE
and set the status code to be Ok by default
2013-03-21 15:23:08 +01:00
Colin Adams
91a3b8176f Amedned class header of WSF_METHOD_NOT_ALLOWED_RESPONSE 2013-03-20 20:10:54 +00:00
Colin Adams
982efe6d14 Merge branch 'master' into skeleton_router 2013-03-20 07:19:44 +00:00
Jocelyn Fiat
3f237c737d mimic design of WSF_ROUTED_SERVICE for WSF_FILTERED_SERVICE
and update the filter example to make it simpler and reuse code.
2013-03-19 22:00:25 +01:00
Jocelyn Fiat
115b622724 updated install and uninstall scripts 2013-03-19 17:17:59 +01:00
Jocelyn Fiat
f502e6a6f7 Updated WSF_NOT_IMPLEMENTED_RESPONSE to include the request uri 2013-03-19 17:17:44 +01:00
Jocelyn Fiat
73f675db60 added WSF_..._ROUTER_HELPER and made the previous WSF_..._ROUTED_SERVICE obsolete 2013-03-19 17:17:14 +01:00
Jocelyn Fiat
b629bba5cc WSF_CORS_OPTIONS_FILTER should not inherit from WSF_URI_TEMPLATE_HANDLER 2013-03-19 17:09:18 +01:00
Colin Adams
d34c940c91 added reference to assertion tags in check justiciation 2013-03-19 15:59:17 +00:00
Jocelyn Fiat
3faa2ab815 Moved all *_CONTEXT_* router related classes into wsf_router_context.ecf library
This makes wsf simpler to discover.
And advanced context enabled handler, mapping, ... are still available for now in wsf_router_context.ecf library
2013-03-19 11:54:01 +01:00
Jocelyn Fiat
a4ea402fb5 Merge pull request #22 from oligot/cors
Cross-Origin Resource Sharing initial support
2013-03-19 03:16:54 -07:00
Jocelyn Fiat
ffd3e30086 Merge pull request #47 from colin-adams/master
Ignore Emacs backup files
2013-03-19 02:41:16 -07:00
Colin Adams
b614613ff4 Added emacs backup giles to .gitignore 2013-03-19 09:23:21 +00:00
Jocelyn Fiat
4d7660a9e3 Added deferred WSF_AGENT_HANDLER
Added WSF_NOT_IMPLEMENTED_RESPONSE
2013-03-18 22:05:34 +01:00
Jocelyn Fiat
b8490eff28 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2013-03-18 16:24:58 +01:00
Jocelyn Fiat
fc954c9521 added small doc on how to include EWF git repo in another git repository 2013-03-18 16:23:13 +01:00
Colin Adams
7435b4f454 refactored for WSF_ROUTED_SKELETON_SERVICE 2013-03-18 14:45:04 +00:00
Colin Adams
10ffa2066d prior to refactoring for WSF_ROUTED_SKELETON_SERVICE 2013-03-18 14:25:44 +00:00
Colin Adams
d56f4e6c7d prior to refactoring for WSF_ROUTED_SKELETON_SERVICE 2013-03-18 14:21:53 +00:00
Colin Adams
dd63042ec4 Added missing class 2013-03-17 10:38:00 +00:00
Colin Adams
4c946f5829 minor polishing 2013-03-17 09:57:00 +00:00
Colin Adams
767328287a added contracts and polished forbidden for OPTIONS * 2013-03-17 09:49:36 +00:00
Colin Adams
cda8e75f4c implemented OPTIONS * except for Allow header 2013-03-17 08:09:04 +00:00
Colin Adams
d01f47f1ee Implemented 414 and 503 responses on WSF_ROUTED_SERVICE 2013-03-16 15:12:58 +00:00
Colin Adams
a6fbed22fe Implemented 503 and 414 responses in WSF_ROUTED_SERVICE 2013-03-16 14:08:33 +00:00
Jocelyn Fiat
032f96378d Merge pull request #44 from colin-adams/master
Contracts for non-Void-safe users (take 5)
2013-03-15 10:50:40 -07:00
Colin Adams
1c19ff4544 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2013-03-15 16:30:01 +00:00
Colin Adams
2d439a2414 Sixth round of contracts for non-Void-safe users 2013-03-15 14:50:59 +00:00
Jocelyn Fiat
34629662ff Merge pull request #43 from colin-adams/master
Contracts for non-Void-safe users (take 4)
2013-03-15 07:25:47 -07:00
Colin Adams
acc0f4ae94 Merge branch 'master' of github.com:EiffelWebFramework/EWF
Pulling latest merges of other developers commits.
2013-03-15 14:08:37 +00:00
Colin Adams
a303783204 Fifth round of contracts for non-Void-safe users 2013-03-15 14:06:37 +00:00
Olivier Ligot
1198d6cef4 Merge remote-tracking branch 'upstream/master' into cors 2013-03-15 14:54:43 +01:00
Jocelyn Fiat
3e3869e391 Merge pull request #42 from colin-adams/master
Contracts for non-Void-safe users (take 3)
2013-03-15 06:39:47 -07:00
Jocelyn Fiat
8db9e85843 Merge pull request #28 from jocelyn/flexible_response
Allow to change status code and header as long as no content is sent.
Note this includes a change in EWSGI classes related to connector and RESPONSE. This modification was required for request processing termination.
2013-03-15 06:37:44 -07:00
Olivier Ligot
2ff2dbb7c3 Merge branch 'cors' of github.com:oligot/EWF into cors 2013-03-15 14:19:52 +01:00
Olivier Ligot
c8845e7354 Fix indentation 2013-03-15 14:18:13 +01:00
Olivier Ligot
dde70512d8 Use features from the flexible_response branch 2013-03-15 14:15:17 +01:00
Olivier Ligot
69495e69a9 Filter example: remove unused libraries in ecf file 2013-03-15 13:44:24 +01:00
Olivier Ligot
45f0971594 Use new upstrem method put_header_key_values 2013-03-15 13:38:40 +01:00
Olivier Ligot
496b831956 Merge remote-tracking branch 'jocelyn/flexible_response' into cors
Conflicts:
	examples/filter/filter-safe.ecf
	examples/filter/src/filter_server.e
	library/network/protocol/http/src/http_header.e
	library/server/wsf/src/wsf_response.e
2013-03-15 13:33:13 +01:00
Colin Adams
bb56166f95 Fourth round of contracts for non-Void-safe users 2013-03-15 12:01:54 +00:00
Colin Adams
c6d022bf18 Third iteration of contracts for non-Void-safe users 2013-03-15 10:16:32 +00:00
Jocelyn Fiat
a2b63cb9ba Merge pull request #41 from colin-adams/master
Contracts for non-Void-safe users (take 2)
2013-03-14 10:35:16 -07:00
Colin Adams
049f769638 Amended header comment in response to code review of pull-request 2013-03-14 16:44:15 +00:00
Colin Adams
aef30966de Corrected header comment in response to code review of pull-request 2013-03-14 16:14:07 +00:00
Colin Adams
e14772fcc1 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2013-03-14 15:36:36 +00:00
Colin Adams
3206bcc4fd Further contracts for non-Void-safe users 2013-03-14 15:29:11 +00:00
Jocelyn Fiat
1627fd6d94 Merge pull request #40 from colin-adams/master
Contracts for non-Void-safe users (take 1)
2013-03-14 07:54:47 -07:00
Colin Adams
a96a143fe0 used across for assertion 2013-03-14 14:45:31 +00:00
Colin Adams
4ec2832375 Response to comments from review "Contracts for non-Void-safe users (take 1)" 2013-03-14 14:17:03 +00:00
Colin Adams
ca5619c6fc Added non-Void contracts for classes previously flagged by AutoTest 2013-03-14 11:48:46 +00:00
Jocelyn Fiat
86777d75ea Implemented more user friendly WSF_RESPONSE
i.e allow to change the status code and the header as long as no content is really sent back to the client

This requires an addition WGI_RESPONSE, new post_commit_action: PROCEDURE [...]
2013-03-12 16:52:45 +01:00
Jocelyn Fiat
82784529fe Enhanced HTTP_HEADER with new helper features. 2013-03-12 16:19:43 +01:00
Jocelyn Fiat
f6e15b6ce1 Made it compilable with 7.1 2013-03-08 22:13:27 +01:00
Jocelyn Fiat
334f7a362b Factorized code for checkbox and radio input.
Renamed `text' and similar to `title' and similar
2013-03-08 16:01:05 +01:00
Jocelyn Fiat
b278dba565 adding back missing uri template library 2013-03-08 16:00:15 +01:00
Jocelyn Fiat
58adb7ff88 Fixed CMS_HTML_FILTER which was buggy and was including the last processed tag even if it was excluded. 2013-03-08 15:49:25 +01:00
Jocelyn Fiat
617c48adcb Added support for OpenID identity
Added user roles management
Improvement CMS_HOOK_FORM_ALTER design.
Factorized code into CMS_WIDGET_COMPOSITE
Use general notion of CMS_WIDGET (and CMS_FORM allows CMS_WIDGET, and not just CMS_FORM_ITEM)
Fixed various CMS_WIDGET traversal, and fixed related issue for CMS forms
Fixed CMS_FORM_CHECKBOX_INPUT when no value was set.
Added CMS_FORM_DATA.cached_value .. to pass computed values during validation to submit actions (mainly for optimization)
Added support for @include=filename  in CMS_CONFIGURATION
Added CMS_WIDGET_TABLE as filled version of CMS_WIDGET_AGENT_TABLE (renamed from previous CMS_WIDGET_TABLE)
Many improvements to the CMS_FORM design
Some improvements to CMS_MODULE
...
2013-03-08 15:48:39 +01:00
Jocelyn Fiat
231b263a82 Added `WSF_REQUEST.table_item' to help user get table item with flat name.
i.e instead of having  item ("foo").item ("bar"), you can do  table_item ("foo[bar]")
2013-03-08 15:36:31 +01:00
Jocelyn Fiat
37016a7796 Added user friendly function to get returned openid attributes 2013-03-08 15:35:23 +01:00
Jocelyn Fiat
504baaf859 better have hash table indexed by STRING_32 rather than READABLE_STRING_32 for now 2013-03-08 15:34:35 +01:00
Jocelyn Fiat
0d9e1a84f3 Use the advanced SED storable to store data on disk (rather than the runtime storable) 2013-03-08 15:34:04 +01:00
Jocelyn Fiat
f280f9b0de Added WITH_HTML_ATTRIBUTE 2013-03-05 17:21:03 +01:00
Jocelyn Fiat
2501bd3495 Added missing file from previous commits. 2013-03-01 18:27:22 +01:00
Jocelyn Fiat
f029c746bc added make_with_text_and_css on CMS_WIDGET_TABLE_ITEM 2013-03-01 18:21:05 +01:00
Jocelyn Fiat
42bd4fa58f added notion of site identifier .. applied to the session's cookie name 2013-03-01 18:20:35 +01:00
Jocelyn Fiat
98f3739c7c Fixed HTTP_IF_MODIFIED_SINCE handling in WSF_FILE_SYSTEM_HANDLER ... 2013-03-01 18:19:51 +01:00
Jocelyn Fiat
441cf86eda Enhanced HTTP_DATE with yyyy_mmm_dd output string. 2013-03-01 18:11:22 +01:00
Jocelyn Fiat
c1d913e67d display a message if the user has no email ... to reset password 2013-03-01 18:11:03 +01:00
Jocelyn Fiat
65d8665a64 Display the login name, instead of just "My Account" 2013-03-01 18:10:40 +01:00
Jocelyn Fiat
4a92612441 Does not accept empty password 2013-03-01 18:10:16 +01:00
Jocelyn Fiat
7cf395a9bc added the notion of site identifier "site.id" (typically this could be a UUID) 2013-03-01 18:10:02 +01:00
Jocelyn Fiat
7efcdb065e Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-03-01 12:55:54 +01:00
Jocelyn Fiat
218b2e44a7 Also take into account sublink's permission 2013-03-01 12:55:26 +01:00
Jocelyn Fiat
544401c210 Default permission should be set to False, not to True
(the previous code was mainly for debugging)
2013-03-01 12:54:58 +01:00
Jocelyn Fiat
f3d37024fb Fixed url computing when a `base_url' is provided 2013-03-01 12:53:48 +01:00
Jocelyn Fiat
ce7be6ea34 added CMS widgets demonstration in DEMO_MODULE 2013-02-28 19:37:06 +01:00
Jocelyn Fiat
5dd6079fad add CMS_WIDGET_... to ease html page development. 2013-02-28 19:36:30 +01:00
Jocelyn Fiat
e7b8f398f7 improved CMS_CSS_STYLE and WITH_CSS_STYLE 2013-02-28 19:36:09 +01:00
Jocelyn Fiat
9d8e8eb25a Move draft\library\security\openid under library\security\openid 2013-02-28 17:00:13 +01:00
Jocelyn Fiat
ff9be2cf8e Made it also compilable with compiler < 7.2 2013-02-28 14:13:04 +01:00
Jocelyn Fiat
db4f665de1 Added a version of ISE Library URI modified to be compilable with compiler < 7.2
Fixed openid when redirection is involved
Fixed Openid Attribute Exchange implementation  (AX)
Added WSF_REQUEST.items_as_string_items: ... for convenience, and ease integration with other components (such as the new openid)
2013-02-28 13:10:04 +01:00
Jocelyn Fiat
06c9364362 updated relative path 2013-02-28 10:56:58 +01:00
Jocelyn Fiat
69a77dc2c5 OpenID consumer implementation
REQUIRES EiffelStudio 7.2
2013-02-27 22:13:31 +01:00
Jocelyn Fiat
d4091a57c9 First version of OpenID consumer
(light implementation)
2013-02-27 22:09:06 +01:00
Jocelyn Fiat
2302a91b5b Merge branch 'master' of https://github.com/EiffelWebFramework/EWF 2013-02-27 21:50:14 +01:00
Jocelyn Fiat
22a725b8be Added a way to call a callback on launched and stopped for Nino connector 2013-02-27 21:49:42 +01:00
Jocelyn Fiat
92d3f642ac Provided a way to report cURL error code back to http_client, via HTTP_CLIENT_RESPONSE 2013-02-27 21:49:03 +01:00
Jocelyn Fiat
598f6df366 Provided `url_encoded_name' on the WSF_VALUE interface 2013-02-27 21:48:33 +01:00
Jocelyn Fiat
9c0a2bd6a1 prefer 2 append call, rather than create a temp intermediary string object with + 2013-02-26 15:33:00 +01:00
Jocelyn Fiat
0902eef91c Use append_to_html rather than function to_html: STRING
this is mainly to avoid creating useless intermediary strings.
2013-02-26 12:22:53 +01:00
Olivier Ligot
12404a2d5c CORS: respect specification regarding Access-Control-Allow-Headers
According to the specification, the value of the response header
Access-Control-Allow-Headers must contain at least all the values of the
request header Access-Control-Request-Headers to be considered a valid request.
Before this commit, only the Authorization value was present, which is enough
for Firefox but not for Chrome.
This should now work as expected.
2013-02-22 15:58:09 +01:00
Jocelyn Fiat
b543a6b6f2 Added functionalities to CMS_FORM_.. classes 2013-02-21 19:08:26 +01:00
Jocelyn Fiat
a417cc1e16 Fixing various form urls, that was not taking into account base url 2013-02-20 19:05:33 +01:00
Jocelyn Fiat
5d05f31d03 Fixed absolute url computing for CMS 2013-02-19 16:22:43 +01:00
Jocelyn Fiat
c9674b9e8e Fixed computation of absolute url ... 2013-02-19 13:25:12 +01:00
Jocelyn Fiat
fd0d771d43 Fixed request new password 2013-02-19 10:41:50 +01:00
Jocelyn Fiat
0d51189324 Code cleaning
and use HTTP_DATE instead of duplicating code.
2013-02-19 10:41:33 +01:00
Jocelyn Fiat
a97235c7b7 Now the cms.ini resolves variable ${abc} ... and key is case insensitive 2013-02-15 19:00:05 +01:00
Jocelyn Fiat
c62ad33ddc removed unused local variable 2013-02-15 15:10:31 +01:00
Jocelyn Fiat
5eb8baa096 keep compilable with EiffelStudio <= 7.1 2013-02-15 15:08:53 +01:00
Jocelyn Fiat
61c8388eba Refactorying the CMS component, to have an effective CMS_SERVICE, and setup as CMS_SETUP.
This way the application is much simpler, no need to implement deferred feature of CMS_SERVICE.
2013-02-15 12:33:58 +01:00
Jocelyn Fiat
9be87e8e15 Now also display sublinks if link is expanded.
Updated theme
2013-02-14 13:11:34 +01:00
Jocelyn Fiat
84df92de10 added EIS note documentation link for URI_TEMPLATE 2013-02-14 13:09:32 +01:00
Jocelyn Fiat
df9eb65144 Fixed register and new password link when the CMS's base dir is not the root / 2013-02-14 13:09:11 +01:00
Jocelyn Fiat
bf952a9719 Improved CMS PAGER 2013-02-14 13:08:26 +01:00
Jocelyn Fiat
1560752f97 Improve CMS_LINK to easily add children 2013-02-14 13:08:12 +01:00
Jocelyn Fiat
589abc71a7 provide a way to pass style class to sidebars and content blocks 2013-02-14 13:07:49 +01:00
Jocelyn Fiat
61e17a9134 Fixed remaining issues with recursion in non flat web forms 2013-02-05 19:24:46 +01:00
Jocelyn Fiat
09c3e56f86 added CMS_FORM_SELECT.select_value_by_text 2013-02-05 19:24:13 +01:00
Jocelyn Fiat
3dbccc024f fixed is_active by taking into account the query string as well 2013-02-05 19:23:54 +01:00
Jocelyn Fiat
993f1ad6b9 cleaning in CMS_CONFIGURATION
and added append_to_string (s: STRING)
2013-02-05 15:14:55 +01:00
Jocelyn Fiat
7028ce07f4 remove unwanted console output 2013-02-05 13:19:59 +01:00
Jocelyn Fiat
461cb4a4db Reviewed initialization and usage of various CMS_SERVICE urls 2013-02-04 22:04:55 +01:00
Jocelyn Fiat
cffc02daee more flexible permission control system ... 2013-02-04 18:44:21 +01:00
Jocelyn Fiat
451aa7773d make ANY_CMS_EXECUTION more flexible 2013-02-04 16:47:29 +01:00
Jocelyn Fiat
7db054a36d Updated CMS experimental component
Fixed various issues with fieldset or similar not traversed
2013-02-04 15:35:23 +01:00
Jocelyn Fiat
dc6255d410 Fixed implementation of `string_array_item' 2013-02-04 15:32:46 +01:00
oligot
0eff04c847 Add support for Apache logging: done 2013-02-03 04:10:46 -08:00
Jocelyn Fiat
56df2b085e Fixing global EWF compilation 2013-01-31 16:21:16 +01:00
Jocelyn Fiat
a5c9329ada Fixing global EWF compilation 2013-01-31 16:20:38 +01:00
Jocelyn Fiat
ce469b6ede Updated CMS code.
Separated code to have a lib and an example.
Improved design, fixed a few issues related to folder location.

This is still experimental and require more work to be really friendly to use.
2013-01-31 15:33:24 +01:00
Jocelyn Fiat
40ea982293 Added ANSI C date time string format support in HTTP_DATE. 2013-01-31 15:30:39 +01:00
Jocelyn Fiat
d172dedf31 Fixed HTTP_DATE for GMT+ offset (integer value) 2013-01-31 13:54:10 +01:00
Jocelyn Fiat
20d5798444 Added HTTP_DATE to ease http date manipulation and optimize code rather than using EiffelTime's code facilities.
Added autotests to `http' lib.
2013-01-31 11:23:11 +01:00
Jocelyn Fiat
4369637140 using ARRAYED_LIST rather than LINKED_LIST 2013-01-30 22:40:29 +01:00
Jocelyn Fiat
860959879c Removed eel and eapml contrib/library from EWF
Since there are available from $ISE_LIBRARY
2013-01-23 18:13:22 +01:00
Jocelyn Fiat
8f232bd627 Added `append_string_to' to HTTP_HEADER 2013-01-23 16:23:10 +01:00
Jocelyn Fiat
393a4fc1bf Removed useless dependencies on other lib. 2013-01-23 16:22:03 +01:00
Jocelyn Fiat
d1873d9645 Merge pull request #26 from oligot/no-context
Use execution_variable instead of context
2013-01-23 02:00:38 -08:00
Olivier Ligot
10c02219e3 Use execution_variable instead of context
This is mainly to be compatibe with other classes API.

In a lot of classes, we define methods like this:
```Eiffel
 method (req: WSF_REQUEST; res: WSF_RESPONSE)
    do
        ...
    end
```

With the context, the signature becomes:
```Eiffel
 method (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
    do
        ...
    end
```

So, I can't build a filter chain where one filter is with context
and one is without context (I can't call
WSF_FILTER.set_next (a_next: WSF_FILTER) with a filter that is a
descendant of WSF_CONTEXT_HANDLER).

Moreover, having to play with generic types just to pass some
data from one filter to another is a bit overkill imho.
Because this is really what I use contexts for:
to pass data from one filter to the next one.

Regarding execution_variable and strong typing, if we want to achieve these,
I realize we could write a class with one getter and one setter like this:

```Eiffel
  class
    TYPED_DATA

  feature -- Access

  user (req: WSF_REQUEST): detachable USER
    do
        if attached {USER} req.execution_variable ("user") as l_user then
            Result := l_user
        end
    end

  feature -- Element change

  set_user (req: WSF_REQUEST; a_user: USER)
    do
        req.set_execution_variable ("user", a_user)
    end
```

Now, I realize this is a major change since the last time we talked about this,
but at the end, after having played with both, I prefer the one with
execution_variable.
2013-01-23 10:20:03 +01:00
Jocelyn Fiat
acd942b720 Minor optimization in HTTP_HEADER 2013-01-22 21:13:40 +01:00
Jocelyn Fiat
d2767fd020 Merge pull request #24 from oligot/header-values
Added {HTTP_HEADER}.put_header_key_values
2013-01-22 11:57:14 -08:00
Olivier Ligot
c89a3f007f Added {HTTP_HEADER}.put_header_key_values
This is mainly a refactoring that is useful for an upcoming PR
regarding CORS (smaller patches are better...)

Note that this also fixes a small typo where an extra space was
added when calling {HTTP_HEADER}.put_allow
2013-01-22 17:09:23 +01:00
Jocelyn Fiat
069dc3b6fd Merge pull request #23 from oligot/readonly-ecf
Filter example: all libraries are now readonly
2013-01-22 07:47:08 -08:00
Olivier Ligot
af58d87d79 Filter example: all libraries are now readonly 2013-01-22 16:42:53 +01:00
Olivier Ligot
ff57d0ecd4 Cross-Origin Resource Sharing initial support
Initial support for the Cross-Origin Resource Sharing specification.
This allows JavaScript to make requests across domain boundaries.

Also reviewed the filter example to get rid of the context and
the generic classes (we can actually use {WSF_REQUEST}.execution_variable
and {WSF_REQUEST}.set_execution_variable).

Links:
* How to enable server-side: http://enable-cors.org/server.html
* Specification: http://www.w3.org/TR/cors/
* Github: http://developer.github.com/v3/#cross-origin-resource-sharing
2013-01-09 17:34:50 +01:00
Jocelyn Fiat
65d7545320 Merge pull request #21 from oligot/typo
Fix a small typo: you are instead of your are
2013-01-07 03:00:16 -08:00
Olivier Ligot
aadfdec1ae Fix a small typo: you are instead of your are 2013-01-07 11:11:42 +01:00
Jocelyn Fiat
1d8cce9947 Added http_authorization which is now needed by example filter. 2012-12-22 16:36:36 +01:00
Jocelyn Fiat
e16d96f613 minor changes 2012-12-22 16:18:52 +01:00
Jocelyn Fiat
3376ec1288 Keep compatibility with 7.1
thus not unicode compliant
2012-12-21 09:54:22 +01:00
Jocelyn Fiat
4ff7b33471 using socket_ok does not sounds ok on linux 2012-12-21 07:19:13 +01:00
Jocelyn Fiat
a7e6651806 Use WSF_REQUEST.read_input_data_into (buf) 2012-12-20 22:57:38 +01:00
Jocelyn Fiat
facdfd0b4a added WSF_SUPPORT.environment_item 2012-12-20 18:37:13 +01:00
Jocelyn Fiat
e4270b6297 Added is_available on HTTP_CLIENT_SESSION mainly to check if libcurl is available. 2012-12-20 18:36:58 +01:00
Jocelyn Fiat
a362e7d9c6 Avoid calling ANY.print, prefer io.error.put_string
Fixed obsolete calls.
2012-12-20 18:32:56 +01:00
Jocelyn Fiat
d46fbeaedd Merge branch 'master' of https://github.com/Eiffel-World/EiffelWebNino 2012-12-20 15:44:08 +01:00
Jocelyn Fiat
ef9494e7e8 removed unused local 2012-12-20 15:43:01 +01:00
Jocelyn Fiat
394ca05579 Added support for server_name in nino, and openshift 2012-12-20 15:41:18 +01:00
Jocelyn Fiat
b4c8c70360 updated doc related to git 2012-12-20 15:40:42 +01:00
Jocelyn Fiat
633a5afe7f Merge branch 'master' of https://github.com/Eiffel-World/EiffelWebNino 2012-12-20 15:39:27 +01:00
Jocelyn Fiat
00d6caba93 Added support for server name 2012-12-20 15:35:48 +01:00
Jocelyn Fiat
c058012313 updated conneg .ecf 2012-12-20 10:18:50 +01:00
Jocelyn Fiat
1e6d273254 Added openshift connector classes (for experimentation) 2012-12-20 10:09:49 +01:00
Jocelyn Fiat
27d2308d6f Added comment to self documentation features 2012-12-20 10:09:26 +01:00
Jocelyn Fiat
619be9a8cd Added a few library_target to .ecf to be able to build the tests/all-safe.ecf
that enables us to check quickly the compilation state of EWF, and also perform refactorying over many projects.
2012-12-19 16:45:45 +01:00
Jocelyn Fiat
3d8e277003 Fixed WSF_TRACE_RESPONSE which was overwritting previously prepared content. 2012-12-19 16:43:07 +01:00
Jocelyn Fiat
aa65c16957 Breaking changes:
added `a_request_methods' argument to WSF_ROUTER_SELF_DOCUMENTATION_HANDLER.mapping_documentation
 added similar argument to WSF_ROUTER_SELF_DOCUMENTATION_ROUTER_MAPPING.documentation
Renamed WSF_ROUTER_METHODS as WSF_REQUEST_METHODS
Enhanced WSF_REQUEST_METHODS with new has_... function
Added WSF_ROUTER_VISITOR and WSF_ROUTER_ITERATOR that may be useful to iterate inside the router.
   we may improve the implementation of the router using those visitors in the future.
Improved the WSF_DEFAULT_RESPONSE to embedded suggested items (typically based on pseudo self documented router)
2012-12-19 16:42:26 +01:00
Jocelyn Fiat
021f0eeaec Updated documentation output 2012-12-19 14:35:47 +01:00
Jocelyn Fiat
7193ce93f4 Fixed issue in WSF_REQUEST.read_input_data_into when the content is zero
Cleaned the WGI_CHUNKED_INPUT_STREAM and provides access to last extension, last trailer, ...
Improved WSF_TRACE_RESPONSE to support tracing chunked input back to the client.
2012-12-19 12:47:35 +01:00
Jocelyn Fiat
59f19dc52f Fixed WSF_RESPONSE chunk transfer implementation
and also the optional extension `a_ext' should now include the ';'
Now HTTP_HEADER is an ITERABLE [READABLE_STRING_8]
2012-12-19 11:45:59 +01:00
Jocelyn Fiat
f3aeb67e16 changed UUID since this is the same a restbuckCRUD example. 2012-12-19 00:26:11 +01:00
Jocelyn Fiat
17f16c35ad Fixed various assertions.
Improved autotests
Added target 'server' to be able to run the server outside the test process.
2012-12-19 00:10:31 +01:00
Jocelyn Fiat
ffe87ccbe9 Fixed reading chunked input data
When retrieving data block by block, use 8_192 instead of 1_024 (since 1_024 is too small most of the time)
2012-12-18 23:40:26 +01:00
Jocelyn Fiat
0d87c7939a Fixed sending of chunk, especially the ending where there is an optional Trailer, and a mandatory final CRLF
Now put_chunk does not support anymore empty chunk, and thus does not call put_chunk_end if ever it is called with empty chunk content.
Fixed the `transfered_content_length' when dealing with chunk transfert encoding
2012-12-18 23:34:55 +01:00
Jocelyn Fiat
de93ce32ff Added logger response wrapper, this is mainly to be able to save any response message to a file.
(debugging purpose)
2012-12-18 23:28:04 +01:00
Jocelyn Fiat
71b1bad53d Added basic support for "Expect" http header
i.e:   WSF_REQUEST.http_expect: detachable READABLE_STRING_8

Added WSF_REQUEST.request_time_stamp: INTEGER_64
2012-12-18 23:25:54 +01:00
Jocelyn Fiat
82c779fd60 fixed autotests compilation 2012-12-17 17:53:06 +01:00
Jocelyn Fiat
68ec6fb29c Made WSF_REQUEST.is_content_type_accepted safer. 2012-12-14 15:52:54 +01:00
Jocelyn Fiat
cc570f5abf Added WSF_DEFAULT_*_RESPONSE
Fixed the method not allowed by setting the Allow: header
2012-12-14 15:52:35 +01:00
Jocelyn Fiat
8e31950285 Improved HTTP_AUTHORIZATION 2012-12-14 15:51:34 +01:00
Jocelyn Fiat
4612fdb5de Added Authorization and Allow
Added is_empty and count
2012-12-14 15:51:12 +01:00
Jocelyn Fiat
6eb0ebd873 Merge pull request #16 from colin-adams/master
Implementation for automatic HEAD and first pass at HTTP 1.1 conformance contracts
2012-12-13 13:58:42 -08:00
Jocelyn Fiat
4a65015988 removed unused local variables 2012-12-13 18:43:15 +01:00
Jocelyn Fiat
e7f458fd50 added code that may be used to avoid breaking compatibility with new Eiffel Studio 7.2
This is experimental for now.
2012-12-13 18:16:01 +01:00
Jocelyn Fiat
b7505e67b8 Added to WSF_REQUEST
- raw_header_data: like meta_string_variable
  - read_input_data_into (buf: STRING)
  - is_content_type_accepted (a_content_type: READABLE_STRING_GENERAL): BOOLEAN
Changed raw_input_data to return IMMUTABLE_STRING_8
Added WSF_METHOD_NOT_ALLOWED_RESPONSE
Added WSF_TRACE_RESPONSE to respond TRACE request
Now Not_found response return html content if the client accepts, other text/plain
Implemented TRACE response, and Method not allowed as implementation of WSF_ROUTED_SERVICE.execute_default
2012-12-13 17:29:46 +01:00
Jocelyn Fiat
ff7d963d55 Fixed WGI_INPUT_STREAM read_to_string and append_to_string 2012-12-13 17:24:55 +01:00
Jocelyn Fiat
d264899e8b Merge branch 'master' of https://github.com/eiffelhub/json 2012-12-13 12:02:27 +01:00
Jocelyn Fiat
cb034fc94e Added missing "context" classes for uri and starts_with mapping+handler (and helper classes).
So that it is address more needs.
Factorized code between "context" and non context classes.
2012-12-13 12:01:24 +01:00
Jocelyn Fiat
3e976768ac Merge pull request #3 from jvelilla/master
Fixed documentation URI
2012-12-12 09:58:35 -08:00
Jocelyn Fiat
dc16bcc87b Merge pull request #4 from oligot/fix_json_object_hash_code
Fix {JSON_OBJECT}.hash_code implementation
2012-12-12 09:58:11 -08:00
Jocelyn Fiat
025457747b Merge pull request #20 from oligot/fix_fcgi_safe
use /usr/lib/libfcgi.so instead of /usr/local/lib/libfcgi.so
2012-12-12 05:59:02 -08:00
Olivier Ligot
ed325f81e1 use /usr/lib/libfcgi.so instead of /usr/local/lib/libfcgi.so
This was already fixed in libfcgi.ecf
(commit 65a998cec3)
This fixes the libfcgi-safe.ecf file
2012-12-12 13:34:50 +01:00
Colin Adams
eafb04719d Actioned Jocelyns comments re. a_req and a_res 2012-12-11 19:26:06 +00:00
Olivier Ligot
233de09c48 Fix {JSON_OBJECT}.hash_code implementation
Don't call {HASH_TABLE}.item_for_iteration when {HASH_TABLE}.off
Use {HASH_TABLE}.out instead
2012-12-10 17:39:22 +01:00
Jocelyn Fiat
df0d3e584c Fixed issue related to vars that are already converted to WSF_TABLE 2012-12-10 11:00:06 +01:00
Jocelyn Fiat
903495175d Get rid of obsolete scripts
(we do not use git submodule anymore, so this is much easier .. for the users)
2012-12-10 10:59:57 +01:00
Colin Adams
365da7e30a merged from upstream 2012-12-08 08:25:47 +00:00
Jocelyn Fiat
e20cb6b6ed make it compiles with EiffelStudio 7.1 and 7.2 2012-12-07 14:55:38 +01:00
Colin Adams
58f26fdc1b Revert do_get_head patch 2012-12-06 19:48:13 +00:00
Jocelyn Fiat
926ae823ac compile all-safe.ecf as windows or unix, even if not on Windows or unix 2012-12-05 22:39:43 +01:00
Jocelyn Fiat
39c3e8c5cf corrected null connector ecf files 2012-12-05 22:39:05 +01:00
Jocelyn Fiat
7308a76ac8 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-12-05 22:31:19 +01:00
Jocelyn Fiat
9499d4aa59 added tests\all-safe.ecf to compile most of EWF's lib, to quickly check the compilation state 2012-12-05 22:30:28 +01:00
Jocelyn Fiat
20c94e927d use libfcgi(-safe).ecf rather than fcgi(-safe).ecf 2012-12-05 22:30:26 +01:00
Jocelyn Fiat
5de14b114e Provide a way to log into a file, rather than just console output
Minor optimization for WSF_LOGGING_FILTER
2012-12-05 22:30:24 +01:00
Jocelyn Fiat
a9f3ea7886 Prepare upcoming support for unicode environment variables 2012-12-05 22:30:21 +01:00
Jocelyn Fiat
d445559890 removed fcgi(-safe).ecf files ... since there renamed libfcgi(-safe).ecf 2012-12-05 22:30:19 +01:00
Olivier Ligot
4ed8365afe ise_wizard Unix shell scripts 2012-12-05 22:30:16 +01:00
Olivier Ligot
a6ca54f958 Fix ise_wizard
* ewf.ini was used instead of template.ecf as configuration file
* remove initialize_router otherwise the compilation failed
* remove unused variables
2012-12-05 22:30:14 +01:00
Olivier Ligot
075ac1d628 Logging filter
The logging filter is now part of EWF core (before it was only available in
the filter example) and can therefore be reused by others needing it.
Note that this is a first implementation. It can certainly be improved in
the future to support more fine grained logging.
2012-12-05 22:30:12 +01:00
Jocelyn Fiat
2ed861e3d9 added tests\all-safe.ecf to compile most of EWF's lib, to quickly check the compilation state 2012-12-05 22:26:58 +01:00
Jocelyn Fiat
e1dffa542e use libfcgi(-safe).ecf rather than fcgi(-safe).ecf 2012-12-05 22:21:36 +01:00
Jocelyn Fiat
43df8f573b Provide a way to log into a file, rather than just console output
Minor optimization for WSF_LOGGING_FILTER
2012-12-05 22:20:56 +01:00
Jocelyn Fiat
78b161df16 Prepare upcoming support for unicode environment variables 2012-12-05 22:19:59 +01:00
Jocelyn Fiat
bbf63c1cc0 removed fcgi(-safe).ecf files ... since there renamed libfcgi(-safe).ecf 2012-12-05 17:02:32 +01:00
Jocelyn Fiat
25f6528d2e Merge pull request #17 from oligot/logging_filter
Logging filter
2012-12-05 08:00:43 -08:00
Jocelyn Fiat
21ec257091 Merge pull request #19 from oligot/ise_wizard_sh
ise_wizard Unix shell scripts
2012-12-04 06:06:27 -08:00
Olivier Ligot
eb676bd14b ise_wizard Unix shell scripts 2012-12-04 14:42:09 +01:00
Jocelyn Fiat
9770af09b4 Merge pull request #18 from oligot/fix_ise_wizard
Fix ise_wizard
2012-12-04 03:01:41 -08:00
Olivier Ligot
e9376b5d16 Fix ise_wizard
* ewf.ini was used instead of template.ecf as configuration file
* remove initialize_router otherwise the compilation failed
* remove unused variables
2012-12-03 17:37:26 +01:00
Olivier Ligot
fc8188aeb1 Logging filter
The logging filter is now part of EWF core (before it was only available in
the filter example) and can therefore be reused by others needing it.
Note that this is a first implementation. It can certainly be improved in
the future to support more fine grained logging.
2012-12-03 16:29:12 +01:00
Jocelyn Fiat
156406f9ac Fixed various compilation issue with new self documentation
Improved the self documentation handler to provide a make_hidden creation procedure
2012-12-03 12:20:12 +01:00
Jocelyn Fiat
e0166a4c44 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-12-03 11:30:47 +01:00
Jocelyn Fiat
c2fa3cd70a Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-12-03 11:13:59 +01:00
Jocelyn Fiat
aa0207bece updated ecf path 2012-12-03 11:12:53 +01:00
Jocelyn Fiat
125d44ff67 Added debug clause to detect in WSF_ROUTER.map_with_request_methods the existing conflicts with similar mapping.
Added smart handling of HEAD request.
Exported some internal features of WSF_REQUEST and WSF_RESPONSE to respectively WSF_REQUEST_EXPORTER and WSF_RESPONSE_EXPORTER
2012-11-26 22:58:48 +01:00
Jocelyn Fiat
bdee22f647 added debug_output to WSF_ROUTER_MAPPING 2012-11-26 22:37:44 +01:00
Jocelyn Fiat
8b5353df0a Avoid using INDEXABLE_ITERATION_CURSOR.is_last 2012-11-26 16:06:08 +01:00
Jocelyn Fiat
f18ef477b8 Included the library base(-safe).ecf which was forgotten by mistake. 2012-11-25 21:30:10 +01:00
Jocelyn Fiat
63b4f6509e Fixed compilation due to recent changes from http_client and corrected design. 2012-11-25 17:28:27 +01:00
Colin Adams
a9d83f97a8 Completed first pass for HTTP 1.1 conformace contracts 2012-11-24 15:45:42 +00:00
Colin Adams
68cd78d87d Forced HEAD when GET requested 2012-11-24 14:13:38 +00:00
Colin Adams
496df96f75 First postconditions relating to response codes added 2012-11-24 14:02:26 +00:00
Colin Adams
17ce1be582 Added framework for HTTP-conforming contracts 2012-11-24 11:55:10 +00:00
Jocelyn Fiat
b7379a6289 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-11-23 22:52:57 +01:00
Jocelyn Fiat
f0c5cf20f8 Update README.md 2012-11-23 22:52:20 +01:00
Jocelyn Fiat
5f152cff5a Update README.md 2012-11-23 22:52:17 +01:00
Jocelyn Fiat
af07986eec New design for self documented router.
The documentation is built only on demand.
A mapping entry can be hidden for the documentation
One can change the status code when building itself the WSF_ROUTER_SELF_DOCUMENTATION_MESSAGE
2012-11-23 22:49:11 +01:00
Jocelyn Fiat
78ceebf979 Update README.md 2012-11-23 18:56:44 +01:00
Jocelyn Fiat
108ab43031 Made encoder and error library compilable with 6.8 2012-11-23 18:56:09 +01:00
Jocelyn Fiat
ca1fb5a4ce Update README.md 2012-11-23 18:37:39 +01:00
Jocelyn Fiat
c654759d8e Added SHARED_... classes for encoders (html, url, xml, json, ...) 2012-11-23 18:06:56 +01:00
Jocelyn Fiat
f817008bcd Do not use {INDEXABLE_ITERATION_CURSOR}.is_last since it is added from EiffelStudio v7.2 2012-11-23 18:04:21 +01:00
Jocelyn Fiat
66ac29b3fc Updated signatures for the self documentated message 2012-11-23 15:59:56 +01:00
Jocelyn Fiat
dcb630ce98 Updated self documentation 2012-11-23 15:52:59 +01:00
Jocelyn Fiat
d8b6f80411 Added WSF_NOT_FOUND_RESPONSE to respond 404 Not found page 2012-11-23 15:52:39 +01:00
Jocelyn Fiat
9fcb897b0b Allow to use WSF_ROUTER_SELF_DOCUMENTATION_MESSAGE without any WSF_ROUTER_SELF_DOCUMENTATION_HANDLER
i.e without any specific URL to this self documentation.
Added custom value such as header, footer, style css url ...
2012-11-23 14:12:13 +01:00
Jocelyn Fiat
5926bbc0c2 Fixed signature of WSF_MIME_HANDLER.handle 2012-11-23 12:39:16 +01:00
Jocelyn Fiat
52cc743997 Added WSF_ROUTER.has_item_associated_with_resource and item_associated_with_resource
Added WSF_ROUTER_MAPPING.associated_resource
Added WSF_ROUTER_SELF_DOCUMENTATION_HANDLER and WSF_ROUTER_SELF_DOCUMENTATION_MESSAGE to provide a self documentation for WSF_ROUTER (for now, only HTML)
2012-11-23 12:38:49 +01:00
Jocelyn Fiat
ee13393a91 Made WSF_ROUTER_METHODS.new_cursor an INDEXABLE_ITERATION_CURSOR which is richer than just ITERATION_CURSOR 2012-11-23 10:07:33 +01:00
oligot
2b92ba9e62 Updated Useful links (markdown) 2012-11-22 11:28:17 -08:00
oligot
c23bf7a05d Created Useful links (markdown) 2012-11-22 04:30:08 -08:00
Jocelyn Fiat
fdd40ff08d minor change: reuse local variable 2012-11-21 09:48:58 +01:00
Jocelyn Fiat
86540814b3 Include the `url' in the http client response.
This way, we can get the real url used by the lib, especially when there are query parameters.
2012-11-21 09:48:28 +01:00
Jocelyn Fiat
504e013a74 removed "rest" from readme.md 2012-11-20 13:50:40 +01:00
Jocelyn Fiat
59316c9c65 Added WSF_ROUTER_ITEM to replace a structure represented with named TUPLE
Added debug_output to ease debugging
2012-11-20 13:49:40 +01:00
Jocelyn Fiat
6621da202d Removed pseudo rest library from draft libraries. 2012-11-20 13:49:28 +01:00
Jocelyn Fiat
ead896e870 Updated git tips related to subtree to avoid weird issue when "pulling" subtree which was putting files in wrong locations. 2012-11-15 16:32:11 +01:00
Jocelyn Fiat
e65c2da528 Merge branch 'master' of https://github.com/eiffelhub/json 2012-11-15 16:29:02 +01:00
Jocelyn Fiat
ab84e5a7a0 Fixed message for exception_failed_to_convert_to_json
Fixed indentation
2012-11-15 16:18:28 +01:00
jvelilla
f17abb1679 Update Readme.txt
Fixed documentation URI
2012-11-15 08:26:51 -02:00
Jocelyn Fiat
814ea051f1 Fixed compilation 2012-10-23 13:09:26 +02:00
Jocelyn Fiat
56214129bd Provide `server_url: STRING' that compute the http://server_name:port or https://...
using `server_name', `server_port', `server_protocol' and avoid using `http_host'
which is not reliable and could be cause of security issue.
2012-10-23 12:10:33 +02:00
Jocelyn Fiat
2c2e031944 Fixed Date: formatting, follow RFC 1123 2012-10-23 12:00:59 +02:00
Jocelyn Fiat
50d5254060 Added WSF_REQUEST_UTILITY_PROXY, that provides the WSF_REQUEST_UTILITY features to a class that implement request: WSF_REQUEST 2012-10-22 17:09:57 +02:00
Jocelyn Fiat
7dce121f8c added REST_URI_TEMPLATE_ROUTING_HANDLER 2012-10-22 14:54:02 +02:00
Jocelyn Fiat
2e774f2e10 Added WSF_ROUTING_CONTEXT_HANDLER 2012-10-22 14:27:03 +02:00
Jocelyn Fiat
b781caa2c2 Fixing design of draft rest lib (which is going to be removed soon) 2012-10-22 14:04:42 +02:00
Jocelyn Fiat
84d1f20fd0 Do not set default status if a status is already set. 2012-10-22 11:15:52 +02:00
Jocelyn Fiat
fb3148aeea Using anchor type to create the router
this is more flexible for eventual descendants redefining the router
2012-10-22 11:15:23 +02:00
oligot
92cbf48b49 Updated Projects new suggestions (markdown) 2012-10-08 03:38:12 -07:00
Jocelyn Fiat
aa743c0a7d Removed generic parameter in WSF_FILTER_HANDLER, since it is useless and make code heavy
Signed-off-by: Olivier Ligot <oligot@gmail.com>
Signed-off-by: Jocelyn Fiat <jfiat@eiffel.com>
2012-10-08 10:40:44 +02:00
Jocelyn Fiat
2d3151e45f Removed unwanted commented line 2012-10-08 09:27:03 +02:00
Jocelyn Fiat
146fd3cc7d Updated "filter" example
Signed-off-by: Olivier Ligot <oligot@gmail.com>
2012-10-08 09:24:19 +02:00
Jocelyn Fiat
016efaed15 Updated Copyright 2012-10-04 15:04:14 +02:00
Jocelyn Fiat
d9990df23f updated copyright 2012-10-04 15:01:02 +02:00
Jocelyn Fiat
9333d9c5be Updated filter example to demonstrate the use of context.
(note: this commit is a merged of pull request from Olivier Ligot, and changes from Jocelyn Fiat)

Signed-off-by: Jocelyn Fiat <jfiat@eiffel.com>
Signed-off-by: Olivier Ligot <oligot@gmail.com>
2012-10-04 15:00:44 +02:00
Jocelyn Fiat
55e4602faf Fixed compilation for STARTS_WITH_ handler 2012-10-04 14:52:28 +02:00
Jocelyn Fiat
737213b44c Added WSF_RESOURCE_CONTEXT_HANDLER_HELPER 2012-10-04 14:46:28 +02:00
Jocelyn Fiat
2f6a6cbf5f Added notion of mapping factory, so one can implement a handler without having to implement new_mapping
Added filter context handler
Added WSF_STARTS_WITH_ROUTING_HANDLER and WSF_URI_ROUTING_HANDLER (in addition to the uri template version)
2012-10-04 14:31:03 +02:00
Jocelyn Fiat
f7615edec9 fixed wsf_extension path in filter-safe.ecf file 2012-10-03 15:54:22 +02:00
Jocelyn Fiat
68f548e7cb Merge pull request #2 from jvelilla/master
Fix Assignment attempt and wsf_extension path in RestBucksCRUD
2012-10-02 03:38:30 -07:00
jvelilla
a0ebdb6098 Fixed wsf_extension.ecf path, in the example RestBucksCRUD.
Replace the assigment attempt with attached syntax
2012-10-02 07:12:42 -03:00
Jocelyn Fiat
6619349f7b Fixed some configuration files (ecf)
Fixed various compilation issue
Fixed draft rest library (still experimental and should be removed in the future)
2012-10-01 12:04:17 +02:00
Jocelyn Fiat
e0a88aec26 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-09-28 14:54:01 +02:00
Jocelyn Fiat
58d4decc58 Added initial experimentation of a CMS built with Eiffel 2012-09-28 14:53:16 +02:00
Jocelyn Fiat
291bb3a33b moved wsf_extension inside wsf/extension as wsf/wsf_extension.ecf
added wsf/session as wsf/wsf_session.ecf
In descendants of WSF_HANDLER , we can keep the result of new_mapping as WSF_ROUTER_MAPPING
2012-09-28 14:42:31 +02:00
Jocelyn Fiat
fed7b1d1e6 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-09-28 11:00:38 +02:00
Jocelyn Fiat
80c1cc1c0d Fixed wizard generated code with new router design 2012-09-27 16:10:50 +02:00
Jocelyn Fiat
e01c5bec57 Reviewed the semantic of the handler context.
Adapted existing code to fit the new router design.
2012-09-27 15:09:41 +02:00
Jocelyn Fiat
cdb88059bc Fixed Restbuck examples with new router design 2012-09-26 16:41:13 +02:00
Jocelyn Fiat
94a91fa4aa added missing wsf_routing_filter 2012-09-26 09:45:33 +02:00
Jocelyn Fiat
28186efbe7 Applied new ROUTER design to the whole EWF project. 2012-09-25 23:18:17 +02:00
Jocelyn Fiat
0e1f67809c Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-09-20 10:31:04 +02:00
Jocelyn Fiat
0503e63209 Minor implementation changes (feature renaming, ... ) 2012-09-19 10:50:38 +02:00
Jocelyn Fiat
ace897ea2b New ROUTER design, much simpler, less generic, easier to extend, and now one can mix uri map, uri_template map and so on.
Update the "tutorial" example.
2012-09-19 10:50:27 +02:00
jocelyn
1dc6ff6df1 Updated Meetings (markdown) 2012-09-19 00:25:16 -07:00
jocelyn
e72ffab2ca Updated Home (markdown) 2012-09-19 00:24:53 -07:00
jocelyn
e7a06ebc2e Updated Home (markdown) 2012-09-19 00:23:40 -07:00
jocelyn
e12e0b35ee Created Meetings (markdown) 2012-09-19 00:22:50 -07:00
jocelyn
c6dac0384b Updated Projects (markdown) 2012-09-18 23:40:52 -07:00
jocelyn
e48cee9b4a Updated Projects (markdown) 2012-09-18 23:39:45 -07:00
jocelyn
9229b66091 Updated Web meeting 2012 09 18 (markdown) 2012-09-18 13:27:01 -07:00
oligot
eea428831c Updated Web meeting 2012 09 18 (markdown) 2012-09-18 06:57:38 -07:00
jocelyn
ad12d3e16d Updated Web meeting 2012 09 18 (markdown) 2012-09-18 06:24:31 -07:00
jocelyn
b1fcedf501 Updated Web meeting 2012 09 18 (markdown) 2012-09-18 06:06:12 -07:00
jocelyn
2b00192e87 Updated Web meeting 2012 09 18 (markdown) 2012-09-18 06:04:13 -07:00
oligot
2b82e7f07f Updated Web meeting 2012 09 18 (markdown) 2012-09-17 11:42:18 -07:00
jocelyn
f820d25a9e Updated Web meeting 2012 09 18 (markdown) 2012-09-17 10:04:24 -07:00
oligot
6e76747772 Created Web meeting 2012 09 18 (markdown) 2012-09-14 01:16:00 -07:00
Jocelyn Fiat
e17f00cad6 Merge pull request #1 from GroupeS/fix_hash_table_converter
[FIX] Convertion from DS_HASH_TABLE keys to JSON
2012-09-13 08:55:32 -07:00
Olivier Ligot
6cd21c39eb [FIX] Indentation 2012-09-12 22:01:13 +02:00
Jocelyn Fiat
66af07e28e Merge pull request #2 from oligot/fix_test_compilation
[FIX] Unknown identifier 'unescaped_string'
2012-09-12 12:49:47 -07:00
Olivier Ligot
f361ce65c6 [FIX] Convertion from HASH_TABLE keys to JSON 2012-09-12 20:05:49 +02:00
Olivier Ligot
d01bccbc84 Merge branch 'master' into fix_hash_table_converter 2012-09-12 19:54:06 +02:00
Olivier Ligot
42b971f28e [FIX] Unknown identifier 'unescaped_string' 2012-09-12 17:14:49 +02:00
Jocelyn Fiat
0f59535696 Added general_encoded_string (..) that accepts READABLE_STRING_GENERAL 2012-09-11 20:53:13 +02:00
Jocelyn Fiat
795f82d51f added WSF_VALUE.is_empty: BOOLEAN 2012-09-10 16:28:25 +02:00
Jocelyn Fiat
fbd9cb9588 Added `HTML_ENCODER.general_encoded_string (s: READABLE_STRING_GENERAL): STRING_8'
(note: probably we should do similar change for all the encoders)
2012-09-10 09:36:27 +02:00
Jocelyn Fiat
0d8363aa3f Fixed issue when applying URI_TEMPLATE result to WSF_REQUEST to populate path_parameters', now if we have table parameter for foo[]' .. we ignore any string parameter with same name `foo'
Also fixed issue where the encoded name were changed later, since it kept the same string reference.
Added `WSF_REQUEST.is_post_request_method: BOOLEAN' and `WSF_REQUEST.is_get_request_method: BOOLEAN' to ease app code
2012-09-10 09:35:47 +02:00
Jocelyn Fiat
153a853df5 Added `WSF_TABLE.is_empty: BOOLEAN'
Added `WSF_TABLE.as_array_of_string: detachable ARRAY [READABLE_STRING_32]'
2012-09-10 09:31:27 +02:00
Jocelyn Fiat
45daa731cf Added put_expires_string (s: STRING) and put_expires_date (dt: DATE_TIME)
Better implementation for WSF_FILE_RESPONSE (added last modified, and other caching related info)
2012-09-10 09:27:32 +02:00
Jocelyn Fiat
f117cc0b97 Merge pull request #13 from GroupeS/filter
Filter: pre-process incoming data and post-process outgoing data
2012-09-05 08:02:41 -07:00
Olivier Ligot
b33d471cf8 [FIX] Path to libraries 2012-09-05 14:18:43 +02:00
Olivier Ligot
7ba863f43c Merge remote-tracking branch 'upstream/master' into filter 2012-09-05 14:08:41 +02:00
Jocelyn Fiat
bd15133e2b Also convert from STRING_8 to URI_TEMPLATE (not only from READABLE_STRING_8) 2012-08-31 07:03:15 +02:00
Jocelyn Fiat
0c110169de fixed location of ewf.ini for ISE wizard 2012-08-28 17:06:14 +02:00
Jocelyn Fiat
61b7f89e3b Fixed source code for building and installing the ISE Wizard 2012-08-28 16:45:25 +02:00
Jocelyn Fiat
2f94214863 Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-08-24 12:05:49 +02:00
oligot
15d12b86aa Add support for Swagger 2012-08-24 02:54:47 -07:00
Jocelyn Fiat
40e524337e Merge branch 'master' of https://github.com/eiffelhub/json
Conflicts:
	draft/library/gobo/shared_gobo_ejson.e
	draft/library/kernel/converters/json_converter.e
	draft/library/kernel/converters/json_hash_table_converter.e
	draft/library/kernel/converters/json_linked_list_converter.e
	draft/library/kernel/ejson.e
	draft/library/kernel/shared_ejson.e
	draft/test/autotest/test_suite/json_author_converter.e
	draft/test/autotest/test_suite/json_book_collection_converter.e
	draft/test/autotest/test_suite/json_book_converter.e
	draft/test/autotest/test_suite/test_json_core.e
2012-08-24 02:40:54 -07:00
Jocelyn Fiat
5487b04922 Merge branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki
Conflicts:
	doc/wiki/Home.md
2012-08-24 02:22:49 -07:00
Jocelyn Fiat
425f3fbb86 Merge branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki
Conflicts:
	doc/wiki/Home.md
2012-08-24 07:54:03 +02:00
jocelyn
a29bbab0a8 Updated Projects (markdown) 2012-08-14 01:16:50 -07:00
jocelyn
55fc25b258 Updated Projects (markdown) 2012-08-13 03:41:07 -07:00
jocelyn
681e331dec Updated Projects Suggestions (markdown) 2012-08-13 03:40:44 -07:00
jocelyn
693b5b2d1b Updated Projects Suggestions (markdown) 2012-08-13 03:40:22 -07:00
jocelyn
97018e93f6 Updated Projects (markdown) 2012-08-13 03:39:54 -07:00
jocelyn
c92be6de09 Updated Projects (markdown) 2012-08-13 03:35:26 -07:00
jocelyn
26706841a5 Updated Projects Suggestions (markdown) 2012-08-13 03:34:55 -07:00
jocelyn
a7577bb330 Updated Projects Suggestions (markdown) 2012-08-13 03:33:58 -07:00
jocelyn
dc3a897150 Updated Projects Suggestions (markdown) 2012-08-13 03:33:18 -07:00
jocelyn
764b076b88 Updated Project suggestions (markdown) 2012-08-13 03:32:52 -07:00
jocelyn
e861d65e99 Created Project suggestions (markdown) 2012-08-13 03:32:28 -07:00
jocelyn
2f556cb99e Updated Projects (markdown) 2012-08-13 03:26:44 -07:00
jocelyn
38f856a54b Updated Projects (markdown) 2012-08-13 03:17:28 -07:00
Olivier Ligot
74334e665d [ADD] Filter: pre-process incoming data and post-process outgoing data
Filters are part of a filter chain, thus following the chain of responsability
design pattern.
More information are available in library/server/wsf/src/filter/README.md
2012-08-10 10:09:59 +02:00
Jocelyn Fiat
b6464cf5e7 removed "getest" since it is duplication with autotest (and we use mainly the later for regression testing) 2012-08-08 09:13:33 +02:00
Jocelyn Fiat
8b33c77008 Added JSON_PRETTY_STRING_VISITOR
Added converter for ARRAYED_LIST
Fixed STRING_32 to JSON_VALUE issue in ejson.e
Added missing new line character at the end of some files.
Cosmetic
2012-08-08 08:51:00 +02:00
Olivier Ligot
aedf8ec1cd [FIX] Convertion from DS_HASH_TABLE keys to JSON
This is useful when the type of the key is something else than a STRING
and we have a JSON converter for this type.
2012-08-02 14:06:48 +02:00
jocelyn
3fc4936428 Updated Projects (markdown) 2012-07-31 00:46:23 -07:00
jocelyn
8a91796d12 Updated Projects (markdown) 2012-07-30 05:21:14 -07:00
jocelyn
8812b660da Updated Projects (markdown) 2012-07-30 05:12:24 -07:00
jocelyn
0647d40865 Updated Projects (markdown) 2012-07-30 05:11:18 -07:00
jocelyn
65f9b6598b Updated Projects (markdown) 2012-07-30 01:54:32 -07:00
jocelyn
600e403d91 Updated Projects (markdown) 2012-07-30 01:49:24 -07:00
jocelyn
65c9da1288 Updated Projects (markdown) 2012-07-27 09:23:12 -07:00
jocelyn
78975fbf1c Created Projects (markdown) 2012-07-27 07:54:06 -07:00
jocelyn
6a650c4a34 Updated Home (markdown) 2012-07-27 07:41:43 -07:00
jocelyn
73319dcd80 Updated Home (markdown) 2012-07-27 06:55:34 -07:00
Jocelyn Fiat
c62a4d2c49 Update master 2012-07-05 13:46:07 +03:00
Jocelyn Fiat
fce267984c Merge branch 'master' of github.com:EiffelWebFramework/EWF 2012-06-29 11:42:36 +02:00
Jocelyn Fiat
0665085eee updated to use WSF_STRING.value instead of obsolete WSF_STRING.string 2012-06-29 10:48:21 +02:00
Jocelyn Fiat
0a058882f5 Merge branch 'master' of https://github.com/eiffelhub/json 2012-06-29 10:36:53 +02:00
Jocelyn Fiat
480abdec51 Better code for tutorial example. 2012-06-29 10:27:23 +02:00
Jocelyn Fiat
b7be1cb0a2 Merge branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki 2012-06-29 07:44:03 +02:00
Jocelyn Fiat
6fa0d56465 cosmetic 2012-06-28 18:07:18 +02:00
Jocelyn Fiat
14367f9bde Merge branch 'master' of https://github.com/eiffelhub/json
Conflicts:
	draft/library/kernel/json_object.e
2012-06-28 17:55:48 +02:00
Jocelyn Fiat
e272fea9ea Merge branch 'master' of https://github.com/eiffelhub/json
Conflicts:
	draft/library/kernel/json_object.e
2012-06-28 17:28:31 +02:00
Jocelyn Fiat
1e86f53999 Added subtree merged in contrib\library\text\parser\json 2012-06-28 17:26:56 +02:00
Jocelyn Fiat
873f877530 Added TABLE_ITERABLE interface to JSON_OBJECT
Added JSON_OBJECT.replace (value, key)
2012-06-28 16:52:11 +02:00
Jocelyn Fiat
0dae7c6432 use svn export instead of svn checkout 2012-06-27 09:27:55 +02:00
Jocelyn Fiat
d539ea061a If library/cURL exists, do not copy cURL to contrib/library/network/cURL 2012-06-26 22:49:14 +02:00
Jocelyn Fiat
39aea2808e Merge branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki 2012-06-22 15:57:35 +02:00
Jocelyn Fiat
9b13aa27dd Added simple console wizard for Eiffel Studio.
(It is not very user friendly, this is a first draft)
It should be improved in the future (with GUI, ...)
2012-06-22 15:54:50 +02:00
Jocelyn Fiat
87c2074d2b Updated doc/wiki from branch 'master' of https://github.com/EiffelWebFramework/EWF.wiki
Conflicts:
	doc/wiki/Home.md
2012-06-20 14:43:39 +02:00
Jocelyn Fiat
756f4f6958 When installing, remove the folder "fonts" from the nino's example 2012-06-20 12:14:22 +02:00
1750 changed files with 150734 additions and 61884 deletions

3
.gitignore vendored
View File

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

View File

@@ -1,38 +1,7 @@
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

142
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,142 @@
# 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

121
MIGRATION.md Normal file
View File

@@ -0,0 +1,121 @@
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,10 +1,29 @@
# Eiffel Web Framework
## Version: v0.1
## 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/
@@ -16,26 +35,21 @@ For more information please have a look at the related wiki:
For download, check
* https://github.com/EiffelWebFramework/EWF/downloads
## Requirements
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
* Developped using EiffelStudio 7.0 (on Windows, Linux)
* Tested using EiffelStudio 7.0 with "jenkins" CI server (and v6.8 for time to time)
## 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')
* 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 version >= 1.6.5
* git clone --recursive https://github.com/EiffelWebFramework/EWF.git
Otherwise, try
Using git
* git clone https://github.com/EiffelWebFramework/EWF.git
* cd Eiffel-Web-Framework
* git submodule update --init
* git submodule foreach --recursive git checkout master
An alternative to the last 2 instructions is to use the script from tools folder:
* cd tools
* update_git_working_copy
* And to build the required and related Clibs
* cd contrib/ise_library/cURL
@@ -48,12 +62,12 @@ An alternative to the last 2 instructions is to use the script from tools folder
* connectors: various web server connectors for EWSGI
* libfcgi: Wrapper for libfcgi SDK
* __wsf__: Web Server Framework [read more](library/server/wsf)
* include URL dispatching/routing based on uri, uri_template, or custom [read more](library/server/wsf/router)
* __router__: URL dispatching/routing based on uri, uri_template, or custom [read more](library/server/wsf/router)
### 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__: CONNEG library (Content-type Negociation) [read more](library/protocol/CONNEG)
* __CONNEG__: Content negotiation library (Content-type Negociation) [read more](library/protocol/content_negotiation)
### client
* __http_client__: simple HTTP client based on cURL [read more](library/client/http_client)
@@ -66,19 +80,31 @@ An alternative to the last 2 instructions is to use the script from tools folder
## External libraries under 'contrib'
* [Eiffel Web Nino](contrib/library/server/nino)
* contrib/ise_library/cURL
* contrib/ise_library/math/eapml
* contrib/ise_library/text/encryption/eel
* contrib/library/text/parser/json
* ..
## Draft folder = call for contribution ##
### library/server/request ###
* request
* rest: (experimental) "a" RESTful library to help building RESTful services
## 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

@@ -1 +0,0 @@
Version v0.1

View File

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

View File

@@ -1,35 +0,0 @@
<?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

@@ -1,93 +0,0 @@
<?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

@@ -1,93 +0,0 @@
<?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

@@ -1,58 +0,0 @@
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

@@ -1,92 +0,0 @@
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

@@ -1,24 +0,0 @@
<?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

@@ -1,188 +0,0 @@
/*
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

@@ -1,28 +0,0 @@
<?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

@@ -1,93 +0,0 @@
<?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

@@ -1,93 +0,0 @@
<?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

@@ -1,336 +0,0 @@
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

@@ -1,104 +0,0 @@
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

@@ -1,409 +0,0 @@
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

@@ -1,254 +0,0 @@
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

@@ -1,94 +0,0 @@
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

@@ -1,78 +0,0 @@
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

@@ -1,257 +0,0 @@
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

@@ -1,78 +0,0 @@
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

@@ -1,122 +0,0 @@
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

@@ -1,69 +0,0 @@
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

@@ -1,51 +0,0 @@
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

@@ -1,83 +0,0 @@
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

@@ -1,48 +0,0 @@
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

@@ -1,251 +0,0 @@
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

@@ -1,50 +0,0 @@
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

@@ -1,51 +0,0 @@
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 +0,0 @@
reference:forum2

View File

@@ -1,5 +0,0 @@
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

@@ -1,67 +0,0 @@
#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

@@ -1,81 +0,0 @@
#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

@@ -1,80 +0,0 @@
#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

@@ -1,346 +0,0 @@
#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

@@ -1,34 +0,0 @@
#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

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

View File

@@ -1,47 +0,0 @@
/*
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,4 +0,0 @@
Eiffel Arbitrary Precision Mathematics Library
Contribution from Colin LeMahieu
see original source: https://github.com/clemahieu/eapml

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-6-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-6-0 http://www.eiffel.com/developers/xml/configuration-1-6-0.xsd" name="eapml" uuid="3E9258E1-383A-40BF-864B-231FC8F25ADF" library_target="eapml">
<description>Eiffel Arbitrary Precision Mathematics Library
Note: you should set 'eapml_scan_type' to 'gcc' or 'vc'
and 'eapml_limb_type' to 'natural_32' (or 'natural_64')
If not, default values will be used depending on the platform
</description>
<target name="eapml">
<file_rule>
<exclude>/.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.hg$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
<description>Eiffel Arbitrary Precision Mathematics</description>
<root all_classes="true"/>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<cluster name="bit_scan_gcc" location=".\src\bit_scan_gcc\" recursive="true">
<condition>
<custom name="eapml_scan_type" value="gcc"/>
</condition>
<condition>
<platform excluded_value="windows"/>
<custom name="eapml_scan_type" excluded_value="vc"/>
</condition>
</cluster>
<cluster name="bit_scan_vc" location=".\src\bit_scan_vc\" recursive="true">
<condition>
<custom name="eapml_scan_type" value="vc"/>
</condition>
<condition>
<platform value="windows"/>
<custom name="eapml_scan_type" excluded_value="gcc"/>
</condition>
</cluster>
<cluster name="eapml" location=".\src\" recursive="true">
<file_rule>
<exclude>/bit_scan_vc$</exclude>
<exclude>/bit_scan_gcc$</exclude>
<exclude>/limb_natural_32$</exclude>
<exclude>/limb_natural_64$</exclude>
</file_rule>
<file_rule>
<exclude>^/mp/number/support$</exclude>
</file_rule>
</cluster>
<cluster name="limb_natural_32" location=".\src\limb_natural_32\" recursive="true">
<!--
<condition>
<custom name="eapml_limb_type" value="natural_32"/>
</condition>
-->
</cluster>
<!--
<cluster name="limb_natural_64" location=".\src\limb_natural_64\" recursive="true">
<condition>
<custom name="eapml_limb_type" value="natural_64"/>
</condition>
</cluster>
-->
</target>
</system>

View File

@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-0.xsd" name="eapml" uuid="3E9258E1-383A-40BF-864B-231FC8F25ADF" library_target="eapml">
<description>Eiffel Arbitrary Precision Mathematics Library
Note: you should set 'eapml_scan_type' to 'gcc' or 'vc'
and 'eapml_limb_type' to 'natural_32' (or 'natural_64')
If not, default values will be used depending on the platform
</description>
<target name="eapml">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/\.svn$</exclude>
<exclude>/\.hg$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="false" void_safety="none" syntax="standard">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<cluster name="bit_scan_gcc" location=".\src\bit_scan_gcc\" recursive="true">
<condition>
<custom name="eapml_scan_type" value="gcc"/>
</condition>
<condition>
<platform excluded_value="windows"/>
<custom name="eapml_scan_type" excluded_value="vc"/>
</condition>
</cluster>
<cluster name="bit_scan_vc" location=".\src\bit_scan_vc\" recursive="true">
<condition>
<custom name="eapml_scan_type" value="vc"/>
</condition>
<condition>
<platform value="windows"/>
<custom name="eapml_scan_type" excluded_value="gcc"/>
</condition>
</cluster>
<cluster name="eapml" location=".\src\" recursive="true">
<file_rule>
<exclude>/bit_scan_vc$</exclude>
<exclude>/bit_scan_gcc$</exclude>
<exclude>/limb_natural_32$</exclude>
<exclude>/limb_natural_64$</exclude>
</file_rule>
<file_rule>
<exclude>^/mp/number/support$</exclude>
</file_rule>
</cluster>
<cluster name="limb_natural_32" location=".\src\limb_natural_32\" recursive="true">
<!--
<condition>
<custom name="eapml_limb_type" value="natural_32"/>
</condition>
-->
</cluster>
<!--
<cluster name="limb_natural_64" location=".\src\limb_natural_64\" recursive="true">
<condition>
<custom name="eapml_limb_type" value="natural_64"/>
</condition>
</cluster>
-->
</target>
</system>

View File

@@ -1,59 +0,0 @@
note
description: "Summary description for {LIMB_BIT_SCANNING}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
deferred class
LIMB_BIT_SCANNING
inherit
LIMB_DEFINITION
feature
leading_zeros (limb_a: NATURAL_32): INTEGER
do
if limb_a = 0 then
Result := limb_bits
else
Result := count_leading_zeros (limb_a)
end
end
most_significant_one (limb_a: NATURAL_32): INTEGER
-- 31 high, 0 low
require
limb_a /= 0
do
Result := limb_high_bit - leading_zeros (limb_a)
end
trailing_zeros (limb_a: NATURAL_32): INTEGER
-- 31 high, 0 low
require
limb_a /= 0
do
Result := count_trailing_zeros (limb_a)
end
feature {NONE} -- Implementation
count_trailing_zeros (limb_a: NATURAL_32): INTEGER
external
"C inline"
alias
"[
return __builtin_ctz ($limb_a);
]"
end
count_leading_zeros (limb_a: NATURAL_32): INTEGER
external
"C inline"
alias
"[
return __builtin_clz ($limb_a);
]"
end
end

View File

@@ -1,59 +0,0 @@
note
description: "Summary description for {LIMB_BIT_SCANNING}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
deferred class
LIMB_BIT_SCANNING
inherit
LIMB_DEFINITION
feature
leading_zeros (limb_a: NATURAL_32): INTEGER
do
if limb_a = 0 then
Result := limb_bits
else
Result := limb_high_bit - most_significant_one (limb_a)
end
end
most_significant_one (limb_a: NATURAL_32): INTEGER
-- 31 high, 0 low
require
limb_a /= 0
do
bit_scan_reverse ($Result, limb_a)
end
trailing_zeros (limb_a: NATURAL_32): INTEGER
-- 31 high, 0 low
require
limb_a /= 0
do
bit_scan_forward ($Result, limb_a)
end
feature {NONE} -- Implementation
bit_scan_reverse (target: POINTER; limb_a: NATURAL_32)
external
"C inline use %"intrin.h%""
alias
"[
_BitScanReverse ($target, $limb_a);
]"
end
bit_scan_forward (target: POINTER; limb_a: NATURAL_32)
external
"C inline use %"intrin.h%""
alias
"[
_BitScanForward ($target, $limb_a);
]"
end
end

View File

@@ -1,19 +0,0 @@
note
description: "An exception when dividing by zero"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "A right is not what someone gives you; it's what no one can take from you. - Ramsey Clark, U.S. Attorney General, New York Times, 10/02/77"
class
DIVIDE_BY_ZERO
inherit
DEVELOPER_EXCEPTION
redefine
internal_meaning
end
feature
internal_meaning: STRING = "Divide by zero"
end

View File

@@ -1,224 +0,0 @@
note
description: "Convert between character codes and numbers ignoring case"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "There can be no freedom without freedom to fail. - Eric Hoffer (1902-1983), The Ordeal of Change, 1964"
class
CASE_INSENSITIVE_STRATEGY
inherit
CHARACTER_STRATEGY
feature
text_to_number (in: NATURAL_8): NATURAL_8
do
inspect
in
when 0x30 then
Result := 0x0
when 0x31 then
Result := 1
when 0x32 then
Result := 2
when 0x33 then
Result := 3
when 0x34 then
Result := 4
when 0x35 then
Result := 5
when 0x36 then
Result := 6
when 0x37 then
Result := 7
when 0x38 then
Result := 8
when 0x39 then
Result := 9
when 0x41 then
Result := 10
when 0x42 then
Result := 11
when 0x43 then
Result := 12
when 0x44 then
Result := 13
when 0x45 then
Result := 14
when 0x46 then
Result := 15
when 0x47 then
Result := 16
when 0x48 then
Result := 17
when 0x49 then
Result := 18
when 0x4a then
Result := 19
when 0x4b then
Result := 20
when 0x4c then
Result := 21
when 0x4d then
Result := 22
when 0x4e then
Result := 23
when 0x4f then
Result := 24
when 0x50 then
Result := 25
when 0x51 then
Result := 26
when 0x52 then
Result := 27
when 0x53 then
Result := 28
when 0x54 then
Result := 29
when 0x55 then
Result := 30
when 0x56 then
Result := 31
when 0x57 then
Result := 32
when 0x58 then
Result := 33
when 0x59 then
Result := 34
when 0x5a then
Result := 35
when 0x61 then
Result := 10
when 0x62 then
Result := 11
when 0x63 then
Result := 12
when 0x64 then
Result := 13
when 0x65 then
Result := 14
when 0x66 then
Result := 15
when 0x67 then
Result := 16
when 0x68 then
Result := 17
when 0x69 then
Result := 18
when 0x6a then
Result := 19
when 0x6b then
Result := 20
when 0x6c then
Result := 21
when 0x6d then
Result := 22
when 0x6e then
Result := 23
when 0x6f then
Result := 24
when 0x70 then
Result := 25
when 0x71 then
Result := 26
when 0x72 then
Result := 27
when 0x73 then
Result := 28
when 0x74 then
Result := 29
when 0x75 then
Result := 30
when 0x76 then
Result := 31
when 0x77 then
Result := 32
when 0x78 then
Result := 33
when 0x79 then
Result := 34
when 0x7a then
Result := 35
end
end
number_to_text (in: NATURAL_8): NATURAL_8
do
inspect in
when 0 then
Result := 0x30
when 1 then
Result := 0x31
when 2 then
Result := 0x32
when 3 then
Result := 0x33
when 4 then
Result := 0x34
when 5 then
Result := 0x35
when 6 then
Result := 0x36
when 7 then
Result := 0x37
when 8 then
Result := 0x38
when 9 then
Result := 0x39
when 10 then
Result := 0x61
when 11 then
Result := 0x62
when 12 then
Result := 0x63
when 13 then
Result := 0x64
when 14 then
Result := 0x65
when 15 then
Result := 0x66
when 16 then
Result := 0x67
when 17 then
Result := 0x68
when 18 then
Result := 0x69
when 19 then
Result := 0x6a
when 20 then
Result := 0x6b
when 21 then
Result := 0x6c
when 22 then
Result := 0x6d
when 23 then
Result := 0x6e
when 24 then
Result := 0x6f
when 25 then
Result := 0x70
when 26 then
Result := 0x71
when 27 then
Result := 0x72
when 28 then
Result := 0x73
when 29 then
Result := 0x74
when 30 then
Result := 0x75
when 31 then
Result := 0x76
when 32 then
Result := 0x77
when 33 then
Result := 0x78
when 34 then
Result := 0x79
when 35 then
Result := 0x7a
end
end
end

View File

@@ -1,276 +0,0 @@
note
description: "Convert between character codes and numbers case-sensitive"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "I believe the State exists for the development of individual lives, not individuals for the development of the state. - Julian Huxley (1878-1975)"
class
CASE_SENSITIVE_STRATEGY
inherit
CHARACTER_STRATEGY
feature
text_to_number (in: NATURAL_8): NATURAL_8
do
inspect
in
when 0x30 then
Result := 0x0
when 0x31 then
Result := 1
when 0x32 then
Result := 2
when 0x33 then
Result := 3
when 0x34 then
Result := 4
when 0x35 then
Result := 5
when 0x36 then
Result := 6
when 0x37 then
Result := 7
when 0x38 then
Result := 8
when 0x39 then
Result := 9
when 0x41 then
Result := 10
when 0x42 then
Result := 11
when 0x43 then
Result := 12
when 0x44 then
Result := 13
when 0x45 then
Result := 14
when 0x46 then
Result := 15
when 0x47 then
Result := 16
when 0x48 then
Result := 17
when 0x49 then
Result := 18
when 0x4a then
Result := 19
when 0x4b then
Result := 20
when 0x4c then
Result := 21
when 0x4d then
Result := 22
when 0x4e then
Result := 23
when 0x4f then
Result := 24
when 0x50 then
Result := 25
when 0x51 then
Result := 26
when 0x52 then
Result := 27
when 0x53 then
Result := 28
when 0x54 then
Result := 29
when 0x55 then
Result := 30
when 0x56 then
Result := 31
when 0x57 then
Result := 32
when 0x58 then
Result := 33
when 0x59 then
Result := 34
when 0x5a then
Result := 35
when 0x61 then
Result := 36
when 0x62 then
Result := 37
when 0x63 then
Result := 38
when 0x64 then
Result := 39
when 0x65 then
Result := 40
when 0x66 then
Result := 41
when 0x67 then
Result := 42
when 0x68 then
Result := 43
when 0x69 then
Result := 44
when 0x6a then
Result := 45
when 0x6b then
Result := 46
when 0x6c then
Result := 47
when 0x6d then
Result := 48
when 0x6e then
Result := 49
when 0x6f then
Result := 50
when 0x70 then
Result := 51
when 0x71 then
Result := 52
when 0x72 then
Result := 53
when 0x73 then
Result := 54
when 0x74 then
Result := 55
when 0x75 then
Result := 56
when 0x76 then
Result := 57
when 0x77 then
Result := 58
when 0x78 then
Result := 59
when 0x79 then
Result := 60
when 0x7a then
Result := 61
end
end
number_to_text (in: NATURAL_8): NATURAL_8
do
inspect in
when 0 then
Result := 0x30
when 1 then
Result := 0x31
when 2 then
Result := 0x32
when 3 then
Result := 0x33
when 4 then
Result := 0x34
when 5 then
Result := 0x35
when 6 then
Result := 0x36
when 7 then
Result := 0x37
when 8 then
Result := 0x38
when 9 then
Result := 0x39
when 10 then
Result := 0x41
when 11 then
Result := 0x42
when 12 then
Result := 0x43
when 13 then
Result := 0x44
when 14 then
Result := 0x45
when 15 then
Result := 0x46
when 16 then
Result := 0x47
when 17 then
Result := 0x48
when 18 then
Result := 0x49
when 19 then
Result := 0x4a
when 20 then
Result := 0x4b
when 21 then
Result := 0x4c
when 22 then
Result := 0x4d
when 23 then
Result := 0x4e
when 24 then
Result := 0x4f
when 25 then
Result := 0x50
when 26 then
Result := 0x51
when 27 then
Result := 0x52
when 28 then
Result := 0x53
when 29 then
Result := 0x54
when 30 then
Result := 0x55
when 31 then
Result := 0x56
when 32 then
Result := 0x57
when 33 then
Result := 0x58
when 34 then
Result := 0x59
when 35 then
Result := 0x5a
when 36 then
Result := 0x61
when 37 then
Result := 0x62
when 38 then
Result := 0x63
when 39 then
Result := 0x64
when 40 then
Result := 0x65
when 41 then
Result := 0x66
when 42 then
Result := 0x67
when 43 then
Result := 0x68
when 44 then
Result := 0x69
when 45 then
Result := 0x6a
when 46 then
Result := 0x6b
when 47 then
Result := 0x6c
when 48 then
Result := 0x6d
when 49 then
Result := 0x6e
when 50 then
Result := 0x6f
when 51 then
Result := 0x70
when 52 then
Result := 0x71
when 53 then
Result := 0x72
when 54 then
Result := 0x73
when 55 then
Result := 0x74
when 56 then
Result := 0x75
when 57 then
Result := 0x76
when 58 then
Result := 0x77
when 59 then
Result := 0x78
when 60 then
Result := 0x79
when 61 then
Result := 0x7a
end
end
end

View File

@@ -1,20 +0,0 @@
note
description: "A strategy for converting character codes to numbers and vica-versa"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Free speech is meaningless unless it tolerates the speech that we hate. - Henry J. Hyde, U.S. Congressman, Speech, 5/3/91"
deferred class
CHARACTER_STRATEGY
feature
text_to_number (in: NATURAL_8): NATURAL_8
deferred
end
number_to_text (in: NATURAL_8): NATURAL_8
deferred
end
end

View File

@@ -1,77 +0,0 @@
note
description: "Summary description for {INTEGER_X_ACCESS}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "It is error alone which needs the support of government. Truth can stand by itself. - Thomas Jefferson (1743-1846), U.S. President, Notes on the State of Virginia, 1782"
deferred class
INTEGER_X_ACCESS
inherit
INTEGER_X_FACILITIES
SPECIAL_SIZING
SPECIAL_ACCESS
rename
get_str as get_str_special
end
feature
get_string (op: READABLE_INTEGER_X; base: INTEGER): STRING_8
require
base >= 2
base <= 62
local
xp: SPECIAL [NATURAL_32]
xp_offset: INTEGER
x_size: INTEGER
str: STRING_8
str_offset: INTEGER
return_str: STRING_8
return_str_offset: INTEGER
str_size: INTEGER
alloc_size: INTEGER
num_to_text: CHARACTER_STRATEGY
i: INTEGER
do
x_size := op.count
if base <= 35 then
create {CASE_INSENSITIVE_STRATEGY}num_to_text
else
create {CASE_SENSITIVE_STRATEGY}num_to_text
end
alloc_size := sizeinbase (op.item, 0, x_size.abs, base)
alloc_size := alloc_size + (x_size < 0).to_integer
create Result.make_filled ('%U', alloc_size)
return_str := Result
return_str_offset := 1
if x_size < 0 then
return_str [return_str_offset] := '-'
return_str_offset := return_str_offset + 1
x_size := -x_size
end
xp := op.item
xp_offset := 0
if not pow2_p (base.to_natural_32) then
create xp.make_filled (0, x_size + 1)
xp.copy_data (op.item, 0, 0, x_size)
end
str_size := get_str_special (return_str, return_str_offset, base, xp, xp_offset, x_size)
str := return_str
str.remove_tail (alloc_size - str_size - (return_str_offset - 1))
str_offset := return_str_offset
if str [str_offset] = (0x0).to_character_8 and str_size /= 1 then
str_size := str_size - 1
str_offset := str_offset + 1
end
from
i := 0
until
i >= str_size
loop
return_str [return_str_offset + i] := num_to_text.number_to_text (str [str_offset + i].code.to_natural_8).to_character_8
i := i + 1
end
end
end

View File

@@ -1,914 +0,0 @@
note
description: "Summary description for {INTEGER_X_ARITHMETIC}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Every man should know that his conversations, his correspondence, and his personal life are private. - Lyndon B. Johnson (1908-1973), Remarks, 3/10/67"
deferred class
INTEGER_X_ARITHMETIC
inherit
INTEGER_X_FACILITIES
SPECIAL_ARITHMETIC
rename
add as add_special,
sub as sub_special,
mul as mul_special
export
{NONE}
all
end
SPECIAL_COMPARISON
SPECIAL_UTILITY
feature
add (target: READABLE_INTEGER_X; op1_a: READABLE_INTEGER_X; op2_a: READABLE_INTEGER_X)
-- Set `rop' to `op1' + `op2'.
local
wp: SPECIAL [NATURAL_32]
wp_offset: INTEGER
up: SPECIAL [NATURAL_32]
vp: SPECIAL [NATURAL_32]
usize: INTEGER_32
vsize: INTEGER_32
wsize: INTEGER_32
abs_usize: INTEGER_32
abs_vsize: INTEGER_32
pointer_temp: READABLE_INTEGER_X
int_temp: INTEGER_32
junk2: NATURAL_32
cy_limb: NATURAL_32
op1: READABLE_INTEGER_X
op2: READABLE_INTEGER_X
carry: CELL [NATURAL_32]
do
create carry.put (0)
op1 := op1_a
op2 := op2_a
usize := op1.count
vsize := op2.count
abs_usize := usize.abs
abs_vsize := vsize.abs
if abs_usize < abs_vsize then
pointer_temp := op1
op1 := op2
op2 := pointer_temp
int_temp := usize
usize := vsize
vsize := int_temp
int_temp := abs_usize
abs_usize := abs_vsize
abs_vsize := int_temp
end
wsize := abs_usize + 1
target.resize (wsize)
up := op1.item
vp := op2.item
wp := target.item
if usize.bit_xor (vsize) < 0 then
if abs_usize /= abs_vsize then
sub_special (wp, 0, up, 0, abs_usize, vp, 0, abs_vsize, carry)
junk2 := carry.item
wsize := abs_usize
wsize := normalize (wp, wp_offset, wsize)
if usize < 0 then
wsize := -wsize
end
elseif cmp (up, 0, vp, 0, abs_usize) < 0 then
sub_n (wp, 0, vp, 0, up, 0, abs_usize, carry)
junk2 := carry.item
wsize := abs_usize
wsize := normalize (wp, wp_offset, wsize)
if usize >= 0 then
wsize := -wsize
end
else
sub_n (wp, 0, up, 0, vp, 0, abs_usize, carry)
junk2 := carry.item
wsize := abs_usize
wsize := normalize (wp, wp_offset, wsize)
if usize < 0 then
wsize := -wsize
end
end
else
add_special (wp, 0, up, 0, abs_usize, vp, 0, abs_vsize, carry)
cy_limb := carry.item
wp [wp_offset + abs_usize] := cy_limb
wsize := abs_usize + cy_limb.to_integer_32
if usize < 0 then
wsize := -wsize
end
end
target.count := wsize
end
add_ui (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: NATURAL)
-- Set `rop' to `op1' + `op2'.
local
usize: INTEGER_32
wsize: INTEGER_32
abs_usize: INTEGER_32
cy: NATURAL_32
junk2: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
usize := op1.count
abs_usize := usize.abs
wsize := abs_usize + 1
target.resize (wsize)
if abs_usize = 0 then
target.item [0] := op2
if op2 /= 0 then
target.count := 1
else
target.count := 0
end
else
if usize >= 0 then
add_1 (target.item, 0, op1.item, 0, abs_usize, op2, carry)
cy := carry.item
target.item [abs_usize] := cy
wsize := abs_usize + cy.to_integer_32
else
if abs_usize = 1 and op1.item [0] < op2 then
target.item [0] := op2 - op1.item [0]
wsize := 1
else
sub_1 (target.item, 0, op1.item, 0, abs_usize, op2, carry)
junk2 := carry.item
if target.item [abs_usize - 1] = 0 then
wsize := - (abs_usize - 1)
else
wsize := - (abs_usize)
end
end
end
target.count := wsize
end
end
aorsmul (target: READABLE_INTEGER_X; op1_a: READABLE_INTEGER_X; op2_a: READABLE_INTEGER_X; sub_a: INTEGER_32)
local
xsize: INTEGER_32
ysize: INTEGER_32
tsize: INTEGER_32
wsize: INTEGER_32
wsize_signed: INTEGER_32
wp: INTEGER_32
tp: SPECIAL [NATURAL_32]
c: NATURAL_32
high: NATURAL_32
tmp_marker: SPECIAL [NATURAL_32]
tp_offset: INTEGER_32
current_temp: READABLE_INTEGER_X
int_temp: INTEGER_32
usize: INTEGER_32
sub_l: INTEGER_32
junk2: NATURAL_32
op1: READABLE_INTEGER_X
op2: READABLE_INTEGER_X
carry: CELL [NATURAL_32]
do
create carry.put (0)
op1 := op1_a
op2 := op2_a
sub_l := sub_a
xsize := op1.count
ysize := op2.count
if xsize = 0 or ysize = 0 then
else
if ysize.abs > xsize.abs then
current_temp := op1
op1 := op2
op2 := current_temp
int_temp := xsize
xsize := ysize
ysize := int_temp
end
sub_l := sub_l.bit_xor (ysize)
ysize := ysize.abs
if ysize = 1 then
aorsmul_1 (target, op1, op2.item [0], sub_l)
else
sub_l := sub_l.bit_xor (xsize)
xsize := xsize.abs
wsize_signed := target.count
sub_l := sub_l.bit_xor (wsize_signed)
wsize := wsize_signed.abs
tsize := xsize + ysize
if wsize > tsize then
if wsize + 1 > target.capacity then
target.resize (wsize)
end
else
if tsize + 1 > target.capacity then
target.resize (tsize)
end
end
if wsize_signed = 0 then
mul_special (target.item, 0, op1.item, 0, xsize, op2.item, 0, ysize, carry)
high := carry.item
if high = 0 then
tsize := tsize - 1
end
if sub_l >= 0 then
target.count := tsize
else
target.count := -tsize
end
else
create tmp_marker.make_filled (0, tsize)
tp := tmp_marker
tp_offset := 0
mul_special (tmp_marker, 0, op1.item, 0, xsize, op2.item, 0, ysize, carry)
high := carry.item
if high = 0 then
tsize := tsize - 1
end
if sub_l >= 0 then
usize := wsize
if usize < tsize then
usize := tsize
tp_offset := wp
tsize := wsize
wsize := usize
end
add_special (target.item, wp, op1.item, 0, usize, tp, 0, tsize, carry)
c := carry.item
target.item [wp + wsize] := c
if c /= 0 then
wsize := wsize + 1
end
else
usize := wsize
if usize < tsize or usize = tsize and cmp (target.item, wp, tmp_marker, 0, usize) < 0 then
usize := tsize
tp_offset := wp
tsize := wsize
wsize := usize
wsize_signed := -wsize_signed
end
sub_special (target.item, wp, target.item, wp, usize, tp, tp_offset, tsize, carry)
junk2 := carry.item
wsize := usize
from
until
wsize > 0 or target.item [wp + wsize - 1] /= 0
loop
wsize := wsize - 1
end
end
if wsize_signed >= 0 then
target.count := wsize
else
target.count := -wsize
end
end
end
end
end
aorsmul_1 (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: NATURAL_32; sub_a: INTEGER_32)
local
xsize: INTEGER_32
wsize: INTEGER_32
wsize_signed: INTEGER_32
new_wsize: INTEGER_32
min_size: INTEGER_32
dsize: INTEGER_32
xp: INTEGER_32
wp: INTEGER_32
cy: NATURAL_32
sub_l: INTEGER_32
cy2: NATURAL_32
d: INTEGER_32
s: INTEGER_32
n: INTEGER_32
x: NATURAL_32
p: INTEGER_32
cy__: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
sub_l := sub_a
xsize := op1.count
if xsize = 0 or op2 = 0 then
else
sub_l := sub_l.bit_xor (xsize)
xsize := xsize.abs
wsize_signed := target.count
if wsize_signed = 0 then
target.resize (xsize + 1)
wp := 0
mul_1 (target.item, 0, op1.item, 0, xsize, op2, carry)
cy := carry.item
target.item [xsize] := cy
if cy /= 0 then
xsize := xsize + 1
end
if sub_l >= 0 then
target.count := xsize
else
target.count := -xsize
end
else
sub_l := sub_l.bit_xor (wsize_signed)
wsize := wsize_signed.abs
new_wsize := wsize.max (xsize)
target.resize (new_wsize + 1)
wp := 0
xp := 0
min_size := wsize.min (xsize)
if sub_l >= 0 then
addmul_1 (target.item, 0, op1.item, 0, min_size, op2, carry)
cy := carry.item
wp := wp + min_size
xp := xp + min_size
dsize := xsize - wsize
if dsize /= 0 then
if dsize > 0 then
mul_1 (target.item, wp, op1.item, xp, min_size, op2, carry)
cy2 := carry.item
else
dsize := -dsize
cy2 := 0
end
add_1 (target.item, wp, target.item, wp, dsize, cy, carry)
cy := cy2 + carry.item
end
target.item [wp + dsize] := cy
if cy /= 0 then
new_wsize := new_wsize + 1
end
else
submul_1 (target.item, wp, op1.item, xp, min_size, op2, carry)
cy := carry.item
if wsize >= xsize then
if wsize /= xsize then
sub_1 (target.item, wp + xsize, op1.item, wp + xsize, wsize - xsize, cy, carry)
cy := carry.item
if cy /= 0 then
target.item [wp + new_wsize] := (-cy.to_integer_32).bit_not.to_natural_32
d := wp
s := wp
n := new_wsize
from
target.item [d] := target.item [s].bit_not
d := d + 1
s := s + 1
n := n - 1
until
n = 0
loop
target.item [d] := target.item [s].bit_not
d := d + 1
s := s + 1
n := n - 1
end
new_wsize := new_wsize + 1
p := wp
x := target.item [p] + 1
target.item [p] := x
if x < 1 then
from
p := p + 1
target.item [p] := target.item [p] + 1
until
target.item [p] /= 0
loop
p := p + 1
target.item [p] := target.item [p] + 1
end
end
wsize_signed := -wsize_signed
end
else
d := wp
s := wp
n := wsize
from
target.item [d] := target.item [s].bit_not
s := s + 1
d := d + 1
n := n - 1
until
n = 0
loop
target.item [d] := target.item [s].bit_not
s := s + 1
d := d + 1
n := n - 1
end
add_1 (target.item, wp, target.item, wp, wsize, 1, carry)
cy := carry.item
cy := cy - 1
if cy = (0).to_natural_32.bit_not then
cy2 := cy2 + 1
end
cy := cy + cy2
mul_1 (target.item, wp + wsize, target.item, xp + wsize, xsize - wsize, op2, carry)
cy__ := carry.item
add_1 (target.item, wp + wsize, target.item, wp + wsize, xsize - wsize, cy, carry)
cy := cy__ + carry.item
target.item [wp + new_wsize] := cy
if cy /= 0 then
new_wsize := new_wsize + 1
end
if cy2 /= 0 then
p := wp + wsize
x := target.item [p]
target.item [p] := x - 1
if x < 1 then
from
p := p + 1
target.item [p] := target.item [p] - 1
until
target.item [p] = 0
loop
p := p + 1
target.item [p] := target.item [p] - 1
end
end
end
wsize_signed := -wsize_signed
end
end
from
until
new_wsize <= 0 or target.item [(wp + new_wsize) * 4] /= 0
loop
new_wsize := new_wsize - 1
end
end
if wsize_signed >= 0 then
target.count := new_wsize
else
target.count := -new_wsize
end
end
end
end
sub (target: READABLE_INTEGER_X; op1_a: READABLE_INTEGER_X; op2_a: READABLE_INTEGER_X)
-- Set `rop' to `op1' - `op2'.
local
usize: INTEGER_32
vsize: INTEGER_32
wsize: INTEGER_32
abs_usize: INTEGER_32
abs_vsize: INTEGER_32
pointer_temp: READABLE_INTEGER_X
integer_temp: INTEGER_32
junk2: NATURAL_32
cy_limb: NATURAL_32
op1: READABLE_INTEGER_X
op2: READABLE_INTEGER_X
carry: CELL [NATURAL_32]
do
create carry.put (0)
op1 := op1_a
op2 := op2_a
usize := op1.count
vsize := -op2.count
abs_usize := usize.abs
abs_vsize := vsize.abs
if abs_usize < abs_vsize then
pointer_temp := op1
op1 := op2
op2 := pointer_temp
integer_temp := usize
usize := vsize
vsize := integer_temp
integer_temp := abs_usize
abs_usize := abs_vsize
abs_vsize := integer_temp
end
wsize := abs_usize + 1
target.resize (wsize)
if usize.bit_xor (vsize) < 0 then
if abs_usize /= abs_vsize then
sub_special (target.item, 0, op1.item, 0, abs_usize, op2.item, 0, abs_vsize, carry)
junk2 := carry.item
wsize := abs_usize
from
until
wsize <= 0 or target.item [wsize - 1] /= 0
loop
wsize := wsize - 1
end
if usize < 0 then
wsize := -wsize
end
elseif cmp (op1.item, 0, op2.item, 0, abs_usize) < 0 then
sub_n (target.item, 0, op2.item, 0, op1.item, 0, abs_usize, carry)
junk2 := carry.item
wsize := abs_usize
from
until
wsize <= 0 or target.item [wsize - 1] /= 0
loop
wsize := wsize - 1
end
if usize >= 0 then
wsize := -wsize
end
else
sub_n (target.item, 0, op1.item, 0, op2.item, 0, abs_usize, carry)
junk2 := carry.item
wsize := abs_usize
from
until
wsize <= 0 or target.item [wsize - 1] /= 0
loop
wsize := wsize - 1
end
if usize < 0 then
wsize := -wsize
end
end
else
add_special (target.item, 0, op1.item, 0, abs_usize, op2.item, 0, abs_vsize, carry)
cy_limb := carry.item
target.item [abs_usize] := cy_limb
wsize := abs_usize + cy_limb.to_integer_32
if usize < 0 then
wsize := -wsize
end
end
target.count := wsize
end
sub_ui (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: NATURAL)
-- Set `rop' to `op1' - `op2'.
local
usize: INTEGER_32
wsize: INTEGER_32
abs_usize: INTEGER_32
vval: NATURAL_32
cy: NATURAL_32
junk2: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
usize := op1.count
abs_usize := usize.abs
wsize := abs_usize + 1
target.resize (wsize)
if abs_usize = 0 then
target.item [0] := vval
if op2 /= 0 then
target.count := -1
else
target.count := 0
end
else
if usize < 0 then
add_1 (target.item, 0, op1.item, 0, abs_usize, op2, carry)
cy := carry.item
target.item [abs_usize] := cy
wsize := - (abs_usize + cy.to_integer_32)
else
if abs_usize = 1 and op1.item [0] < op2 then
target.item [0] := op2 - op1.item [0]
wsize := -1
else
sub_1 (target.item, 0, op1.item, 0, abs_usize, op2, carry)
junk2 := carry.item
if target.item [abs_usize - 1] = 0 then
wsize := abs_usize - 1
else
wsize := abs_usize
end
end
end
target.count := wsize
end
end
ui_sub (target: READABLE_INTEGER_X; op1: NATURAL_32; op2: READABLE_INTEGER_X)
-- Set `rop' to `op1' - `op2'.
local
vn: INTEGER_32
wn: INTEGER_32
cy: NATURAL_32
junk2: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
vn := op2.count
if vn > 1 then
if vn > target.capacity then
target.resize (vn)
end
sub_1 (target.item, 0, op2.item, 0, vn, op1, carry)
junk2 := carry.item
if target.item [vn - 1] = 0 then
wn := - (vn - 1)
else
wn := - vn
end
elseif vn = 1 then
if op1 >= op2.item [0] then
target.item [0] := op1 - op2.item [0]
if target.item [0] /= 0 then
wn := 1
else
wn := 0
end
else
target.item [0] := op2.item [0] - op1
wn := -1
end
elseif vn = 0 then
target.item [0] := op1
if op1 /= 0 then
wn := 1
else
wn := 0
end
else
vn := -vn
target.resize (vn + 1)
add_1 (target.item, 0, op2.item, 0, vn, op1, carry)
cy := carry.item
target.item [vn] := cy
if cy /= 0 then
wn := vn + 1
else
wn := vn
end
end
target.count := wn
end
addmul (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: READABLE_INTEGER_X)
-- Set `rop' to `rop' + `op1' times `op2'.
do
aorsmul (target, op1, op2, 0)
end
addmul_ui (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: NATURAL)
-- Set `rop' to `rop' + `op1' times `op2'.
do
aorsmul_1 (target, op1, op2, 0)
end
submul (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: READABLE_INTEGER_X)
-- Set `rop' to `rop' - `op1' times `op2'.
do
aorsmul (target, op1, op2, -1)
end
submul_ui (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: NATURAL)
-- Set `rop' to `rop' - `op1' times `op2'.
do
aorsmul_1 (target, op1, op2, -1)
end
mul (target: READABLE_INTEGER_X; op1_a: READABLE_INTEGER_X; op2_a: READABLE_INTEGER_X)
-- Set `rop' to `op1' times `op2'.
local
usize: INTEGER
vsize: INTEGER
wsize: INTEGER
sign_product: INTEGER
vp: SPECIAL [NATURAL_32]
vp_offset: INTEGER
up: SPECIAL [NATURAL_32]
up_offset: INTEGER
wp: SPECIAL [NATURAL_32]
wp_offset: INTEGER
cy_limb: NATURAL_32
op_temp: READABLE_INTEGER_X
size_temp: INTEGER_32
op1: READABLE_INTEGER_X
op2: READABLE_INTEGER_X
carry: CELL [NATURAL_32]
do
create carry.put (0)
op1 := op1_a
op2 := op2_a
usize := op1.count
vsize := op2.count
sign_product := usize.bit_xor (vsize)
usize := usize.abs
vsize := vsize.abs
if usize = 0 or vsize = 0 then
target.count := 0
else
if vsize = 1 then
if usize + 1 > target.capacity then
target.resize (usize + 1)
end
wp := target.item
mul_1 (target.item, 0, op1.item, 0, usize, op2.item [0], carry)
cy_limb := carry.item
target.item [usize] := cy_limb
if cy_limb /= 0 then
usize := usize + 1
end
if sign_product >= 0 then
target.count := usize
else
target.count := -usize
end
else
wsize := usize + vsize
if wsize <= 32 and target /= op1 and target /= op2 then
target.resize (wsize)
wp := target.item
if usize > vsize then
mul_basecase (wp, 0, op1.item, 0, usize, op2.item, 0, vsize)
else
mul_basecase (wp, 0, op2.item, 0, vsize, op1.item, 0, usize)
end
wsize := wsize - (wp [wp_offset + wsize - 1] = 0).to_integer
if sign_product >= 0 then
target.count := wsize
else
target.count := -wsize
end
else
if usize < vsize then
op_temp := op1
op1 := op2
op2 := op_temp
size_temp := usize
usize := vsize
vsize := size_temp
end
up := op1.item
up_offset := 0
vp := op2.item
vp_offset := 0
wp := target.item
wp_offset := 0
if target.capacity < wsize then
create wp.make_filled (0, wsize)
target.item := wp
else
if wp = up then
create up.make_filled (0, usize)
if wp = vp then
vp := up
end
up.copy_data (wp, 0, 0, usize)
elseif wp = vp then
create vp.make_filled (0, vsize)
vp.copy_data (wp, 0, 0, vsize)
end
end
mul_special (wp, 0, up, 0, usize, vp, 0, vsize, carry)
cy_limb := carry.item
wsize := usize + vsize
wsize := wsize - (cy_limb = 0).to_integer
if sign_product < 0 then
target.count := -wsize
else
target.count := wsize
end
end
end
end
end
mul_2exp (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; count_a: INTEGER)
local
usize: INTEGER
abs_usize: INTEGER
wsize: INTEGER
limb_count: INTEGER
wp: SPECIAL [NATURAL_32]
wp_offset: INTEGER
wlimb: NATURAL_32
count: INTEGER
carry: CELL [NATURAL_32]
do
create carry.put (0)
count := count_a
usize := op1.count
abs_usize := usize.abs
if usize = 0 then
target.count := 0
else
limb_count := count // limb_bits
wsize := abs_usize + limb_count + 1
target.resize (wsize)
wp := target.item
wsize := abs_usize + limb_count
count := count \\ limb_bits
if count /= 0 then
lshift (wp, wp_offset + limb_count, op1.item, 0, abs_usize, count, carry)
wlimb := carry.item
if wlimb /= 0 then
wp [wp_offset + wsize] := wlimb
wsize := wsize + 1
end
else
wp.copy_data (op1.item, 0, wp_offset + limb_count, abs_usize)
end
wp.fill_with (0, wp_offset, wp_offset + limb_count - 1)
if usize >= 0 then
target.count := wsize
else
target.count := -wsize
end
end
end
mul_si (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: INTEGER)
local
size: INTEGER
sign_product: INTEGER
sml: NATURAL_32
cy: NATURAL_32
pp: SPECIAL [NATURAL_32]
pp_offset: INTEGER
carry: CELL [NATURAL_32]
do
create carry.put (0)
size := op1.count
sign_product := size
if size = 0 or op2 = 0 then
target.count := 0
else
size := size.abs
sml := op2.abs.to_natural_32
target.resize (size + 1)
pp := target.item
mul_1 (pp, pp_offset, op1.item, 0, size, sml, carry)
cy := carry.item
pp [pp_offset + size] := cy
size := size + (cy /= 0).to_integer
end
if sign_product < 0 xor op2 < 0 then
target.count := -size
else
target.count := size
end
end
mul_ui (target: READABLE_INTEGER_X; op1: READABLE_INTEGER_X; op2: NATURAL_32)
local
size: INTEGER
sign_product: INTEGER
sml: NATURAL_32
cy: NATURAL_32
pp: SPECIAL [NATURAL_32]
pp_offset: INTEGER
carry: CELL [NATURAL_32]
do
create carry.put (0)
size := op1.count
sign_product := size
if size = 0 or op2 = 0 then
target.count := 0
else
size := size.abs
sml := op2
target.resize (size + 1)
pp := target.item
mul_1 (pp, pp_offset, op1.item, 0, size, sml, carry)
cy := carry.item
pp [pp_offset + size] := cy
size := size + (cy /= 0).to_integer
end
if sign_product < 0 xor op2 < 0 then
target.count := -size
else
target.count := size
end
end
neg (target: READABLE_INTEGER_X; op: READABLE_INTEGER_X)
-- Set `rop' to -`op'.
local
usize: INTEGER_32
size: INTEGER_32
do
usize := op.count
if target /= op then
size := usize.abs
target.resize (size)
target.item.copy_data (op.item, 0, 0, size)
end
target.count := -usize
end
abs (target: READABLE_INTEGER_X; op: READABLE_INTEGER_X)
-- Set `rop' to the absolute value of `op'.
local
size: INTEGER_32
do
size := op.count.abs
if op /= target then
target.resize (size)
target.item.copy_data (op.item, 0, 0, size)
end
target.count := size
end
end

View File

@@ -1,155 +0,0 @@
note
description: "Summary description for {INTEGER_X_ASSIGNMENT}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "The object and practice of liberty lies in the limitation of governmental power. - General Douglas MacArthur"
deferred class
INTEGER_X_ASSIGNMENT
inherit
INTEGER_X_FACILITIES
SPECIAL_ASSIGNMENT
rename
set_str as set_str_special
end
MP_BASES
feature
swap (target: READABLE_INTEGER_X; other_a: READABLE_INTEGER_X)
-- Swap the values `rop1' and `rop2' efficiently.
local
other_size: INTEGER_32
other_pointer: SPECIAL [NATURAL_32]
do
other_size := other_a.count
other_pointer := other_a.item
other_a.count := target.count
other_a.item := target.item
target.count := other_size
target.item := other_pointer
end
set_str (target: READABLE_INTEGER_X; str: READABLE_STRING_8; base_a: INTEGER)
-- Set the value of `rop' from `str', a null-terminated C string in base `base'.
-- White space is allowed in the string, and is simply ignored.
-- The base may vary from 2 to 62, or if base is 0, then the leading characters
-- are used: 0x and 0X for hexadecimal, 0b and 0B for binary, 0 for octal, or
-- decimal otherwise.
-- For bases up to 36, case is ignored; upper-case and lower-case letters have
-- the same value.
-- For bases 37 to 62, upper-case letter represent the usual 10..35 while
-- lower-case letter represent 36..61.
-- This function returns 0 if the entire string is a valid number in base base.
-- Otherwise it returns -1.
require
base_a <= 62
base_a >= 2 or base_a = 0
local
base: INTEGER
str_offset: INTEGER
s: SPECIAL [NATURAL_8]
s_offset: INTEGER
begs: INTEGER
i: INTEGER
xsize: INTEGER
c: CHARACTER
negative: BOOLEAN
digit_value: CHARACTER_STRATEGY
str_size: INTEGER
dig: NATURAL_8
do
base := base_a
if base > 36 then
create {CASE_SENSITIVE_STRATEGY}digit_value
else
create {CASE_INSENSITIVE_STRATEGY}digit_value
end
from
str_offset := 1
c := ' '
until
not c.is_space or not str.valid_index (str_offset)
loop
c := str [str_offset]
str_offset := str_offset + 1
end
if c = '-' then
negative := True
c := str [str_offset]
str_offset := str_offset + 1
end
if base = 0 then
if digit_value.text_to_number (c.code.to_natural_8) >= 10 then
(create {INTEGER_X_STRING_EXCEPTION}).raise
end
else
if digit_value.text_to_number (c.code.to_natural_8) >= base then
(create {INTEGER_X_STRING_EXCEPTION}).raise
end
end
if base = 0 then
base := 10
if c = '0' then
base := 8
if str.valid_index (str_offset) then
c := str [str_offset]
end
str_offset := str_offset + 1
if c = 'x' or c = 'X' then
base := 16
c := str [str_offset]
str_offset := str_offset + 1
elseif c = 'b' or c = 'B' then
base := 2
c := str [str_offset]
str_offset := str_offset + 1
end
end
end
from
until
c /= '0' and not c.is_space or not str.valid_index (str_offset)
loop
c := str [str_offset]
str_offset := str_offset + 1
end
if c.code = 0 then
target.count := 0
target.item [0] := 0
else
str_size := str.count - str_offset + 2
create s.make_filled (0, str_size)
from
i := 0
until
i >= str_size
loop
if not c.is_space then
dig := digit_value.text_to_number (c.code.to_natural_8)
if dig.to_integer_32 >= base then
(create {INTEGER_X_STRING_EXCEPTION}).raise
end
s [s_offset] := dig
s_offset := s_offset + 1
end
if str.valid_index (str_offset) then
c := str [str_offset]
end
str_offset := str_offset + 1
i := i + 1
end
str_size := s_offset - begs
xsize := (str_size / chars_per_bit_exactly (base)).truncated_to_integer // 32 + 2
target.resize (xsize)
xsize := set_str_special (target.item, 0, s, begs, str_size, base)
if negative then
target.count := -xsize
else
target.count := xsize
end
end
end
end

View File

@@ -1,200 +0,0 @@
note
description: "Summary description for {INTEGER_X_COMPARISON}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "The marvel of all history is the patience with which men and women submit to burdens unnecessarily laid upon them by their governments. - U.S. Senator William Borah"
deferred class
INTEGER_X_COMPARISON
inherit
INTEGER_X_FACILITIES
SPECIAL_COMPARISON
rename
cmp as cmp_special
end
feature
compare (op1: READABLE_INTEGER_X; op2: READABLE_INTEGER_X): INTEGER
-- Compare `op1' and `op2'.
-- Return a positive value if `op1' > `op2', zero if `op1' = `op2', or a negative value if `op1' < `op2'.
local
usize: INTEGER_32
vsize: INTEGER_32
dsize: INTEGER_32
asize: INTEGER_32
cmp_l: INTEGER_32
do
usize := op1.count
vsize := op2.count
dsize := usize - vsize
if dsize /= 0 then
Result := dsize
else
asize := usize.abs
cmp_l := cmp_special (op1.item, 0, op2.item, 0, asize)
if usize >= 0 then
Result := cmp_l
else
Result := -cmp_l
end
end
end
cmp_si (op1: READABLE_INTEGER_X; op: INTEGER_32): INTEGER
-- Compare `op1' and `op2'.
-- Return a positive value if `op1' > `op2', zero if `op1' = `op2', or a negative value if `op1' < `op2'.
-- Is a macro and will evaluate their arguments more than once.
local
v_digit: INTEGER_32
usize: INTEGER_32
vsize: INTEGER_32
u_digit: NATURAL_32
do
v_digit := op
usize := op1.count
vsize := 0
if v_digit > 0 then
vsize := 1
elseif v_digit < 0 then
vsize := -1
v_digit := -v_digit
end
if usize /= vsize then
Result := usize - vsize
else
if usize = 0 then
Result := 0
else
u_digit := op1.item [0]
if u_digit = v_digit.to_natural_32 then
Result := 0
else
if u_digit > v_digit.to_natural_32 then
Result := usize
else
Result := -usize
end
end
end
end
end
cmp_ui (op1: READABLE_INTEGER_X; op: NATURAL): INTEGER
-- Compare `op1' and `op2'.
-- Return a positive value if `op1' > `op2', zero if `op1' = `op2', or a negative value if `op1' < `op2'.
-- Is a macro and will evaluate their arguments more than once.
local
un: INTEGER_32
ul: NATURAL_32
v_digit: NATURAL_32
do
v_digit := op
un := op1.count
if un = 0 then
if v_digit /= 0 then
Result := -1
else
Result := 0
end
else
if un = 1 then
ul := op1.item [0]
if ul > v_digit then
Result := 1
else
if ul < v_digit then
Result := -1
else
Result := 0
end
end
else
if un > 0 then
Result := 1
else
Result := -1
end
end
end
end
cmpabs (op1: READABLE_INTEGER_X ;op2: READABLE_INTEGER_X): INTEGER
-- Compare the absolute values of `op1' and `op2'.
-- Return a positive value if abs(`op1') > abs(`op2'), zero if abs(`op1') = abs(`op2'),
-- or a negative value if abs(`op1') < abs(`op2').
local
usize: INTEGER_32
vsize: INTEGER_32
dsize: INTEGER_32
cmp_l: INTEGER_32
i: INTEGER_32
x: NATURAL_32
y: NATURAL_32
do
usize := op1.count.abs
vsize := op2.count.abs
dsize := usize - vsize
if dsize /= 0 then
Result := dsize
else
cmp_l := 0
from
i := usize - 1
until
i < 0 or cmp_l /= 0
loop
x := op1.item [i]
y := op2.item [i]
if x /= y then
if x > y then
Result := 1
else
Result := -1
end
end
i := i - 1
variant
i + 2
end
end
end
cmpabs_ui (op1: READABLE_INTEGER_X; op: NATURAL_32): INTEGER
-- Compare the absolute values of `op1' and `op2'.
-- Return a positive value if abs(`op1') > abs(`op2'), zero if abs(`op1') = abs(`op2'),
-- or a negative value if abs(`op1') < abs(`op2').
local
un: INTEGER_32
ul: NATURAL_32
v_digit: NATURAL_32
do
v_digit := op
un := op1.count
if un = 0 then
if v_digit /= 0 then
Result := -1
else
Result := 0
end
else
un := un.abs
if un = 1 then
ul := op1.item [0]
if ul > v_digit then
Result := 1
else
if ul < v_digit then
Result := -1
else
Result := 0
end
end
else
Result := 1
end
end
end
end

View File

@@ -1,429 +0,0 @@
note
description: "Summary description for {INTEGER_X_DIVISION}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Collecting more taxes than is absolutely necessary is legalized robbery. - President Calvin Coolidge"
deferred class
INTEGER_X_DIVISION
inherit
INTEGER_X_FACILITIES
SPECIAL_UTILITY
export
{NONE}
all
end
SPECIAL_DIVISION
rename
add as add_special,
sub as sub_special,
mul as mul_special,
tdiv_qr as tdiv_qr_special
export
{NONE}
all
end
INTEGER_X_ARITHMETIC
INTEGER_X_ASSIGNMENT
rename
add as add_special,
sub as sub_special,
mul as mul_special
export
{NONE}
all
end
feature
fdiv_r_2exp (target: READABLE_INTEGER_X; u: READABLE_INTEGER_X; count: INTEGER)
do
cfdiv_r_2exp (target, u, count, -1)
end
cdiv_r_2exp (target: READABLE_INTEGER_X; u: READABLE_INTEGER_X; count: INTEGER)
do
cfdiv_r_2exp (target, u, count, 1)
end
cfdiv_r_2exp (target: READABLE_INTEGER_X; u: READABLE_INTEGER_X; count_a: INTEGER; direction: INTEGER)
local
usize: INTEGER
abs_usize: INTEGER
limb_count: INTEGER
i: INTEGER
up: SPECIAL [NATURAL_32]
up_offset: INTEGER
wp: SPECIAL [NATURAL_32]
wp_offset: INTEGER
high: NATURAL_32
count: INTEGER
returned: BOOLEAN
negate: BOOLEAN
do
create wp.make_empty (0)
count := count_a
usize := u.count
if usize = 0 then
target.count := 0
else
limb_count := count // 32
count := count \\ 32
abs_usize := usize.abs
up := u.item
if usize.bit_xor (direction) < 0 and Current = u and abs_usize <= limb_count then
returned := True
else
if usize.bit_xor (direction) < 0 then
if Current = u then
wp := target.item
else
i := abs_usize.min (limb_count + 1)
target.resize (i)
wp := target.item
wp.copy_data (up, up_offset, wp_offset, i)
if abs_usize <= limb_count then
target.count := usize
returned := True
end
end
else
if abs_usize <= limb_count then
negate := True
else
from
i := 0
until
i < limb_count or negate
loop
negate := up [up_offset + i] /= 0
i := i + 1
end
if not negate then
if up [up_offset + limb_count].bit_and (((1).to_natural_32 |<< count) - 1) /= 0 then
negate := True
else
target.count := 0
returned := True
end
end
end
if not returned and negate then
target.resize (limb_count + 1)
up := u.item
up_offset := 0
wp := target.item
wp_offset := 0
i := abs_usize.min (limb_count + 1)
com_n (wp, wp_offset, up, up_offset, i)
from
until
i > limb_count
loop
wp [wp_offset + i] := high.max_value
i := i + 1
end
incr_u (wp, wp_offset, 1)
usize := -usize
end
end
end
if not returned then
high := wp [wp_offset + limb_count]
high := high.bit_and (((1).to_natural_32 |<< count) - 1)
wp [wp_offset + limb_count] := high
from
limb_count := limb_count - 1
until
high /= 0 or limb_count < 0
loop
high := wp [wp_offset + limb_count]
end
if limb_count < 0 then
target.count := 0
else
limb_count := limb_count + 1
if usize >= 0 then
target.count := limb_count
else
target.count := -limb_count
end
end
end
end
end
mod (target: READABLE_INTEGER_X; dividend: READABLE_INTEGER_X; divisor_a: READABLE_INTEGER_X)
local
divisor_size: INTEGER
temp_divisor: INTEGER_X
divisor: READABLE_INTEGER_X
do
divisor := divisor_a
divisor_size := divisor.count
if target = divisor then
create temp_divisor.make_limbs (divisor_size.abs)
temp_divisor.set_from_other (divisor)
divisor := temp_divisor
end
tdiv_r (target, dividend, divisor)
if target.count /= 0 then
if dividend.count < 0 then
if divisor.count < 0 then
sub (target, target, divisor)
else
add (target, target, divisor)
end
end
end
end
tdiv_q (target: READABLE_INTEGER_X; numerator: READABLE_INTEGER_X; denominator: READABLE_INTEGER_X)
local
ql: INTEGER
ns: INTEGER
ds: INTEGER
nl: INTEGER
dl: INTEGER
np: SPECIAL [NATURAL_32]
np_offset: INTEGER
dp: SPECIAL [NATURAL_32]
dp_offset: INTEGER
qp: SPECIAL [NATURAL_32]
qp_offset: INTEGER
rp: SPECIAL [NATURAL_32]
rp_offset: INTEGER
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER
do
ns := numerator.count
ds := denominator.count
nl := ns.abs
dl := ds.abs
ql := nl - dl + 1
if dl = 0 then
(create {DIVIDE_BY_ZERO}).raise
end
if ql <= 0 then
target.count := 0
else
target.resize (ql)
qp := target.item
create rp.make_filled (0, dl)
np := numerator.item
dp := denominator.item
if dp = qp then
create tp.make_filled (0, dl)
tp.copy_data (dp, dp_offset, tp_offset, dl)
dp := tp
end
if np = qp then
create tp.make_filled (0, nl)
tp.copy_data (np, np_offset, tp_offset, nl)
np := tp
end
tdiv_qr_special (qp, qp_offset, rp, rp_offset, np, np_offset, nl, dp, dp_offset, dl)
ql := ql - (qp [qp_offset + ql - 1] = 0).to_integer
if ns.bit_xor (ds) >= 0 then
target.count := ql
else
target.count := -ql
end
end
end
tdiv_q_2exp (target: READABLE_INTEGER_X; op: READABLE_INTEGER_X; count_a: INTEGER_32)
local
usize: INTEGER
wsize: INTEGER
limb_count: INTEGER
wp: SPECIAL [NATURAL_32]
wp_offset: INTEGER
up: SPECIAL [NATURAL_32]
up_offset: INTEGER
junk: NATURAL_32
count: INTEGER_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
count := count_a
usize := op.count
limb_count := count // 32
wsize := usize.abs - limb_count
if wsize <= 0 then
target.count := 0
else
target.resize (wsize)
wp := target.item
up := op.item
count := count \\ 32
if count /= 0 then
rshift (wp, wp_offset, up, up_offset + limb_count, wsize, count, carry)
junk := carry.item
wsize := wsize - (wp [wp_offset + wsize - 1] = 0).to_integer
else
wp.copy_data (up, up_offset + limb_count, wp_offset, wsize)
end
if usize >= 0 then
target.count := wsize
else
target.count := -wsize
end
end
end
tdiv_qr (target: READABLE_INTEGER_X; remainder: READABLE_INTEGER_X; numerator: READABLE_INTEGER_X; denominator: READABLE_INTEGER_X)
local
ql: INTEGER_32
ns: INTEGER_32
ds: INTEGER_32
nl: INTEGER_32
dl: INTEGER_32
temp_dp: SPECIAL [NATURAL_32]
temp_np: SPECIAL [NATURAL_32]
do
ns := numerator.count
ds := denominator.count
nl := ns.abs
dl := ds.abs
ql := nl - dl + 1
if dl = 0 then
(create {DIVIDE_BY_ZERO}).raise
end
remainder.resize (dl)
if ql <= 0 then
if numerator /= remainder then
remainder.item.copy_data (numerator.item, 0, 0, nl)
remainder.count := numerator.count
end
target.count := 0
else
target.resize (ql)
if denominator = remainder or denominator = Current then
create temp_dp.make_empty (dl)
temp_dp.copy_data (denominator.item, 0, 0, dl)
else
temp_dp := denominator.item
end
if numerator = remainder or numerator = Current then
create temp_np.make_empty (nl)
temp_np.copy_data (numerator.item, 0, 0, nl)
else
temp_np := numerator.item
end
tdiv_qr_special (target.item, 0, remainder.item, 0, temp_np, 0, nl, temp_dp, 0, dl)
if target.item [ql - 1] = 0 then
ql := ql - 1
end
remainder.count := normalize (remainder.item, 0, remainder.count)
dl := remainder.count
if ns.bit_xor (ds) >= 0 then
target.count := ql
else
target.count := -ql
end
if ns >= 0 then
remainder.count := dl
else
remainder.count := -dl
end
end
end
tdiv_r (remainder: READABLE_INTEGER_X; numerator: READABLE_INTEGER_X; denominator: READABLE_INTEGER_X)
local
ql: INTEGER
ns: INTEGER
ds: INTEGER
nl: INTEGER
dl: INTEGER
np: SPECIAL [NATURAL_32]
np_offset: INTEGER
dp: SPECIAL [NATURAL_32]
dp_offset: INTEGER
qp: SPECIAL [NATURAL_32]
qp_offset: INTEGER
rp: SPECIAL [NATURAL_32]
rp_offset: INTEGER
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER
do
ns := numerator.count
ds := denominator.count
nl := ns.abs
dl := ds.abs
ql := nl - dl + 1
if dl = 0 then
(create {DIVIDE_BY_ZERO}).raise
end
remainder.resize (dl)
if ql <= 0 then
if numerator /= remainder then
np := numerator.item
rp := remainder.item
rp.copy_data (np, 0, 0, nl)
remainder.count := numerator.count
end
else
create qp.make_filled (0, ql)
rp := remainder.item
np := numerator.item
dp := denominator.item
if dp = rp then
create tp.make_filled (0, nl)
tp.copy_data (np, np_offset, tp_offset, nl)
np := tp
np_offset := tp_offset
end
tdiv_qr_special (qp, qp_offset, rp, rp_offset, np, np_offset, nl, dp, dp_offset, dl)
dl := normalize (rp, rp_offset, dl)
if ns >= 0 then
remainder.count := dl
else
remainder.count := -dl
end
end
end
tdiv_r_2exp (target: READABLE_INTEGER_X; op: READABLE_INTEGER_X; count: INTEGER)
local
in_size: INTEGER
res_size: INTEGER
limb_count: INTEGER
in_ptr: SPECIAL [NATURAL_32]
in_ptr_offset: INTEGER
x: NATURAL_32
do
in_size := op.count.abs
limb_count := count // 32
in_ptr := op.item
if in_size > limb_count then
x := in_ptr [in_ptr_offset + limb_count].bit_and (((1).to_natural_32 |<< (count \\ 32)- 1))
if x /= 0 then
res_size := limb_count + 1
target.resize (res_size)
target.item [limb_count] := x
else
res_size := limb_count
res_size := normalize (in_ptr, in_ptr_offset, res_size)
target.resize (res_size)
limb_count := res_size
end
else
res_size := in_size
target.resize (res_size)
limb_count := res_size
end
if target /= op then
target.item.copy_data (op.item, 0, 0, limb_count)
end
if op.count >= 0 then
target.count := res_size
else
target.count := -res_size
end
end
end

View File

@@ -1,11 +0,0 @@
note
description: "Summary description for {INTEGER_X_FACILITIES}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Concentrated power is not rendered harmless by the good intentions of those who create it. - Milton Friedman, Nobel prize-winning economist"
deferred class
INTEGER_X_FACILITIES
end

View File

@@ -1,145 +0,0 @@
note
description: "Summary description for {INTEGER_X_GCD}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "'Need' now means wanting someone else's money. 'Greed' means wanting to keep your own. 'Compassion' is when a politician arranges the transfer. - Joseph Sobran, columnist."
deferred class
INTEGER_X_GCD
inherit
INTEGER_X_FACILITIES
SPECIAL_GCD
rename
gcd as gcd_special
export
{NONE}
all
end
feature
gcd (g: READABLE_INTEGER_X; u: READABLE_INTEGER_X; v: READABLE_INTEGER_X)
local
g_zero_bits: INTEGER
u_zero_bits: INTEGER
v_zero_bits: INTEGER
g_zero_limbs: INTEGER
u_zero_limbs: INTEGER
v_zero_limbs: INTEGER
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER
up: SPECIAL [NATURAL_32]
up_offset: INTEGER
usize: INTEGER
vp: SPECIAL [NATURAL_32]
vp_offset: INTEGER
vsize: INTEGER
gsize: INTEGER
junk: NATURAL_32
cy_limb: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
up := u.item
usize := u.count.abs
vp := v.item
vsize := v.count.abs
if usize = 0 then
g.count := vsize
if g = v then
else
g.resize (vsize)
g.item.copy_data (vp, 0, 0, vsize)
end
elseif vsize = 0 then
g.count := usize
if g = u then
else
g.resize (usize)
g.item.copy_data (up, up_offset, 0, usize)
end
elseif usize = 1 then
g.count := 1
g.item [0] := gcd_1 (vp, vp_offset, vsize, up [up_offset])
elseif vsize = 1 then
g.count := 1
g.item [0] := gcd_1 (up, up_offset, usize, vp [vp_offset])
else
from
until
up [up_offset] /= 0
loop
up_offset := up_offset + 1
end
u_zero_limbs := up_offset - 0
usize := usize - u_zero_limbs
u_zero_bits := trailing_zeros (up [up_offset])
tp := up
tp_offset := up_offset
create up.make_filled (0, usize)
if u_zero_bits /= 0 then
rshift (up, up_offset, tp, tp_offset, usize, u_zero_bits, carry)
junk := carry.item
usize := usize - (up [up_offset + usize - 1] = 0).to_integer
else
up.copy_data (tp, tp_offset, up_offset, usize)
end
from
until
vp [vp_offset] /= 0
loop
vp_offset := vp_offset + 1
end
v_zero_limbs := vp_offset - 0
vsize := vsize - v_zero_limbs
v_zero_bits := trailing_zeros (vp [vp_offset])
tp := vp
tp_offset := vp_offset
create vp.make_filled (0, vsize)
if v_zero_bits /= 0 then
rshift (vp, vp_offset, tp, tp_offset, vsize, v_zero_bits, carry)
junk := carry.item
vsize := vsize - (vp [vp_offset + vsize - 1] = 0).to_integer
else
vp.copy_data (tp, tp_offset, vp_offset, vsize)
end
if u_zero_limbs > v_zero_limbs then
g_zero_limbs := v_zero_limbs
g_zero_bits := v_zero_bits
elseif u_zero_limbs < v_zero_limbs then
g_zero_limbs := u_zero_limbs
g_zero_bits := u_zero_bits
else
g_zero_limbs := u_zero_limbs
g_zero_bits := u_zero_bits.min (v_zero_bits)
end
if usize < vsize or (usize = vsize and up [up_offset + usize - 1] < vp [vp_offset + vsize - 1]) then
vsize := gcd_special (vp, vp_offset, vp, vp_offset, vsize, up, up_offset, usize)
else
vsize := gcd_special (vp, vp_offset, up, up_offset, usize, vp, vp_offset, vsize)
end
gsize := vsize + g_zero_limbs
if g_zero_bits /= 0 then
gsize := gsize + ((vp [vp_offset + vsize - 1] |>> (32 - g_zero_bits)) /= 0).to_integer
g.resize (gsize)
g.item.fill_with (0, 0, g_zero_limbs)
tp := g.item
tp_offset := g_zero_limbs
lshift (tp, tp_offset, vp, vp_offset, vsize, g_zero_bits, carry)
cy_limb := carry.item
if cy_limb /= 0 then
tp [tp_offset + vsize] := cy_limb
end
else
g.resize (gsize)
g.item.fill_with (0, 0, g_zero_limbs)
g.item.copy_data (vp, vp_offset, g_zero_limbs, vsize)
end
g.count := gsize
end
ensure
g.count /= 0
end
end

View File

@@ -1,335 +0,0 @@
note
description: "Summary description for {INTEGER_X_IO}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "I personally call the type of government which can be removed without violence 'democracy,' and the other, 'tyranny.' - Karl Popper"
deferred class
INTEGER_X_IO
inherit
INTEGER_X_FACILITIES
SPECIAL_SIZING
SPECIAL_UTILITY
LIMB_MANIPULATION
feature
output (target: SPECIAL [NATURAL_8]; target_offset: INTEGER; countp: TUPLE [countp: INTEGER]; order: INTEGER; size: INTEGER; endian_a: INTEGER; z: READABLE_INTEGER_X)
local
zsize: INTEGER
zp: SPECIAL [NATURAL_32]
zp_offset: INTEGER
count: INTEGER
numb: INTEGER
endian: INTEGER
i: INTEGER
j: INTEGER
limb: NATURAL_32
wbitsmask: NATURAL_32
wbytes: INTEGER
woffset: INTEGER
dp: SPECIAL [NATURAL_8]
dp_offset: INTEGER
lbits: INTEGER
wbits: INTEGER
zend: INTEGER
newlimb: NATURAL_32
done: BOOLEAN
do
endian := endian_a
zsize := z.count
if zsize = 0 then
countp.countp := 0
else
zsize := zsize.abs
zp := z.item
numb := 8 * size
count := sizeinbase_2exp (zp, zp_offset, zsize, numb)
countp.countp := count
if endian = 0 then
endian := -1
end
if size = 4 then
if order = -1 and endian = -1 then
from
i := target_offset
j := zp_offset
until
j >= zp_offset + count - 1
loop
write_limb (zp [zp_offset + j], target, target_offset + i)
i := i + 4
j := j + 1
end
done := True
elseif order = 1 and endian = -1 then
from
i := target_offset
j := zp_offset + count - 1
until
j < zp_offset
loop
write_limb (zp [zp_offset + j], target, target_offset + i)
j := j - 1
i := i + 4
end
done := True
elseif order = -1 and endian = 1 then
from
i := target_offset
j := zp_offset
until
j >= zp_offset + count - 1
loop
write_limb_be (zp [zp_offset + j], target, target_offset + i)
j := j + 1
i := i + 4
end
done := True
elseif order = 1 and endian = 1 then
from
i := target_offset
j := zp_offset + count - 1
until
j < zp_offset
loop
write_limb_be (zp [zp_offset + j], target, target_offset + i)
j := j - 1
i := i + 4
end
done := True
end
end
if not done then
numb := size * 8
wbytes := numb // 8
wbits := numb \\ 8
wbitsmask := ((1).to_natural_8 |<< wbits) - 1
if endian >= 0 then
woffset := size
else
woffset := -size
end
if order < 0 then
woffset := woffset + size
else
woffset := woffset + -size
end
dp := target
dp_offset := target_offset
if order >= 0 then
dp_offset := dp_offset + (count - 1) * size
else
dp_offset := dp_offset + 0
end
if endian >= 0 then
dp_offset := dp_offset + size - 1
else
dp_offset := dp_offset + 0
end
zend := zp_offset + zsize
lbits := 0
limb := 0
from
i := 0
until
i >= count
loop
from
j := 0
until
j >= wbytes
loop
if lbits >= 8 then
dp [dp_offset] := limb.to_natural_8
limb := limb |>> 8
lbits := lbits - 8
else
if zp_offset = zend then
newlimb := 0
else
newlimb := zp [zp_offset]
zp_offset := zp_offset + 1
end
dp [dp_offset] := (limb.bit_or (newlimb |<< lbits)).to_natural_8
limb := newlimb |>> (8 - lbits)
lbits := lbits + limb_bits - 8
end
dp_offset := dp_offset - endian
j := j + 1
end
if wbits /= 0 then
if lbits >= wbits then
dp [dp_offset] := limb.bit_and (wbitsmask).to_natural_8
limb := limb |>> wbits
lbits := lbits - wbits
else
if zp_offset = zend then
newlimb := 0
else
newlimb := zp [zp_offset]
zp_offset := zp_offset + 1
end
dp [dp_offset] := (limb.bit_or (newlimb |<< lbits)).bit_and (wbitsmask).to_natural_8
limb := newlimb |>> (wbits - lbits)
lbits := lbits + limb_bits - wbits
end
end
from
until
j >= size
loop
dp [dp_offset] := 0
dp_offset := dp_offset - endian
j := j + 1
end
dp_offset := dp_offset + woffset
i := i + 1
end
end
end
end
input (z: READABLE_INTEGER_X; count: INTEGER; order: INTEGER; size: INTEGER; endian_a: INTEGER; source: SPECIAL [NATURAL_8]; source_offset: INTEGER)
local
zsize: INTEGER
zp: SPECIAL [NATURAL_32]
zp_offset: INTEGER
i: INTEGER
j: INTEGER
done: BOOLEAN
limb: NATURAL_32
byte: NATURAL_32
wbitsmask: NATURAL_8
numb: INTEGER
wbytes: INTEGER
woffset: INTEGER
dp: SPECIAL [NATURAL_8]
dp_offset: INTEGER
lbits: INTEGER
wbits: INTEGER
endian: INTEGER
do
endian := endian_a
zsize := (count * (8 * size) + limb_bits - 1) // limb_bits
z.resize (zsize)
zp := z.item
if endian = 0 then
endian := -1
end
if order = -1 and size = 4 and endian = -1 then
from
i := zp_offset
j := source_offset
until
i >= count + zp_offset - 1
loop
zp [zp_offset + i] := read_limb (source, source_offset + j)
j := j + 4
i := i + 1
end
done := True
elseif order = -1 and size = 4 and endian = 1 then
from
i := zp_offset
j := source_offset
until
i >= count + zp_offset - 1
loop
zp [zp_offset + i] := read_limb_be (source, source_offset + j)
j := j + 4
i := i + 1
end
done := True
elseif order = 1 and size = 4 and endian = -1 then
from
i := zp_offset + count - 1
j := source_offset
until
i < zp_offset
loop
zp [zp_offset + i] := read_limb (source, source_offset + j)
j := j + 4
i := i - 1
end
done := True
end
if not done then
numb := size * 8
wbytes := numb // 8
wbits := numb \\ 8
wbitsmask := ((1).to_natural_8 |<< wbits) - 1
woffset := (numb + 7) // 8
if endian >= 0 then
woffset := woffset
else
woffset := -woffset
end
if order < 0 then
woffset := woffset + size
else
woffset := woffset + -size
end
dp := source
dp_offset := source_offset
if order >= 0 then
dp_offset := dp_offset + (count - 1) * size
else
dp_offset := dp_offset + 0
end
if endian >= 0 then
dp_offset := dp_offset + size - 1
else
dp_offset := dp_offset + 0
end
limb := 0
lbits := 0
from
i := 0
until
i >= count
loop
from
j := 0
until
j >= wbytes
loop
byte := dp [dp_offset]
dp_offset := dp_offset - endian
limb := limb.bit_or (byte |<< lbits)
lbits := lbits + 8
if lbits >= limb_bits then
zp [zp_offset] := limb
zp_offset := zp_offset + 1
lbits := lbits - limb_bits
limb := byte |>> (8 - lbits)
end
j := j + 1
end
if wbits /= 0 then
byte := dp [dp_offset].bit_and (wbitsmask)
dp_offset := dp_offset - endian
limb := limb.bit_or (byte |<< lbits)
lbits := lbits + wbits
if lbits >= limb_bits then
zp [zp_offset] := limb
zp_offset := zp_offset + 1
lbits := lbits - limb_bits
limb := byte |>> (wbits - lbits)
end
end
dp_offset := dp_offset + woffset
i := i + 1
end
if lbits /= 0 then
zp [zp_offset] := limb
zp_offset := zp_offset + 1
end
end
zp := z.item
zsize := normalize (zp, 0, zsize)
z.count := zsize
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,967 +0,0 @@
note
description: "Summary description for {INTEGER_X_NUMBER_THEORY}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Gun registration is a gateway drug. - Mark Gilmore"
deferred class
INTEGER_X_NUMBER_THEORY
inherit
INTEGER_X_FACILITIES
SPECIAL_ARITHMETIC
rename
add as add_special,
sub as sub_special,
mul as mul_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special
export
{NONE}
all
end
SPECIAL_DIVISION
rename
add as add_special,
sub as sub_special,
mul as mul_special,
cmp as cmp_special,
tdiv_qr as tdiv_qr_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special
export
{NONE}
all
end
SPECIAL_NUMBER_THEORETIC
rename
add as add_special,
sub as sub_special,
mul as mul_special,
cmp as cmp_special,
tdiv_qr as tdiv_qr_special,
gcdext as gcdext_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special,
invert_gf as invert_gf_special
export
{NONE}
all
end
INTEGER_X_ACCESS
rename
add as add_special,
sub as sub_special,
mul as mul_special,
cmp as cmp_special,
tdiv_qr as tdiv_qr_special,
sizeinbase as sizeinbase_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special
end
INTEGER_X_ARITHMETIC
rename
cmp as cmp_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special
end
INTEGER_X_ASSIGNMENT
rename
add as add_special,
sub as sub_special,
mul as mul_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special
end
INTEGER_X_COMPARISON
INTEGER_X_LOGIC
rename
add as add_special,
sub as sub_special,
mul as mul_special
end
INTEGER_X_DIVISION
rename
cmp as cmp_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special
end
INTEGER_X_RANDOM
rename
add as add_special,
sub as sub_special,
mul as mul_special,
cmp as cmp_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special
end
INTEGER_X_GCD
rename
add as add_special,
sub as sub_special,
mul as mul_special,
cmp as cmp_special,
tdiv_qr as tdiv_qr_special,
bit_xor_lshift as bit_xor_lshift_special,
bit_xor as bit_xor_special
end
INTEGER_X_SIZING
feature
millerrabin_test (n: READABLE_INTEGER_X; nm1: READABLE_INTEGER_X; x: READABLE_INTEGER_X; y: READABLE_INTEGER_X; q: READABLE_INTEGER_X; k: INTEGER): INTEGER
local
i: INTEGER
do
powm (y, x, q, n)
if cmp_ui (y, 1) = 0 or compare (y, nm1) = 0 then
Result := 1
else
from
i := 1
Result := -1
until
Result /= -1 or i >= k
loop
powm_ui (y, y, 2, n)
if compare (y, nm1) = 0 then
Result := 1
elseif cmp_ui (y, 1) = 0 then
Result := 0
end
i := i + 1
end
if Result = -1 then
Result := 0
end
end
end
bin_uiui (target: READABLE_INTEGER_X; n_a: NATURAL_32; k_a: NATURAL_32)
-- Compute the binomial coefficient `n' over `k' and store the result in `rop'.
local
i: NATURAL_32
j: NATURAL_32
cnt: NATURAL_32
n1: CELL [NATURAL_32]
n0: CELL [NATURAL_32]
k0: NATURAL_32
-- t: NATURAL_64
k: NATURAL_32
n: NATURAL_32
rsize: CELL [INTEGER]
ralloc: CELL [INTEGER]
nacc: CELL [NATURAL_32]
kacc: CELL [NATURAL_32]
do
create n0.put (0)
create n1.put (0)
create rsize.put (0)
create ralloc.put (0)
create nacc.put (0)
create kacc.put (0)
n := n_a
k := k_a
if n < k then
target.count := 0
else
k := k.min (n - k)
if k = 0 then
target.count := 1
target.item [0] := 1
else
j := n - k + 1
target.item [0] := j
target.count := 1
ralloc.put (target.capacity)
nacc.put (1)
kacc.put (1)
cnt := 0
from
i := 2
until
i > k
loop
j := j + 1
cnt := nacc.item.bit_or (kacc.item).bit_and (1).bit_xor (1)
nacc.put (nacc.item |>> cnt.to_integer_32)
kacc.put (kacc.item |>> cnt.to_integer_32)
umul_ppmm (n1, n0, nacc.item, j)
k0 := kacc.item * i
if n1.item /= 0 then
muldiv (target, 32, rsize, ralloc, nacc, kacc)
nacc.put (j)
kacc.put (i)
else
nacc.put (n0.item)
kacc.put (k0)
end
i := i + 1
end
muldiv (target, 1, rsize, ralloc, nacc, kacc)
target.count := rsize.item
end
end
end
gcdext (g: READABLE_INTEGER_X; s: detachable READABLE_INTEGER_X; t: detachable READABLE_INTEGER_X; a: READABLE_INTEGER_X; b: READABLE_INTEGER_X)
-- Set `g' to the greatest common divisor of `a' and `b', and in addition set `s' and `t' to
-- coefficients satisfying `a*s + b*t = g'.
-- `g' is always positive, even if one or both of `a' and `b' are negative.
-- If `t' is NULL then that value is not computed.
local
asize: INTEGER
bsize: INTEGER
usize: INTEGER
vsize: INTEGER
ap: SPECIAL [NATURAL_32]
ap_offset: INTEGER
bp: SPECIAL [NATURAL_32]
bp_offset: INTEGER
up: SPECIAL [NATURAL_32]
up_offset: INTEGER
vp: SPECIAL [NATURAL_32]
vp_offset: INTEGER
gsize: INTEGER
ssize: INTEGER
tmp_ssize: TUPLE [tmp_ssize: INTEGER]
gp: SPECIAL [NATURAL_32]
sp: SPECIAL [NATURAL_32]
tmp_gp: SPECIAL [NATURAL_32]
tmp_gp_offset: INTEGER
tmp_sp: SPECIAL [NATURAL_32]
tmp_sp_offset: INTEGER
u: READABLE_INTEGER_X
v: READABLE_INTEGER_X
ss: detachable READABLE_INTEGER_X
tt: detachable READABLE_INTEGER_X
gtmp: INTEGER_X
stmp: INTEGER_X
x: INTEGER_X
do
create tmp_ssize
asize := a.count.abs
bsize := b.count.abs
ap := a.item
bp := b.item
if asize > bsize or (asize = bsize and cmp_special (ap, ap_offset, bp, bp_offset, asize) > 0) then
usize := asize
vsize := bsize
create up.make_filled (0, usize + 1)
create vp.make_filled (0, vsize + 1)
up.copy_data (ap, ap_offset, up_offset, usize)
vp.copy_data (bp, bp_offset, vp_offset, vsize)
u := a
v := b
ss := s
tt := t
else
usize := bsize
vsize := asize
create up.make_filled (0, usize + 1)
create vp.make_filled (0, vsize + 1)
up.copy_data (bp, bp_offset, up_offset, usize)
vp.copy_data (ap, ap_offset, vp_offset, vsize)
u := b
v := a
ss := t
tt := s
end
create tmp_gp.make_filled (0, usize + 1)
create tmp_sp.make_filled (0, usize + 1)
if vsize = 0 then
tmp_sp [tmp_sp_offset] := 1
tmp_ssize.tmp_ssize := 1
tmp_gp.copy_data (up, up_offset, tmp_gp_offset, usize)
gsize := usize
else
gsize := gcdext_special (tmp_gp, tmp_gp_offset, tmp_sp, tmp_sp_offset, tmp_ssize, up, up_offset, usize, vp, vp_offset, vsize)
end
ssize := tmp_ssize.tmp_ssize.abs
create gtmp
gtmp.item := tmp_gp
gtmp.count := gsize
create stmp
stmp.item := tmp_sp
if tmp_ssize.tmp_ssize.bit_xor (u.count) >= 0 then
stmp.count := ssize
else
stmp.count := -ssize
end
if attached {READABLE_INTEGER_X} tt as tt_l then
if v.count = 0 then
tt_l.count := 0
else
create x.make_limbs (ssize + usize + 1)
mul (x, stmp, u)
sub (x, gtmp, x)
tdiv_q (tt_l, x, v)
end
end
if attached {READABLE_INTEGER_X} ss as ss_l then
ss_l.resize (ssize)
sp := ss_l.item
sp.copy_data (tmp_sp, tmp_sp_offset, 0, ssize)
ss_l.count := stmp.count
end
g.resize (gsize)
gp := g.item
gp.copy_data (tmp_gp, tmp_gp_offset, 0, gsize)
g.count := gsize
end
invert (target: READABLE_INTEGER_X; x: READABLE_INTEGER_X; n: READABLE_INTEGER_X): BOOLEAN
local
gcd_l: INTEGER_X
tmp: INTEGER_X
xsize: INTEGER_32
nsize: INTEGER_32
size: INTEGER_32
do
xsize := x.count.abs
nsize := n.count.abs
size := xsize.max (nsize) + 1
if xsize = 0 or (nsize = 1 and n.item [0] = 1) then
Result := False
else
create gcd_l.make_limbs (size)
create tmp.make_limbs (size)
gcdext (gcd_l, tmp, void, x, n)
if gcd_l.count /= 1 or gcd_l.item [0] /= 1 then
Result := False
else
if tmp.count < 0 then
if n.count < 0 then
sub (target, tmp, n)
else
add (target, tmp, n)
end
else
target.copy (tmp)
end
Result := True
end
end
end
millerrabin (source: READABLE_INTEGER_X; reps: INTEGER): INTEGER
local
r: INTEGER
nm1: INTEGER_X
nm3: INTEGER_X
x: INTEGER_X
y: INTEGER_X
q: INTEGER_X
k: INTEGER
is_prime: INTEGER
rstate: MERSENNE_TWISTER_RNG
do
create nm1.make_limbs (source.count + 1)
sub_ui (nm1, source, 1)
create x.make_limbs (source.count + 1)
create y.make_limbs (2 * source.count)
x.set_from_natural_32 (210)
powm (y, x, nm1, source)
if cmp_ui (y, 1) /= 0 then
Result := 0
else
create q.make_limbs (source.count)
k := bit_scan_1 (nm1, 0)
tdiv_q_2exp (q, nm1, k)
create nm3.make_limbs (source.count + 1)
sub_ui (nm3, source, 3)
create rstate.make
is_prime := 1
from
r := 0
until
r >= reps or is_prime = 0
loop
urandomm (x, rstate, nm3)
add_ui (x, x, 2)
is_prime := millerrabin_test (source, nm1, x, y, q, k)
r := r + 1
end
Result := is_prime
end
end
powm (r: READABLE_INTEGER_X; b_a: READABLE_INTEGER_X; e: READABLE_INTEGER_X; m: READABLE_INTEGER_X)
local
xp: SPECIAL [NATURAL_32]
xp_offset: INTEGER
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER
qp: SPECIAL [NATURAL_32]
qp_offset: INTEGER
gp: SPECIAL [NATURAL_32]
gp_offset: INTEGER
this_gp: SPECIAL [NATURAL_32]
this_gp_offset: INTEGER
bp: SPECIAL [NATURAL_32]
bp_offset: INTEGER
ep: SPECIAL [NATURAL_32]
ep_offset: INTEGER
mp: SPECIAL [NATURAL_32]
mp_offset: INTEGER
bn: INTEGER
es: INTEGER
en: INTEGER
mn: INTEGER
xn: INTEGER
invm: NATURAL_32
c: NATURAL_32
enb: INTEGER
i: INTEGER
big_k: INTEGER
j: INTEGER
l: INTEGER
small_k: INTEGER
m_zero_cnt: INTEGER
e_zero_cnt: INTEGER
sh: INTEGER
use_redc: BOOLEAN
new_b: INTEGER_X
b: READABLE_INTEGER_X
new_mp: SPECIAL [NATURAL_32]
new_mp_offset: INTEGER
junk: NATURAL_32
cy: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
b := b_a
mp := m.item
mn := m.count.abs
if mn = 0 then
(create {DIVIDE_BY_ZERO}).raise
end
es := e.count
if es = 0 then
if mn = 1 and mp [mp_offset] = 1 then
r.count := 0
else
r.count := 1
end
r.item [0] := 1
else
if es < 0 then
create new_b.make_limbs (mn + 1)
if not invert (new_b, b, m) then
(create {INVERSE_EXCEPTION}).raise
end
b := new_b
es := -es
end
en := es
use_redc := (mn < 170) and (mp [mp_offset] \\ 2 /= 0)
if use_redc then
invm := modlimb_invert (mp [mp_offset])
invm := 0 - invm
else
m_zero_cnt := leading_zeros (mp [mp_offset + mn - 1])
if m_zero_cnt /= 0 then
create new_mp.make_filled (0, mn)
lshift (new_mp, new_mp_offset, mp, mp_offset, mn, m_zero_cnt, carry)
junk := carry.item
mp := new_mp
mp_offset := new_mp_offset
end
end
e_zero_cnt := leading_zeros (e.item [en - 1])
enb := en * limb_bits - e_zero_cnt
small_k := 1
big_k := 2
from
until
small_k = 10 or 2 * enb <= big_k * (2 + small_k * (3 + small_k))
loop
small_k := small_k + 1
big_k := big_k * 2
end
create tp.make_filled (0, 2 * mn)
create qp.make_filled (0, mn + 1)
create gp.make_filled (0, big_k // 2 * mn)
bn := b.count.abs
bp := b.item
if bn > mn or (bn = mn and cmp_special (bp, bp_offset, mp, mp_offset, mn) >= 0) then
if use_redc then
reduce (tp, tp_offset + mn, bp, bp_offset, bn, mp, mp_offset, mn)
tp.fill_with (0, tp_offset, mn - tp_offset - 1)
tdiv_qr_special (qp, qp_offset, gp, gp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
else
reduce (gp, gp_offset, bp, bp_offset, bn, mp, mp_offset, mn)
end
else
if use_redc then
tp.copy_data (bp, bp_offset, tp_offset + mn, bn)
tdiv_qr_special (qp, qp_offset, gp, gp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
else
gp.copy_data (bp, bp_offset, gp_offset, bn)
gp.fill_with (0, gp_offset + bn, mn - bn - gp_offset - 1)
end
end
create xp.make_filled (0, mn)
sqr_n (tp, tp_offset, gp, gp_offset, mn)
if use_redc then
redc_basecase (xp, xp_offset, mp, mp_offset, mn, invm, tp, tp_offset)
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
end
this_gp := gp
this_gp_offset := gp_offset
from
i := 1
until
i >= big_k // 2
loop
mul_n (tp, tp_offset, this_gp, this_gp_offset, xp, xp_offset, mn)
this_gp_offset := this_gp_offset + mn
if use_redc then
redc_basecase (this_gp, this_gp_offset, mp, mp_offset, mn, invm, tp, tp_offset)
else
tdiv_qr_special (qp, qp_offset, this_gp, this_gp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
end
i := i + 1
end
ep := e.item
i := en - 1
c := ep [ep_offset + i]
sh := limb_bits - e_zero_cnt
sh := sh - small_k
if sh < 0 then
if i > 0 then
i := i - 1
c := c |<< (-sh)
sh := sh + limb_bits
c := c.bit_or (ep [ep_offset + i] |>> sh)
end
else
c := c |>> sh
end
from
j := 0
until
c \\ 2 /= 0
loop
c := c |>> 1
j := j + 1
end
xp.copy_data (gp, gp_offset + mn * (c |>> 1).to_integer_32, xp_offset, mn)
from
j := j - 1
until
j < 0
loop
sqr_n (tp, tp_offset, xp, xp_offset, mn)
if use_redc then
redc_basecase (xp, xp_offset, mp, mp_offset, mn, invm, tp, tp_offset)
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
end
j := j - 1
end
from
until
i <= 0 and sh <= 0
loop
c := ep [ep_offset + i]
l := small_k
sh := sh - l
if sh < 0 then
if i > 0 then
i := i - 1
c := c |<< (-sh)
sh := sh + limb_bits
c := c.bit_or (ep [ep_offset + i] |>> sh)
else
l := l + sh
end
else
c := c |>> sh
end
c := c.bit_and (((1).to_natural_32 |<< l) - 1)
from
until
(c |>> (l - 1)) /= 0 or (i <= 0 and sh <= 0)
loop
sqr_n (tp, tp_offset, xp, xp_offset, mn)
if use_redc then
redc_basecase (xp, xp_offset, mp, mp_offset, mn, invm, tp, tp_offset)
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
end
if sh /= 0 then
sh := sh - 1
c := (c |<< 1) + ((ep [ep_offset + i] |>> sh).bit_and (1))
else
i := i - 1
sh := limb_bits - 1
c := (c |<< 1) + (ep [ep_offset + i] |>> sh)
end
end
if c /= 0 then
from
j := 0
until
c \\ 2 /= 0
loop
c := c |>> 1
j := j + 1
end
l := l - j
from
l := l - 1
until
l < 0
loop
sqr_n (tp, tp_offset, xp, xp_offset, mn)
if use_redc then
redc_basecase (xp, xp_offset, mp, mp_offset, mn, invm, tp, tp_offset)
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
end
l := l - 1
end
mul_n (tp, tp_offset, xp, xp_offset, gp, gp_offset + mn * (c |>> 1).to_integer_32, mn)
if use_redc then
redc_basecase (xp, xp_offset, mp, mp_offset, mn, invm, tp, tp_offset)
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
end
else
j := l
end
from
j := j - 1
until
j < 0
loop
sqr_n (tp, tp_offset, xp, xp_offset, mn)
if use_redc then
redc_basecase (xp, xp_offset, mp, mp_offset, mn, invm, tp, tp_offset)
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, 2 * mn, mp, mp_offset, mn)
end
j := j - 1
end
end
if use_redc then
tp.copy_data (xp, xp_offset, tp_offset, mn)
tp.fill_with (0, tp_offset + mn, tp_offset + mn + mn - 1)
redc_basecase (xp, xp_offset, mp, mp_offset, mn, invm, tp, tp_offset)
if cmp_special (xp, xp_offset, mp, mp_offset, mn) >= 0 then
sub_n (xp, xp_offset, xp, xp_offset, mp, mp_offset, mn, carry)
junk := carry.item
end
else
if m_zero_cnt /= 0 then
lshift (tp, tp_offset, xp, xp_offset, mn, m_zero_cnt, carry)
cy := carry.item
tp [tp_offset + mn] := cy
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, mn + (cy /= 0).to_integer, mp, mp_offset, mn)
rshift (xp, xp_offset, xp, xp_offset, mn, m_zero_cnt, carry)
junk := carry.item
end
end
xn := mn
xn := normalize (xp, xp_offset, xn)
if ep [ep_offset].bit_and (1) /= 0 and b.count < 0 and xn /= 0 then
mp := m.item
sub_special (xp, xp_offset, mp, mp_offset, mn, xp, xp_offset, xn, carry)
junk := carry.item
xn := mn
xn := normalize (xp, xp_offset, xn)
end
r.resize (xn)
r.count := xn
r.item.copy_data (xp, xp_offset, 0, xn)
end
end
powm_ui (target: READABLE_INTEGER_X; b: READABLE_INTEGER_X; el: NATURAL_32; m: READABLE_INTEGER_X)
local
xp: SPECIAL [NATURAL_32]
xp_offset: INTEGER
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER
qp: SPECIAL [NATURAL_32]
qp_offset: INTEGER
mp: SPECIAL [NATURAL_32]
mp_offset: INTEGER
bp: SPECIAL [NATURAL_32]
bp_offset: INTEGER
xn: INTEGER
tn: INTEGER
mn: INTEGER
bn: INTEGER
m_zero_count: INTEGER
c: INTEGER
e: NATURAL_32
new_mp: SPECIAL [NATURAL_32]
junk: NATURAL_32
new_bp: SPECIAL [NATURAL_32]
cy: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
mp := m.item
mn := m.count.abs
if mn = 0 then
(create {DIVIDE_BY_ZERO}).raise
end
if el = 0 then
target.count := (not (mn = 1 and then mp [mp_offset] = 1)).to_integer
target.item [0] := 1
else
m_zero_count := leading_zeros (mp [mp_offset + mn - 1])
if m_zero_count /= 0 then
create new_mp.make_filled (0, mn)
lshift (new_mp, 0, mp, mp_offset, mn, m_zero_count, carry)
junk := carry.item
mp := new_mp
end
bn := b.count.abs
bp := b.item
if bn > mn then
create new_bp.make_filled (0, mn)
reduce (new_bp, 0, bp, bp_offset, bn, mp, mp_offset, mn)
bp := new_bp
bn := mn
bn := normalize (bp, 0, bn)
end
if bn = 0 then
target.count := 0
else
create tp.make_filled (0, 2 * mn + 1)
create xp.make_filled (0, mn)
create qp.make_filled (0, mn + 1)
xp.copy_data (bp, bp_offset, xp_offset, bn)
xn := bn
e := el
c := leading_zeros (e)
e := (e |<< c) |<< 1
c := limb_bits - 1 - c
if c = 0 and then xn = mn and cmp_special (xp, xp_offset, mp, mp_offset, mn) >= 0 then
sub_n (xp, xp_offset, xp, xp_offset, mp, mp_offset, mn, carry)
junk := carry.item
else
from
until
c = 0
loop
sqr_n (tp, tp_offset, xp, xp_offset, xn)
tn := 2 * xn
tn := tn - (tp [tp_offset + tn - 1] = 0).to_integer
if tn < mn then
xp.copy_data (tp, tp_offset, xp_offset, tn)
xn := tn
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, tn, mp, mp_offset, mn)
xn := mn
end
if e.to_integer_32 < 0 then
mul_special (tp, tp_offset, xp, xp_offset, xn, bp, bp_offset, bn, carry)
junk := carry.item
tn := xn + bn
tn := tn - (tp [tp_offset + tn - 1] = 0).to_integer
if tn < mn then
xp.copy_data (tp, tp_offset, xp_offset, tn)
xn := tn
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, tn, mp, mp_offset, mn)
xn := mn
end
end
e := e |<< 1
c := c - 1
end
end
if m_zero_count /= 0 then
lshift (tp, tp_offset, xp, xp_offset, xn, m_zero_count, carry)
cy := carry.item
tp [tp_offset + xn] := cy
xn := xn + (cy /= 0).to_integer
if xn < mn then
xp.copy_data (tp, tp_offset, xp_offset, xn)
else
tdiv_qr_special (qp, qp_offset, xp, xp_offset, tp, tp_offset, xn, mp, mp_offset, mn)
xn := mn
end
rshift (xp, xp_offset, xp, xp_offset, xn, m_zero_count, carry)
junk := carry.item
end
xn := normalize (xp, xp_offset, xn)
if el.bit_test (0) and b.count < 0 and xn /= 0 then
mp := m.item
mp_offset := 0
sub_special (xp, xp_offset, mp, mp_offset, mn, xp, xp_offset, xn, carry)
junk := carry.item
xn := mn
xn := normalize (xp, xp_offset, xn)
end
target.resize (xn)
target.count := xn
target.item.copy_data (xp, xp_offset, 0, xn)
end
end
end
probab_prime_isprime (t: NATURAL_32): BOOLEAN
local
q: NATURAL_32
r: NATURAL_32
d: NATURAL_32
do
if t < 3 or not t.bit_test (0) then
Result := t = 2
else
from
d := 3
r := 1
q := d
until
Result or r = 0
loop
q := t // d
r := t - q * d
Result := (q < d)
d := d + 2
end
end
end
probab_prime_p (op1_a: READABLE_INTEGER_X; reps: INTEGER): INTEGER
local
r: NATURAL_32
n2: INTEGER_X
is_prime: BOOLEAN
op1: READABLE_INTEGER_X
done: BOOLEAN
ln2: NATURAL_32
q: NATURAL_32
p1: CELL [NATURAL_32]
p0: CELL [NATURAL_32]
p: NATURAL_32
primes: SPECIAL [NATURAL_32]
nprimes: INTEGER
do
create p1.put (0)
create p0.put (0)
create primes.make_filled (0, 15)
op1 := op1_a
create n2
if cmp_ui (op1, 1_000_000) <= 0 then
if cmpabs_ui (op1, 1_000_000) <= 0 then
is_prime := probab_prime_isprime (op1.as_natural_32)
if is_prime then
Result := 2
else
Result := 0
end
done := True
else
n2.item := op1.item
n2.count := -op1.count
op1 := n2
end
end
if not done then
if not op1.as_natural_32.bit_test (0) then
done := True
end
end
if not done then
r := preinv_mod_1 (op1.item, 0, op1.count, pp, pp_inverted)
if r \\ 3 = 0 or r \\ 5 = 0 or r \\ 7 = 0 or r \\ 11 = 0 or r \\ 13 = 0 or r \\ 17 = 0 or r \\ 19 = 0 or r \\ 23 = 0 or r \\ 29 = 0 then
Result := 0
done := True
end
end
if not done then
nprimes := 0
p := 1
ln2 := sizeinbase (op1, 2).to_natural_32
from
q := pp_first_omitted.to_natural_32
until
q >= ln2 or done
loop
if probab_prime_isprime (q) then
umul_ppmm (p1, p0, p, q)
if p1.item /= 0 then
r := modexact_1c_odd (op1.item, 0, op1.count, p, 0)
from
nprimes := nprimes - 1
until
nprimes < 0 or done
loop
if r \\ primes [nprimes] = 0 then
Result := 0
done := True
end
nprimes := nprimes - 1
end
p := q
nprimes := 0
else
p := p0.item
end
primes [nprimes] := q
nprimes := nprimes + 1
end
q := q + 2
end
end
if not done then
Result := millerrabin (op1, reps)
end
end
pp: NATURAL_32 = 0xC0CFD797
pp_inverted: NATURAL_32 = 0x53E5645C
pp_first_omitted: INTEGER = 31
reduce (target: SPECIAL [NATURAL_32]; target_offset: INTEGER; ap: SPECIAL [NATURAL_32]; ap_offset: INTEGER; ap_count: INTEGER; mp: SPECIAL [NATURAL_32]; mp_offset: INTEGER; mp_count: INTEGER)
local
tmp: SPECIAL [NATURAL_32]
do
create tmp.make_filled (0, ap_count - mp_count + 1)
tdiv_qr_special (tmp, 0, target, target_offset, ap, ap_offset, ap_count, mp, mp_offset, mp_count)
end
muldiv (target: READABLE_INTEGER_X; inc: INTEGER_32; rsize: CELL [INTEGER_32]; ralloc: CELL [INTEGER_32]; nacc: CELL [NATURAL_32]; kacc: CELL [NATURAL_32])
local
new_ralloc: INTEGER_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
if rsize.item <= ralloc.item then
new_ralloc := ralloc.item + inc
target.resize (new_ralloc)
ralloc.put (new_ralloc)
end
mul_1 (target.item, 0, target.item, 0, rsize.item, nacc.item, carry)
target.item [rsize.item] := carry.item
divexact_1 (target.item, 0, target.item, 0, rsize.item + 1, kacc.item)
if target.item [rsize.item] /= 0 then
rsize.put (rsize.item + 1)
end
end
invert_gf (target: READABLE_INTEGER_X op1: READABLE_INTEGER_X op2: READABLE_INTEGER_X)
require
not op1.is_negative
not op2.is_negative
local
target_special: SPECIAL [NATURAL_32]
op2_count: INTEGER
do
target.resize (op2.count)
op2_count := op2.count
target_special := target.item
invert_gf_special (target_special, 0, op1.item, 0, op1.count, op2.item, 0, op2_count)
target.count := normalize (target_special, 0, op2_count)
end
end

View File

@@ -1,108 +0,0 @@
note
description: "Summary description for {INTEGER_X_RANDOM}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Letting lawyers make laws is like letting doctors make diseases. - Anonymous"
deferred class
INTEGER_X_RANDOM
inherit
INTEGER_X_FACILITIES
LIMB_MANIPULATION
SPECIAL_COMPARISON
SPECIAL_ARITHMETIC
SPECIAL_UTILITY
feature
urandomb (target: READABLE_INTEGER_X; state: RANDOM_NUMBER_GENERATOR; nbits: INTEGER)
-- Generate a uniformly distributed random integer in the range 0 to 2^`n'-1, inclusive.
-- `state' must be initialized by calling one of the randinit functions before invoking this function.
local
size: INTEGER_32
do
size := bits_to_limbs (nbits)
target.resize (size)
state.randget (target.item, 0, nbits)
size := normalize (target.item, 0, size)
target.count := size
ensure
target.bits <= nbits
end
urandomm (target: READABLE_INTEGER_X; state: RANDOM_NUMBER_GENERATOR; n: READABLE_INTEGER_X)
-- Generate a uniform random integer in the range 0 to n-1, inclusive.
-- `state' must be initialized by calling one of the randinit functions before invoking this function.
local
rp: SPECIAL [NATURAL_32]
rp_offset: INTEGER
np: SPECIAL [NATURAL_32]
np_offset: INTEGER
nlast: INTEGER
nbits: INTEGER
size: INTEGER
count: INTEGER
pow2: BOOLEAN
cmp_l: INTEGER
overlap: BOOLEAN
junk: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
size := n.count.abs
if size = 0 then
(create {DIVIDE_BY_ZERO}).raise
end
np := n.item
nlast := size - 1
pow2 := pow2_p (n.item [nlast])
if pow2 then
from
np := n.item
until
not pow2 or np_offset >= nlast
loop
if np [np_offset] /= 0 then
pow2 := False
end
np_offset := np_offset + 1
end
end
count := leading_zeros (np [nlast])
nbits := size * limb_bits - (count) - pow2.to_integer
if nbits = 0 then
target.count := 0
else
np := n.item
np_offset := 0
rp := target.item
rp_offset := 0
if np = rp then
overlap := True
create np.make_filled (0, size)
np.copy_data (n.item, 0, 0, size)
end
target.resize (size)
rp := target.item
rp [rp_offset + size - 1] := 0
count := 80
from
cmp_l := 0
until
cmp_l < 0 or count = 0
loop
state.randget (rp, rp_offset, nbits)
cmp_l := cmp (rp, rp_offset, np, np_offset, size)
count := count - 1
end
if count = 0 then
sub_n (rp, rp_offset, rp, rp_offset, np, np_offset, size, carry)
junk := carry.item
end
size := normalize (rp, rp_offset, size)
target.count := size
end
end
end

View File

@@ -1,49 +0,0 @@
note
description: "Summary description for {INTEGER_X_SIZING}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "My freedom is more important than your great idea. - Anonymous"
deferred class
INTEGER_X_SIZING
inherit
INTEGER_X_FACILITIES
LIMB_BIT_SCANNING
LIMB_MANIPULATION
MP_BASES
feature
sizeinbase (op: READABLE_INTEGER_X; base: INTEGER): INTEGER_32
-- Return the size of `op' measured in number of digits in the given base.
-- `base' can vary from 2 to 62.
-- The sign of `op' is ignored, just the absolute value is used.
-- The result will be either exact or 1 too big.
-- If `base' is a power of 2, the result is always exact.
-- If `op' is zero the return value is always 1.
-- This function can be used to determine the space required when converting `op' to a string.
-- The right amount of allocation is normally two more than the value returned, one extra for
-- a minus sign and one for the null-terminator.
-- It will be noted that `sizeinbase(op,2)' can be used to locate the most significant 1
-- bit in `op', counting from 1. (Unlike the bitwise functions which start from 0.
local
lb_base: NATURAL_32
cnt: INTEGER_32
totbits: INTEGER_32
do
if op.count.abs = 0 then
Result := 1
else
cnt := leading_zeros (op.item [op.count.abs - 1])
totbits := op.count.abs * limb_bits - cnt
if pow2_p (base.to_natural_32) then
lb_base := big_base (base)
Result := (totbits + lb_base.to_integer_32 - 1) // lb_base.to_integer_32
else
Result := ((totbits.to_double * chars_per_bit_exactly (base)) + 1).truncated_to_integer
end
end
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,32 +0,0 @@
note
description: "Summary description for {POWERS}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Giving a politician access to your wallet is like giving a dog access to your refrigerator. - Tim Barber"
class
POWERS
create
make
feature
make (digits_in_base_a: INTEGER; p_a: SPECIAL [NATURAL_32]; p_offset_a: INTEGER; n_a: INTEGER; base_a: INTEGER)
do
digits_in_base := digits_in_base_a
p := p_a
p_offset := p_offset_a
n := n_a
base := base_a
end
feature
digits_in_base: INTEGER
p: SPECIAL [NATURAL_32]
p_offset: INTEGER
n: INTEGER
base: INTEGER
end

View File

@@ -1,44 +0,0 @@
note
description: "Summary description for {RAND_LC_STRUCT}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Everyone wants to save the planet but no one wants to help Mom clean the dishes. - P.J. O'Rourke, in All the Trouble in the World "
class
RAND_LC_STRUCT
inherit
INTEGER_X_DIVISION
LIMB_MANIPULATION
create
make
feature
make (m2exp_a: INTEGER; a_a: READABLE_INTEGER_X; seedn: INTEGER; c: NATURAL_32)
do
create cp.make_filled (0, 1)
m2exp := m2exp_a
create seed.make_limbs (bits_to_limbs (m2exp))
seed.count := seedn
seed.item [0] := 1
create a
fdiv_r_2exp (a, a_a, m2exp)
if a.count = 0 then
a.count := 1
a.item [0] := 0
end
cp [0] := c
cn := (c /= 0).to_integer
end
feature
seed: INTEGER_X
a: INTEGER_X
cn: INTEGER
cp: SPECIAL [NATURAL_32]
m2exp: INTEGER
end

View File

@@ -1,262 +0,0 @@
note
description: "Summary description for {NUMBER_ACCESS}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "State-mandated compassion produces, not love for ones fellow man, but hatred and resentment. - Lizard"
deferred class
SPECIAL_ACCESS
inherit
LIMB_MANIPULATION
MP_BASES
SPECIAL_ARITHMETIC
SPECIAL_DIVISION
feature
dc_get_str (target_a: STRING_8; target_offset_a: INTEGER; len_a: INTEGER; op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER; op1_count: INTEGER; powtab: SPECIAL [POWERS]; powtab_offset: INTEGER; tmp: SPECIAL [NATURAL_32]; tmp_offset: INTEGER): INTEGER
local
target: STRING_8
len: INTEGER
pwp: SPECIAL [NATURAL_32]
pwp_offset: INTEGER
qp: SPECIAL [NATURAL_32]
qp_offset: INTEGER
rp: SPECIAL [NATURAL_32]
rp_offset: INTEGER
pwn: INTEGER
qn: INTEGER
target_offset: INTEGER
do
target := target_a
len := len_a
target_offset := target_offset_a
if op1_count < 15 then
if op1_count /= 0 then
target_offset := sb_get_str (target, target_offset, len, op1, op1_offset, op1_count, powtab, powtab_offset)
else
from
until
len /= 0
loop
target [target_offset] := '%U'
target_offset := target_offset + 1
len := len - 1
end
end
else
pwp := powtab [powtab_offset].p
pwn := powtab [powtab_offset].n
if op1_count < pwn or (op1_count = pwn and cmp (op1, op1_offset, pwp, pwp_offset, op1_count) < 0) then
target_offset := dc_get_str (target, target_offset, len, op1, op1_offset, op1_count, powtab, powtab_offset - 1, tmp, tmp_offset)
else
qp := tmp
qp_offset := tmp_offset
rp := op1
rp_offset := op1_offset
tdiv_qr (qp, qp_offset, rp, rp_offset, op1, op1_offset, op1_count, pwp, pwp_offset, pwn)
qn := op1_count - pwn
qn := qn + (qp [qp_offset + qn] /= 0).to_integer
if len /= 0 then
len := len - powtab [powtab_offset].digits_in_base
end
target_offset := dc_get_str (target, target_offset, len, qp, qp_offset, qn, powtab, powtab_offset - 1, tmp, tmp_offset + op1_count - pwn + 1)
target_offset := dc_get_str (target, target_offset, powtab [powtab_offset].digits_in_base, rp, rp_offset, pwn, powtab, powtab_offset - 1, tmp, tmp_offset)
end
end
Result := target_offset
end
get_str (target: STRING_8; target_offset: INTEGER; base: INTEGER; op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER; op1_count: INTEGER): INTEGER
local
powtab_mem_ptr: SPECIAL [NATURAL_32]
powtab_mem_ptr_offset: INTEGER
big_base_l: NATURAL_32
digits_in_base: INTEGER
powtab: SPECIAL [POWERS]
pi: INTEGER
n: INTEGER
t: INTEGER
p: SPECIAL [NATURAL_32]
p_offset: INTEGER
n1: NATURAL_32
n0: NATURAL_32
bits_per_digit: INTEGER
count: INTEGER
bit_pos: INTEGER
i: INTEGER
s: INTEGER
bits: INTEGER
do
if op1_count = 0 then
target [target_offset] := '%U'
Result := 1
else
if pow2_p (base.to_natural_32) then
bits_per_digit := big_base (base).to_integer_32
s := target_offset
n1 := op1 [op1_offset + op1_count - 1]
count := leading_zeros (n1)
bits := limb_bits * op1_count - count
count := bits \\ bits_per_digit
if count /= 0 then
bits := bits + bits_per_digit - count
end
bit_pos := bits - (op1_count - 1) * limb_bits
from
i := op1_count - 1
until
i < 0
loop
bit_pos := bit_pos - bits_per_digit
from
until
bit_pos < 0
loop
target [s] := ((n1 |>> bit_pos).bit_and (((1).to_natural_32 |<< bits_per_digit) - 1)).to_character_8
s := s + 1
bit_pos := bit_pos - bits_per_digit
end
i := i - 1
if i >= 0 then
n0 := (n1 |<< -bit_pos).bit_and (((1).to_natural_32 |<< bits_per_digit) - 1)
n1 := op1 [op1_offset + i]
bit_pos := bit_pos + limb_bits
target [s] := (n0.bit_or (n1 |>> bit_pos)).to_character_8
s := s + 1
end
end
Result := s - target_offset
else
if op1_count < 30 then
create powtab.make_empty (1)
create p.make_empty (0)
powtab.extend (create {POWERS}.make (0, p, 0, 0, base))
Result := sb_get_str (target, target_offset, 0, op1, op1_offset, op1_count, powtab, 0)
else
create powtab_mem_ptr.make_filled (0, 2 * op1_count + 30)
big_base_l := big_base (base)
digits_in_base := chars_per_limb (base)
create powtab.make_empty (30)
create p.make_filled (0, 0)
powtab.extend (create {POWERS}.make (0, p, 0, 0, base))
create p.make_filled (big_base_l, 1)
powtab.extend (create {POWERS}.make (digits_in_base, p, 0, 1, base))
create p.make_filled (big_base_l, 1)
powtab.extend (create {POWERS}.make (digits_in_base, p, 0, 1, base))
n := 1
pi := 2
create p.make_filled (big_base_l, 1)
p_offset := 0
from
until
2 * n > op1_count
loop
pi := pi + 1
t := powtab_mem_ptr_offset
powtab_mem_ptr_offset := powtab_mem_ptr_offset + 2 * n
sqr_n (powtab_mem_ptr, t, p, p_offset, n)
n := n * 2
n := n - (powtab_mem_ptr [t + n - 1] = 0).to_integer
digits_in_base := digits_in_base * 2
powtab_mem_ptr_offset := t
powtab.extend (create {POWERS}.make (digits_in_base, p, 0, n, base))
end
end
end
end
end
sb_get_str (target: STRING_8; target_offset_a: INTEGER; len_a: INTEGER; op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER; op1_count_a: INTEGER; powtab: SPECIAL [POWERS]; powtab_offset: INTEGER): INTEGER
local
rl: CELL [NATURAL_32]
ul: CELL [NATURAL_32]
s: INTEGER
base: INTEGER
l: INTEGER
buf: SPECIAL [NATURAL_8]
buf_offset: INTEGER
rp: SPECIAL [NATURAL_32]
rp_offset: INTEGER
buff_alloc: INTEGER
op1_count: INTEGER
i: INTEGER
frac: CELL [NATURAL_32]
digit: CELL [NATURAL_32]
junk: NATURAL_32
chars_per_limb_l: INTEGER
big_base_l: NATURAL_32
big_base_inverted_l: NATURAL_32
normalization_steps: INTEGER
target_offset: INTEGER
len: INTEGER
do
create digit.put (0)
create frac.put (0)
create ul.put (0)
create rl.put (0)
len := len_a
target_offset := target_offset_a
op1_count := op1_count_a
buff_alloc := 30 * 8 * 4 * 7 // 11
create buf.make_filled (0, buff_alloc)
create rp.make_filled (0, 30)
base := powtab [powtab_offset].base
chars_per_limb_l := chars_per_limb (base)
big_base_l := big_base (base)
big_base_inverted_l := big_base_inverted (base)
normalization_steps := leading_zeros (big_base_l)
rp.copy_data (op1, op1_offset, rp_offset + 1, op1_count)
s := buf_offset + buff_alloc
from
until
op1_count <= 1
loop
junk := preinv_divrem_1 (rp, rp_offset, 1, rp, rp_offset + 1, op1_count, big_base_l, big_base_inverted_l, normalization_steps)
op1_count := op1_count - (rp [rp_offset + op1_count] = 0).to_integer
frac.put (rp [rp_offset] + 1)
s := s - chars_per_limb_l
i := chars_per_limb_l
from
until
i = 0
loop
umul_ppmm (digit, frac, frac.item, base.to_natural_32)
buf [s] := digit.item.to_natural_8
s := s + 1
i := i - 1
end
s := s - chars_per_limb_l
end
ul.put (rp [rp_offset + 1])
from
until
ul.item = 0
loop
udiv_qrnd_unnorm (ul, rl, ul.item, base.to_natural_32)
s := s - 1
buf [s] := rl.item.to_natural_8
end
l := buf_offset + buff_alloc - s
from
until
l >= len
loop
target [target_offset] := '%U'
target_offset := target_offset + 1
len := len - 1
end
from
until
l = 0
loop
target [target_offset] := buf [s].to_character_8
s := s + 1
target_offset := target_offset + 1
l := l - 1
end
Result := target_offset - target_offset_a
end
end

View File

@@ -1,159 +0,0 @@
note
description: "Summary description for {NUMBER_ASSIGNMENT}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Concentrated political power is the most dangerous thing on earth. - Rudolph Rummel"
deferred class
SPECIAL_ASSIGNMENT
inherit
MP_BASES
LIMB_MANIPULATION
SPECIAL_ARITHMETIC
feature
set_str (target: SPECIAL [NATURAL_32]; target_offset: INTEGER; str: SPECIAL [NATURAL_8]; str_offset_a: INTEGER; str_len: INTEGER; base: INTEGER): INTEGER
require
base >= 2
-- str_len >= 1
local
str_offset: INTEGER
size: INTEGER
big_base_l: NATURAL_32
chars_per_limb_l: INTEGER
res_digit: NATURAL_32
s: INTEGER
next_bitpos: INTEGER
bits_per_indigit: INTEGER
inp_digit: NATURAL_8
i: INTEGER
j: INTEGER
cy_limb: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
str_offset := str_offset_a
big_base_l := big_base (base)
chars_per_limb_l := chars_per_limb (base)
size := 0
if pow2_p (base.to_natural_32) then
bits_per_indigit := big_base_l.to_integer_32
res_digit := 0
next_bitpos := 0
from
s := str_offset + str_len - 1
until
s < str_offset
loop
inp_digit := str [s]
res_digit := res_digit.bit_or (inp_digit.to_natural_32 |<< next_bitpos)
next_bitpos := next_bitpos + bits_per_indigit
if next_bitpos >= limb_bits then
target [target_offset + size] := res_digit
size := size + 1
next_bitpos := next_bitpos - limb_bits
res_digit := inp_digit |>> (bits_per_indigit - next_bitpos)
end
s := s - 1
end
if res_digit /= 0 then
target [target_offset + size] := res_digit
size := size + 1
end
Result := size
else
if str_len < str_len.max_value then
from
i := chars_per_limb_l
until
i >= str_len
loop
res_digit := str [str_offset]
str_offset := str_offset + 1
if base = 10 then
from
j := 9 - 1
until
j = 0
loop
res_digit := res_digit * 10 + str [str_offset].to_natural_32
str_offset := str_offset + 1
j := j - 1
end
else
from
j := chars_per_limb_l - 1
until
j = 0
loop
res_digit := res_digit * base.to_natural_32 + str [str_offset].to_natural_32
str_offset := str_offset + 1
j := j - 1
end
end
if size = 0 then
if res_digit /= 0 then
target [target_offset] := res_digit
size := 1
end
else
mul_1 (target, target_offset, target, target_offset, size, big_base_l, carry)
cy_limb := carry.item
add_1 (target, target_offset, target, target_offset, size, res_digit, carry)
cy_limb := cy_limb + carry.item
if cy_limb /= 0 then
target [target_offset + size] := cy_limb
size := size + 1
end
end
i := i + chars_per_limb_l
end
big_base_l := base.to_natural_32
res_digit := str [str_offset]
str_offset := str_offset + 1
if base = 10 then
from
j := str_len - (i - 9) - 1
until
j <= 0
loop
res_digit := res_digit * 10 + str [str_offset]
str_offset := str_offset + 1
big_base_l := big_base_l * 10
j := j - 1
end
else
from
j := str_len - (i - chars_per_limb_l) - 1
until
j <= 0
loop
res_digit := res_digit * base.to_natural_32 + str [str_offset].to_natural_32
str_offset := str_offset + 1
big_base_l := big_base_l * base.to_natural_32
j := j - 1
end
end
if size = 0 then
if res_digit /= 0 then
target [target_offset] := res_digit
size := 1
end
else
mul_1 (target, target_offset, target, target_offset, size, big_base_l, carry)
cy_limb := carry.item
add_1 (target, target_offset, target, target_offset, size, res_digit, carry)
cy_limb := cy_limb + carry.item
if cy_limb /= 0 then
target [target_offset + size] := cy_limb
size := size + 1
end
end
Result := size
end
end
end
end

View File

@@ -1,39 +0,0 @@
note
description: "Summary description for {NUMBER_COMPARISON}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "No nation was ever ruined by trade. - Benjamin Franklin"
deferred class
SPECIAL_COMPARISON
feature
cmp (op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER; op2: SPECIAL [NATURAL_32]; op2_offset: INTEGER; size: INTEGER): INTEGER
local
i: INTEGER
x: NATURAL_32
y: NATURAL_32
do
Result := 0
from
i := size - 1
until
i < 0 or Result /= 0
loop
x := op1 [op1_offset + i]
y := op2 [op2_offset + i]
if x /= y then
if x > y then
Result := 1
else
Result := -1
end
end
i := i - 1
variant
i + 2
end
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,332 +0,0 @@
note
description: "Summary description for {NUMBER_LOGIC}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "It is a free market that makes monopolies impossible. - Ayn Rand"
deferred class
SPECIAL_LOGIC
inherit
LIMB_MANIPULATION
feature
com_n (target: SPECIAL [NATURAL_32]; target_offset_a: INTEGER; op1: SPECIAL [NATURAL_32]; op1_offset_a: INTEGER; op1_count_a: INTEGER)
require
op1_count_a >= 1
local
target_offset: INTEGER
op1_offset: INTEGER
op1_count: INTEGER
do
target_offset := target_offset_a
op1_offset := op1_offset_a
op1_count := op1_count_a
from
until
op1_count = 0
loop
target [target_offset] := op1 [op1_offset].bit_not
target_offset := target_offset + 1
op1_offset := op1_offset + 1
op1_count := op1_count - 1
end
end
hamdist (op1: SPECIAL [NATURAL_32]; op1_offset_a: INTEGER; op2: SPECIAL [NATURAL_32]; op2_offset_a: INTEGER; n_a: INTEGER): INTEGER
local
p0: NATURAL_32
p1: NATURAL_32
p2: NATURAL_32
p3: NATURAL_32
x: NATURAL_32
p01: NATURAL_32
p23: NATURAL_32
i: INTEGER
op1_offset: INTEGER
n: INTEGER
op2_offset: INTEGER
do
op2_offset := op2_offset_a
n := n_a
op1_offset := op1_offset_a
from
i := n |>> 2
until
i = 0
loop
p0 := op1 [op1_offset].bit_xor (op2 [op2_offset])
p0 := p0 - (p0 |>> 1).bit_and (limb_max // 3)
p0 := (p0 |>> 2).bit_and (limb_max // 5) + p0.bit_and (limb_max // 5)
p1 := op1 [op1_offset + 1].bit_xor (op2 [op2_offset + 1])
p1 := p1 - (p1 |>> 1).bit_and (limb_max // 3)
p1 := (p1 |>> 2).bit_and (limb_max // 5) + p1.bit_and (limb_max // 5)
p01 := p0 + p1
p01 := (p01 |>> 4).bit_and (limb_max // 17) + p01.bit_and (limb_max // 17)
p2 := op1 [op1_offset + 2].bit_xor (op2 [op2_offset + 2])
p2 := p2 - (p2 |>> 1).bit_and (limb_max // 3)
p2 := (p2 |>> 2).bit_and (limb_max // 5) + p2.bit_and (limb_max // 5)
p3 := op1 [op1_offset + 3].bit_xor (op2 [op2_offset + 3])
p3 := p3 - (p3 |>> 1).bit_and (limb_max // 3)
p3 := (p3 |>> 2).bit_and (limb_max // 5) + p3.bit_and (limb_max // 5)
p23 := p2 + p3
p23 := (p23 |>> 4).bit_and (limb_max // 17) + p23.bit_and (limb_max // 17)
x := p01 + p23
x := (x |>> 8) + x
x := (x |>> 16) + x
Result := Result + x.bit_and (0xff).to_integer_32
op1_offset := op1_offset + 4
op2_offset := op2_offset + 4
i := i - 1
end
n := n.bit_and (3)
if n /= 0 then
x := 0
from
until
n = 0
loop
p0 := op1 [op1_offset].bit_xor (op2 [op2_offset])
p0 := p0 - (p0 |>> 1).bit_and (limb_max // 3)
p0 := (p0 |>> 2).bit_and (limb_max // 5) + p0.bit_and (limb_max // 5)
p0 := ((p0 |>> 4) | p0).bit_and (limb_max // 17)
x := x + p0
op1_offset := op1_offset + 1
op2_offset := op2_offset + 1
n := n - 1
end
x := (x |>> 8) + x
x := (x |>> 16) + x
Result := Result + x.bit_and (0xff).to_integer_32
end
end
lshift (target: SPECIAL [NATURAL_32]; target_offset: INTEGER_32; op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER_32; n: INTEGER_32; count: INTEGER_32; carry: CELL [NATURAL_32])
require
target.valid_index (target_offset)
target.valid_index (target_offset + n - 1)
op1.valid_index (op1_offset)
op1.valid_index (op1_offset + n - 1)
count > 0
count < 32
local
high_limb: NATURAL_32
low_limb: NATURAL_32
tnc: INTEGER_32
i: INTEGER_32
up: INTEGER_32
rp: INTEGER_32
do
up := op1_offset + n
rp := target_offset + n
tnc := 32 - count
up := up - 1
low_limb := op1 [up]
carry.put (low_limb |>> tnc)
high_limb := low_limb |<< count
from
i := n - 1
until
i = 0
loop
up := up - 1
low_limb := op1 [up]
rp := rp - 1
target [rp] := high_limb.bit_or (low_limb |>> tnc)
high_limb := low_limb |<< count
i := i - 1
end
rp := rp - 1
target [rp] := high_limb
end
rshift (target: SPECIAL [NATURAL_32]; target_offset: INTEGER_32; op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER_32; n: INTEGER_32; count: INTEGER_32; carry: CELL [NATURAL_32])
local
high_limb: NATURAL_32
low_limb: NATURAL_32
tnc: INTEGER_32
i: INTEGER_32
op1_cursor: INTEGER_32
target_cursor: INTEGER_32
do
tnc := 32 - count
op1_cursor := op1_offset
high_limb := op1 [op1_cursor]
op1_cursor := op1_cursor + 1
carry.put (high_limb |<< tnc)
low_limb := high_limb |>> count
from
i := n - 1
until
i = 0
loop
high_limb := op1 [op1_cursor]
op1_cursor := op1_cursor + 1
target [target_cursor] := low_limb.bit_or (high_limb |<< tnc)
target_cursor := target_cursor + 1
low_limb := high_limb |>> count
i := i - 1
end
target [target_cursor] := low_limb
end
popcount (op1: SPECIAL [NATURAL_32]; op1_offset_a: INTEGER; n_a: INTEGER): INTEGER
local
p0: NATURAL_32
p1: NATURAL_32
p2: NATURAL_32
p3: NATURAL_32
x: NATURAL_32
p01: NATURAL_32
p23: NATURAL_32
i: INTEGER
op1_offset: INTEGER
n: INTEGER
do
n := n_a
op1_offset := op1_offset_a
from
i := n |>> 2
until
i = 0
loop
p0 := op1 [op1_offset]
p0 := p0 - (p0 |>> 1).bit_and (limb_max // 3)
p0 := (p0 |>> 2).bit_and (limb_max // 5) + p0.bit_and (limb_max // 5)
p1 := op1 [op1_offset + 1]
p1 := p1 - (p1 |>> 1).bit_and (limb_max // 3)
p1 := (p1 |>> 2).bit_and (limb_max // 5) + p1.bit_and (limb_max // 5)
p01 := p0 + p1
p01 := (p01 |>> 4).bit_and (limb_max // 17) + p01.bit_and (limb_max // 17)
p2 := op1 [op1_offset + 2]
p2 := p2 - (p2 |>> 1).bit_and (limb_max // 3)
p2 := (p2 |>> 2).bit_and (limb_max // 5) + p2.bit_and (limb_max // 5)
p3 := op1 [op1_offset + 3]
p3 := p3 - (p3 |>> 1).bit_and (limb_max // 3)
p3 := (p3 |>> 2).bit_and (limb_max // 5) + p3.bit_and (limb_max // 5)
p23 := p2 + p3
p23 := (p23 |>> 4).bit_and (limb_max // 17) + p23.bit_and (limb_max // 17)
x := p01 + p23
x := (x |>> 8) + x
x := (x |>> 16) + x
Result := Result + x.bit_and (0xff).to_integer_32
op1_offset := op1_offset + 4
i := i - 1
end
n := n.bit_and (3)
if n /= 0 then
x := 0
from
until
n = 0
loop
p0 := op1 [op1_offset]
p0 := p0 - (p0 |>> 1).bit_and (limb_max // 3)
p0 := (p0 |>> 2).bit_and (limb_max // 5) + p0.bit_and (limb_max // 5)
p0 := ((p0 |>> 4) | p0).bit_and (limb_max // 17)
x := x + p0
op1_offset := op1_offset + 1
n := n - 1
end
x := (x |>> 8) + x
x := (x |>> 16) + x
Result := Result + x.bit_and (0xff).to_integer_32
end
end
bit_xor_lshift (target: SPECIAL [NATURAL_32] target_offset: INTEGER op1: SPECIAL [NATURAL_32] op1_offset: INTEGER op1_count: INTEGER op2: SPECIAL [NATURAL_32] op2_offset: INTEGER op2_count: INTEGER op2_lshift: INTEGER)
require
op2_lshift >= 0
op1 /= op2
target /= op2
op1_count = 0 or op1.valid_index (op1_offset)
op1_count = 0 or op1.valid_index (op1_offset + op1_count - 1)
op2_count = 0 or op2.valid_index (op2_offset)
op2_count = 0 or op2.valid_index (op2_offset + op2_count - 1)
(op1_count = 0 and op2_count = 0) or target.valid_index (target_offset)
(op1_count = 0 and op2_count = 0) or target.valid_index (target_offset + op1_count.max (op2_count + bits_to_limbs (op2_lshift)) - 1)
local
op2_limb_high: NATURAL_32
op2_limb_low: NATURAL_32
op2_limb: NATURAL_32
cursor: INTEGER
shift_limbs: INTEGER
shift_bits: INTEGER
do
shift_limbs := op2_lshift // limb_bits
shift_bits := op2_lshift \\ limb_bits
target.copy_data (op1, op1_offset, target_offset, shift_limbs)
from
until
cursor >= op2_count or cursor >= op1_count - shift_limbs
loop
op2_limb_low := op2_limb_high
op2_limb_high := op2 [op2_offset + cursor]
op2_limb := extract_limb (shift_bits, op2_limb_high, op2_limb_low)
target [target_offset + shift_limbs + cursor] := op2_limb.bit_xor (op1 [op1_offset + shift_limbs + cursor])
cursor := cursor + 1
end
if cursor >= op2_count then
op2_limb_low := op2_limb_high
op2_limb := extract_limb (shift_bits, 0, op2_limb_low)
if cursor >= op1_count - shift_limbs then
target [target_offset + shift_limbs + cursor] := op2_limb
else
target [target_offset + shift_limbs + cursor] := op2_limb.bit_xor (op1 [op1_offset + shift_limbs + cursor])
cursor := cursor + 1
target.copy_data (op1, op1_offset + shift_limbs + cursor, target_offset + shift_limbs + cursor, op1_count - cursor - shift_limbs)
end
else
from
until
cursor >= op2_count
loop
op2_limb_low := op2_limb_high
op2_limb_high := op2 [op2_offset + cursor]
op2_limb := extract_limb (shift_bits, op2_limb_high, op2_limb_low)
target [target_offset + shift_limbs + cursor] := op2_limb
cursor := cursor + 1
end
op2_limb_low := op2_limb_high
op2_limb := extract_limb (shift_bits, 0, op2_limb_low)
target [target_offset + shift_limbs + cursor] := op2_limb
end
end
bit_xor (target: SPECIAL [NATURAL_32]; target_offset: INTEGER; op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER; op1_count: INTEGER; op2: SPECIAL [NATURAL_32]; op2_offset: INTEGER; op2_count: INTEGER)
require
(op1_count = 0 and op2_count = 0) or target.valid_index (target_offset)
(op1_count = 0 and op2_count = 0) or target.valid_index (target_offset + op1_count.max (op2_count) - 1)
local
cursor: INTEGER
min: INTEGER
do
from
min := op1_count.min (op2_count)
until
cursor >= min
loop
target [target_offset + cursor] := op1 [op1_offset + cursor].bit_xor (op2 [op2_offset + cursor])
cursor := cursor + 1
end
if op1_count > op2_count then
target.copy_data (op1, op1_offset + cursor, target_offset + cursor, op1_count - cursor)
elseif op2_count > op1_count then
target.copy_data (op2, op2_offset + cursor, target_offset + cursor, op2_count - cursor)
end
end
end

View File

@@ -1,849 +0,0 @@
note
description: "Summary description for {NUMBER_NUMBER_THEORETIC}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "The best argument against democracy is a five-minute conversation with the average voter. - Winston Churchill"
deferred class
SPECIAL_NUMBER_THEORETIC
inherit
SPECIAL_DIVISION
SPECIAL_UTILITY
SPECIAL_LOGIC
LIMB_MANIPULATION
feature
gcdext_div2 (n1_a: NATURAL_32; n0_a: NATURAL_32; d1_a: NATURAL_32; d0_a: NATURAL_32): NATURAL_32
require
d1_a /= 0 or d0_a /= 0
local
q: NATURAL_32
count: INTEGER
d1: NATURAL_32
d0: NATURAL_32
n1: CELL [NATURAL_32]
n0: CELL [NATURAL_32]
do
create n1.put (n1_a)
create n0.put (n0_a)
d1 := d1_a
d0 := d0_a
if n1.item.bit_test (limb_high_bit) then
from
count := 1
invariant
d1 /= 0 or d0 /= 0
until
d1.bit_test (limb_high_bit)
loop
d1 := (d1 |<< 1).bit_or (d0 |>> (limb_bits - 1))
d0 := d0 |<< 1
count := count + 1
end
q := 0
from
until
count = 0
loop
q := q |<< 1
if n1.item > d1 or (n1.item = d1 and n0.item >= d0) then
sub_ddmmss (n1, n0, n1.item, n0.item, d1, d0)
q := q.bit_or (1)
end
d0 := (d1 |<< (limb_bits - 1)).bit_or (d0 |>> 1)
d1 := d1 |>> 1
count := count - 1
end
Result := q
else
from
count := 0
until
n1.item <= d1 and (n1.item /= d1 or n0.item < d0)
loop
d1 := (d1 |<< 1).bit_or (d0 |>> (limb_bits - 1))
d0 := d0 |<< 1
count := count + 1
end
q := 0
from
until
count = 0
loop
d0 := (d1 |<< (limb_bits - 1)).bit_or (d0 |>> 1)
d1 := d1 |>> 1
q := q |<< 1
if n1.item > d1 or (n1.item = d1 and n0.item >= d0) then
sub_ddmmss (n1, n0, n1.item, n0.item, d1, d0)
q := q.bit_or (1)
end
count := count - 1
end
Result := q
end
end
basic_gcdext (target: SPECIAL [NATURAL_32]; target_offset: INTEGER_32; cofactor: SPECIAL [NATURAL_32]; cofactor_offset: INTEGER_32; cofactor_count: TUPLE [cofactor_count: INTEGER_32]; op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER_32; op1_count: INTEGER_32; op2: SPECIAL [NATURAL_32]; op2_offset: INTEGER_32; op2_count: INTEGER_32): INTEGER
require
op1_count >= op2_count
target.valid_index (target_offset)
target.valid_index (target_offset + op1_count - 1)
cofactor.valid_index (cofactor_offset)
cofactor.valid_index (cofactor_offset + op1_count - 1)
op1.valid_index (op1_offset)
op1.valid_index (op1_offset + op1_count - 0)
op1 [op1_offset + op1_count - 1] /= 0
op2.valid_index (op2_offset)
op2.valid_index (op2_offset + op2_count - 0)
op2 [op2_offset + op2_count - 1] /= 0
op2_count >= 1
local
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER_32
s1p: SPECIAL [NATURAL_32]
s1p_offset: INTEGER
do
create tp.make_filled (0, op1_count + 1)
tp_offset := 0
create s1p.make_filled (0, op1_count + 1)
s1p_offset := 0
cofactor.fill_with (0, cofactor_offset, cofactor_offset + op1_count - 1)
s1p.fill_with (0, s1p_offset, s1p_offset + op1_count - 1)
cofactor [cofactor_offset] := 1
s1p [s1p_offset] := 0
if op1_count > op2_count then
tdiv_qr (tp, tp_offset, op1, op1_offset, op1, op1_offset, op1_count, op2, op2_offset, op2_count)
cofactor [cofactor_offset] := 0
s1p [s1p_offset] := 1
Result := basic_gcdext_arranged (target, target_offset, cofactor, cofactor_offset, cofactor_count, op2, op2_offset, op2_count, op1, op1_offset, op1_count, -1, s1p, s1p_offset, tp, tp_offset)
else
Result := basic_gcdext_arranged (target, target_offset, cofactor, cofactor_offset, cofactor_count, op1, op1_offset, op1_count, op2, op2_offset, op2_count, 1, s1p, s1p_offset, tp, tp_offset)
end
end
basic_gcdext_arranged (target: SPECIAL [NATURAL_32]; target_offset: INTEGER_32; cofactor_a: SPECIAL [NATURAL_32]; cofactor_offset_a: INTEGER_32; cofactor_count: TUPLE [cofactor_count: INTEGER_32]; op1_a: SPECIAL [NATURAL_32]; op1_offset_a: INTEGER_32; op1_count_a: INTEGER_32; op2_a: SPECIAL [NATURAL_32]; op2_offset_a: INTEGER_32; op2_count_a: INTEGER_32; sign_a: INTEGER; s1p_a: SPECIAL [NATURAL_32]; s1p_offset_a: INTEGER; tp_a: SPECIAL [NATURAL_32]; tp_offset_a: INTEGER): INTEGER
local
a: NATURAL_32
b: NATURAL_32
c: NATURAL_32
d: NATURAL_32
wp: SPECIAL [NATURAL_32]
wp_offset: INTEGER_32
orig_s0p: SPECIAL [NATURAL_32]
orig_s0p_offset: INTEGER
use_double_flag: BOOLEAN
cnt: INTEGER_32
assign_l: NATURAL_32
op2_count: INTEGER
done: BOOLEAN
done_2: BOOLEAN
uh: NATURAL_32
vh: NATURAL_32
ul: NATURAL_32
vl: NATURAL_32
tac: NATURAL_32
tbd: NATURAL_32
q1: NATURAL_32
q2: NATURAL_32
nh: CELL [NATURAL_32]
nl: CELL [NATURAL_32]
dh: CELL [NATURAL_32]
dl: CELL [NATURAL_32]
t1: CELL [NATURAL_32]
t0: CELL [NATURAL_32]
thigh: CELL [NATURAL_32]
tlow: CELL [NATURAL_32]
sign: INTEGER
q: NATURAL_32
t: NATURAL_32
ssize: INTEGER_32
qsize: INTEGER_32
i: INTEGER_32
cy: NATURAL_32
cofactor: SPECIAL [NATURAL_32]
cofactor_offset: INTEGER_32
op1: SPECIAL [NATURAL_32]
op1_offset: INTEGER_32
op2: SPECIAL [NATURAL_32]
op2_offset: INTEGER_32
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER_32
s1p: SPECIAL [NATURAL_32]
s1p_offset: INTEGER_32
temp_special: SPECIAL [NATURAL_32]
temp_integer: INTEGER_32
op1_count: INTEGER
tsize: INTEGER
wsize: INTEGER
junk: NATURAL_32
cy1: NATURAL_32
cy2: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
cofactor := cofactor_a
cofactor_offset := cofactor_offset_a
op1 := op1_a
op1_offset := op1_offset_a
op1_count := op1_count_a
op2 := op2_a
op2_offset := op2_offset_a
tp := tp_a
tp_offset := tp_offset_a
s1p := s1p_a
s1p_offset := s1p_offset_a
ssize := 1
sign := sign_a
op2_count := op2_count_a
orig_s0p := cofactor
orig_s0p_offset := cofactor_offset
create wp.make_filled (0, op1_count + 1)
wp_offset := 0
use_double_flag := op1_count > 17
from
until
done
loop
op2_count := op1_count
op2_count := normalize (op2, op2_offset, op2_count)
if op2_count <= 1 then
done := True
else
if use_double_flag then
uh := op1 [op1_count - 1]
vh := op2 [op1_count - 1]
ul := op1 [op1_count - 2]
vl := op2 [op1_count - 2]
cnt := leading_zeros (uh)
if cnt /= 0 then
uh := (uh |<< cnt).bit_or (ul |>> (32 - cnt))
vh := (vh |<< cnt).bit_or (vl |>> (32 - cnt))
vl := vl |<< cnt
ul := ul |<< cnt
if op1_count >= 3 then
ul := ul.bit_or (op1 [op1_offset + op1_count - 3] |>> (32 - cnt))
vl := vl.bit_or (op2 [op2_offset + op1_count - 3] |>> (32 - cnt))
end
end
a := 1
b := 0
c := 0
d := 1
assign_l := 0
from
done_2 := False
create nh.put (0)
create nl.put (0)
create dh.put (0)
create dl.put (0)
create thigh.put (0)
create tlow.put (0)
create t1.put (0)
create t0.put (0)
until
done_2
loop
sub_ddmmss (dh, dl, vh, vl, 0, c)
if dh.item = 0 then
done_2 := True
else
add_ssaaaa (nh, nl, uh, ul, 0, a)
q1 := gcdext_div2 (nh.item, nl.item, dh.item, dl.item)
add_ssaaaa (dh, dl, vh, vl, 0, d)
if dh.item = 0 then
done_2 := True
else
sub_ddmmss (nh, nl, uh, ul, 0, b)
q2 := gcdext_div2 (nh.item, nl.item, dh.item, dl.item)
if q1 /= q2 then
done_2 := True
else
tac := a + q1 * c
tbd := b + q1 * d
a := c
c := tac
b := d
d := tbd
umul_ppmm (t1, t0, q1, vl)
t1.put (t1.item + q1 * vh)
sub_ddmmss (thigh, tlow, uh, ul, t1.item, t0.item)
uh := vh
ul := vl
vh := thigh.item
vl := tlow.item
assign_l := assign_l.bit_not
add_ssaaaa (dh, dl, vh, vl, 0, c)
sub_ddmmss (nh, nl, uh, ul, 0, a)
q1 := gcdext_div2 (nh.item, nl.item, dh.item, dl.item)
sub_ddmmss (dh, dl, vh, vl, 0, d)
if dh.item = 0 then
done_2 := True
else
add_ssaaaa (nh, nl, uh, ul, 0, b)
q2 := gcdext_div2 (nh.item, nl.item, dh.item, dl.item)
if q1 /= q2 then
done_2 := True
else
tac := a + q1 * c
tbd := b + q1 * d
a := c
c := tac
b := d
d := tbd
umul_ppmm (t1, t0, q1, vl)
t1.put (t1.item + (q1 * vh))
sub_ddmmss (thigh, tlow, uh, ul, t1.item, t0.item)
uh := vh
ul := vl
vh := thigh.item
vl := tlow.item
assign_l := assign_l.bit_not
end
end
end
end
end
end
if assign_l /= 0 then
sign := -sign
end
else
uh := op1 [op1_offset + op1_count - 1]
vh := op2 [op2_offset + op1_count - 1]
cnt := leading_zeros (uh)
if cnt /= 0 then
uh := (uh |<< cnt).bit_or (op1 [op1_offset + op1_count - 2] |>> (limb_bits - cnt))
vh := (vh |<< cnt).bit_or (op2 [op2_offset + op1_count - 2] |>> (limb_bits - cnt))
end
a := 1
b := 0
c := 0
d := 1
assign_l := 0
from
done_2 := False
until
done_2
loop
if vh - c = 0 or vh + d = 0 then
done_2 := True
else
q := (uh + a) // (vh - c)
if q /= (uh - b) // (vh + d) then
done_2 := True
else
t := a + q * c
a := c
c := t
t := b + q * d
b := d
d := t
t := uh - q * vh
uh := vh
vh := t
assign_l := assign_l.bit_not
if vh - d = 0 then
done_2 := True
else
q := (uh - a) // (vh + c)
if q /= (uh + b) // (vh - d) then
done_2 := True
else
t := a + q * c
a := c
c := t
t := b + q * d
b := d
d := t
t := uh - q * vh
uh := vh
vh := t
assign_l := assign_l.bit_not
end
end
end
end
end
if assign_l /= 0 then
sign := -sign
end
end
if b = 0 then
tdiv_qr (wp, wp_offset, op1, op1_offset, op1, op1_offset, op1_count, op2, op2_offset, op2_count)
tp.copy_data (cofactor, cofactor_offset, tp_offset, ssize)
qsize := op1_count - op2_count + 1
s1p.fill_with (0, s1p_offset + ssize, s1p_offset + ssize + qsize - 1)
from
i := 0
until
i >= qsize
loop
addmul_1 (tp, tp_offset + i, s1p, s1p_offset, ssize, wp [wp_offset + i], carry)
cy := carry.item
tp [tp_offset + ssize + i] := cy
i := i + 1
end
ssize := ssize + qsize
ssize := ssize - (tp [tp_offset + ssize - 1] = 0).to_integer
sign := -sign
temp_special := cofactor
temp_integer := cofactor_offset
cofactor := s1p
cofactor_offset := s1p_offset
s1p := temp_special
s1p_offset := temp_integer
temp_special := s1p
temp_integer := s1p_offset
s1p := tp
s1p_offset := tp_offset
tp := temp_special
tp_offset := temp_integer
op1_count := op2_count
temp_special := op1
temp_integer := op1_offset
op1 := op2
op1_offset := op2_offset
op2 := temp_special
op2_offset := temp_integer
else
if a = 0 then
tp.copy_data (op2, op2_offset, tp_offset, op1_count)
wp.copy_data (op1, op1_offset, wp_offset, op1_count)
submul_1 (wp, wp_offset, op2, op2_offset, op1_count, d, carry)
junk := carry.item
temp_special := tp
temp_integer := tp_offset
tp := op1
tp_offset := op1_offset
op1 := temp_special
op1_offset := temp_integer
temp_special := wp
temp_integer := wp_offset
wp := op2
wp_offset := op2_offset
op2 := temp_special
op2_offset := temp_integer
tp.copy_data (s1p, s1p_offset, tp_offset, ssize)
tsize := ssize
tp [tp_offset + ssize] := 0
wp.copy_data (cofactor, cofactor_offset, wp_offset, ssize)
addmul_1 (wp, wp_offset, s1p, s1p_offset, ssize, d, carry)
cy := carry.item
wp [wp_offset + ssize] := cy
wsize := ssize + (cy /= 0).to_integer
temp_special := tp
temp_integer := tp_offset
tp := cofactor
tp_offset := cofactor_offset
cofactor := temp_special
cofactor_offset := temp_integer
temp_special := wp
temp_integer := wp_offset
wp := s1p
wp_offset := s1p_offset
s1p := temp_special
s1p_offset := temp_integer
ssize := wsize.max (tsize)
else
if assign_l /= 0 then
mul_1 (tp, tp_offset, op2, op2_offset, op1_count, b, carry)
junk := carry.item
submul_1 (tp, tp_offset, op1, op1_offset, op1_count, a, carry)
junk := carry.item
mul_1 (wp, wp_offset, op1, op1_offset, op1_count, c, carry)
junk := carry.item
submul_1 (wp, wp_offset, op2, op2_offset, op1_count, d, carry)
junk := carry.item
else
mul_1 (tp, tp_offset, op1, op1_offset, op1_count, a, carry)
junk := carry.item
submul_1 (tp, tp_offset, op2, op2_offset, op1_count, b, carry)
junk := carry.item
mul_1 (wp, wp_offset, op2, op2_offset, op1_count, d, carry)
junk := carry.item
submul_1 (wp, wp_offset, op1, op1_offset, op1_count, c, carry)
junk := carry.item
end
temp_special := tp
temp_integer := tp_offset
tp := op1
tp_offset := op1_offset
op1 := temp_special
op1_offset := temp_integer
temp_special := wp
temp_integer := wp_offset
wp := op2
wp_offset := op2_offset
op2 := temp_special
op2_offset := temp_integer
mul_1 (tp, tp_offset, cofactor, cofactor_offset, ssize, a, carry)
cy1 := carry.item
addmul_1 (tp, tp_offset, s1p, s1p_offset, ssize, b, carry)
cy2 := carry.item
cy := cy1 + cy2
tp [tp_offset + ssize] := cy
tsize := ssize + (cy /= 0).to_integer
if cy < cy1 then
tp [tp_offset + tsize] := 1
wp [wp_offset + tsize] := 0
tsize := tsize + 1
end
mul_1 (wp, wp_offset, s1p, s1p_offset, ssize, d, carry)
cy1 := carry.item
addmul_1 (wp, wp_offset, cofactor, cofactor_offset, ssize, c, carry)
cy2 := carry.item
cy := cy1 + cy2
wp [wp_offset + ssize] := cy
wsize := ssize + (cy /= 0).to_integer
if cy < cy1 then
wp [wp_offset + wsize] := 1
if wsize >= tsize then
tp [tp_offset + wsize] := 0
end
wsize := wsize + 1
end
temp_special := tp
temp_integer := tp_offset
tp := cofactor
tp_offset := cofactor_offset
cofactor := temp_special
cofactor_offset := temp_integer
temp_special := wp
temp_integer := wp_offset
wp := s1p
wp_offset := s1p_offset
s1p := temp_special
s1p_offset := temp_integer
ssize := wsize.max (tsize)
end
op1_count := op1_count - (op1 [op1_offset + op1_count - 1] = 0).to_integer
end
end
end
if op2_count = 0 then
if target /= op1 then
target.copy_data (op1, op1_offset, target_offset, op1_count)
end
ssize := normalize (cofactor, cofactor_offset, ssize)
if orig_s0p /= cofactor then
orig_s0p.copy_data (cofactor, cofactor_offset, orig_s0p_offset, ssize)
end
if sign >= 0 then
cofactor_count.cofactor_count := ssize
else
cofactor_count.cofactor_count := -ssize
end
Result := op1_count
else
vl := op2 [op2_offset]
t := divrem_1 (wp, wp_offset, op1, op1_offset, op1_count, vl)
tp.copy_data (cofactor, cofactor_offset, tp_offset, ssize)
qsize := op1_count - (wp [wp_offset + op1_count - 1] = 0).to_integer
if ssize < qsize then
tp.fill_with (0, tp_offset + ssize, qsize - ssize)
s1p.fill_with (0, s1p_offset + ssize, qsize)
from
i := 0
until
i >= ssize
loop
addmul_1 (tp, tp_offset + i, wp, wp_offset, qsize, s1p [s1p_offset + i], carry)
cy := carry.item
tp [tp_offset + qsize + i] := cy
i := i + 1
end
else
s1p.fill_with (0, s1p_offset + ssize, s1p_offset + ssize + qsize - 1)
from
i := 0
until
i >= qsize
loop
addmul_1 (tp, tp_offset + i, s1p, s1p_offset, ssize, wp [wp_offset + i], carry)
cy := carry.item
tp [tp_offset + ssize + i] := cy
i := i + 1
end
end
ssize := ssize + qsize
ssize := ssize - (tp [tp_offset + ssize - 1] = 0).to_integer
sign := -sign
temp_special := cofactor
temp_integer := cofactor_offset
cofactor := s1p
cofactor_offset := s1p_offset
s1p := temp_special
s1p_offset := temp_integer
temp_special := s1p
temp_integer := s1p_offset
s1p := tp
s1p_offset := tp_offset
tp := temp_special
tp_offset := temp_integer
ul := vl
vl := t
from
until
vl = 0
loop
q := ul // vl
t := ul - q * vl
tp.copy_data (cofactor, cofactor_offset, tp_offset, ssize)
s1p.fill_with (0, s1p_offset + ssize, s1p_offset + ssize)
addmul_1 (tp, tp_offset, s1p, s1p_offset, ssize, q, carry)
cy := carry.item
tp [tp_offset + ssize] := cy
ssize := ssize + 1
ssize := ssize - (tp [tp_offset + ssize - 1] = 0).to_integer
sign := -sign
temp_special := cofactor
temp_integer := cofactor_offset
cofactor := s1p
cofactor_offset := s1p_offset
s1p := temp_special
s1p_offset := temp_integer
temp_special := s1p
temp_integer := s1p_offset
s1p := tp
s1p_offset := tp_offset
tp := temp_special
tp_offset := temp_integer
ul := vl
vl := t
end
target [target_offset] := ul
ssize := normalize (cofactor, cofactor_offset, ssize)
if orig_s0p /= cofactor then
orig_s0p.copy_data (cofactor, cofactor_offset, orig_s0p_offset, ssize)
end
if sign >= 0 then
cofactor_count.cofactor_count := ssize
else
cofactor_count.cofactor_count := -ssize
end
Result := 1
end
end
gcdext (target: SPECIAL [NATURAL_32]; target_offset: INTEGER; cofactor: SPECIAL [NATURAL_32]; cofactor_offset: INTEGER; cofactor_count: TUPLE [cofactor_count: INTEGER]; op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER; op1_count: INTEGER; op2: SPECIAL [NATURAL_32]; op2_offset: INTEGER; op2_count: INTEGER): INTEGER
require
op1_count >= op2_count
op2_count >= 0
op1.valid_index (op1_offset)
op1.valid_index (op1_offset + op1_count - 0)
op1 [op1_offset + op1_count - 1] /= 0
op2.valid_index (op2_offset)
op2.valid_index (op2_offset + op2_count - 0)
op1 [op1_offset + op1_count - 1] /= 0
target.valid_index (target_offset)
target.valid_index (target_offset + op1_count - 1)
cofactor.valid_index (cofactor_offset)
cofactor.valid_index (cofactor_offset + op1_count - 1)
local
orig_n: INTEGER
do
orig_n := op2_count
Result := basic_gcdext (target, target_offset, cofactor, cofactor_offset, cofactor_count, op1, op1_offset, op1_count, op2, op2_offset, op2_count)
end
modexact_1c_odd (op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER; op1_count: INTEGER; d: NATURAL_32; orig_c: NATURAL_32): NATURAL_32
require
op1_count >= 1
d.bit_test (0)
local
s: NATURAL_32
h: CELL [NATURAL_32]
l: CELL [NATURAL_32]
inverse: NATURAL_32
dummy: CELL [NATURAL_32]
dmul: NATURAL_32
c: CELL [NATURAL_32]
i: INTEGER
do
create l.put (0)
create c.put (orig_c)
create h.put (0)
create dummy.put (0)
if op1_count = 1 then
s := op1 [op1_offset]
if s > c.item then
l.put (s - c.item)
h.put (l.item \\ d)
if h.item /= 0 then
h.put (d - h.item)
end
else
l.put (c.item - s)
h.put (l.item \\ d)
end
Result := h.item
else
inverse := modlimb_invert (d)
dmul := d
from
i := 0
until
i >= op1_count - 1
loop
s := op1 [op1_offset + i]
subc_limb (c, l, s, c.item)
l.put (l.item * inverse)
umul_ppmm (h, dummy, l.item, dmul)
c.put (c.item + h.item)
i := i + 1
end
s := op1 [op1_offset + i]
if s <= d then
l.put (c.item - s)
if c.item < s then
l.put (l.item + d)
end
Result := l.item
else
subc_limb (c, l, s, c.item)
l.put (l.item * inverse)
umul_ppmm (h, dummy, l.item, dmul)
c.put (c.item + h.item)
Result := c.item
end
end
ensure
orig_c < d implies Result < d
orig_c >= d implies Result <= d
end
preinv_mod_1 (up: SPECIAL [NATURAL_32]; up_offset: INTEGER; un: INTEGER; d: NATURAL_32; dinv: NATURAL_32): NATURAL_32
require
un >= 1
d.bit_test (31)
local
i: INTEGER
n0: NATURAL_32
r: CELL [NATURAL_32]
dummy: CELL [NATURAL_32]
do
create r.put (up [up_offset + un - 1])
create dummy.put (0)
if r.item >= d then
r.put (r.item - d)
end
from
i := un - 2
until
i < 0
loop
n0 := up [up_offset + i]
udiv_qrnnd_preinv (dummy, r, r.item, n0, d, dinv)
i := i - 1
end
Result := r.item
end
redc_basecase (cp: SPECIAL [NATURAL_32]; cp_offset: INTEGER; mp: SPECIAL [NATURAL_32]; mp_offset: INTEGER; n: INTEGER; n_prim: NATURAL_32; tp: SPECIAL [NATURAL_32]; tp_offset_a: INTEGER)
local
cy: NATURAL_32
q: NATURAL_32
j: INTEGER
tp_offset: INTEGER
junk: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
tp_offset := tp_offset_a
from
j := 0
until
j >= n
loop
q := tp [tp_offset] * n_prim
addmul_1 (tp, tp_offset, mp, mp_offset, n, q, carry)
tp [tp_offset] := carry.item
tp_offset := tp_offset + 1
j := j + 1
end
add_n (cp, cp_offset, tp, tp_offset, tp, tp_offset - n, n, carry)
cy := carry.item
if cy /= 0 then
sub_n (cp, cp_offset, cp, cp_offset, mp, mp_offset, n, carry)
junk := carry.item
end
end
subc_limb (cout: CELL [NATURAL_32]; w: CELL [NATURAL_32]; x: NATURAL_32; y: NATURAL_32)
do
w.put (x - y)
cout.put ((w.item > x).to_integer.to_natural_32)
end
invert_gf (target: SPECIAL [NATURAL_32] target_offset: INTEGER op1_a: SPECIAL [NATURAL_32] op1_offset: INTEGER op1_count_a: INTEGER op2_a: SPECIAL [NATURAL_32] op2_offset: INTEGER op2_count_a: INTEGER)
-- Invert `op1' over `op2' using the extended euclidian algorithm in F2M
require
op2_count_a > 0
op1_count_a >= 0
op1_count_a <= op2_count_a;
(op1_count_a = op2_count_a) implies cmp (op1_a, op1_offset, op2_a, op2_offset, op2_count_a) <= 0
local
op1: SPECIAL [NATURAL_32]
op1_count: INTEGER
op1_leading_zeros: INTEGER
op2: SPECIAL [NATURAL_32]
op2_count: INTEGER
op2_leading_zeros: INTEGER
tmp_special: SPECIAL [NATURAL_32]
tmp_integer: INTEGER
g1: SPECIAL [NATURAL_32]
g1_count: INTEGER
g2: SPECIAL [NATURAL_32]
g2_count: INTEGER
operand_sizes: INTEGER
left_shift_amount: INTEGER
do
operand_sizes := op2_count_a
op1_count := op1_count_a
op2_count := op2_count_a
create op1.make_filled (0, operand_sizes + operand_sizes)
create op2.make_filled (0, operand_sizes + operand_sizes)
op1.copy_data (op1_a, op1_offset, 0, op1_count.min (operand_sizes))
op2.copy_data (op2_a, op2_offset, 0, op2_count.min (operand_sizes))
create g1.make_filled (0, operand_sizes + operand_sizes)
create g2.make_filled (0, operand_sizes + operand_sizes)
g1 [0] := 1
g1_count := 1
g2_count := 0
from
until
op1_count = 0
loop
op1_leading_zeros := leading_zeros (op1 [op1_count - 1])
op2_leading_zeros := leading_zeros (op2 [op2_count - 1])
if op1_count < op2_count or (op1_count = op2_count and op1_leading_zeros > op2_leading_zeros) then
tmp_special := op1
op1 := op2
op2 := tmp_special
tmp_special := g1
g1 := g2
g2 := tmp_special
tmp_integer := op1_count
op1_count := op2_count
op2_count := tmp_integer
tmp_integer := op1_leading_zeros
op1_leading_zeros := op2_leading_zeros
op2_leading_zeros := tmp_integer
end
if op1_count /= op2_count or (op1_count = op2_count and op1_leading_zeros /= op2_leading_zeros) then
left_shift_amount := (op1_count - op2_count) * limb_bits + op2_leading_zeros - op1_leading_zeros
bit_xor_lshift (op1, 0, op1, 0, op1_count, op2, 0, op2_count, left_shift_amount)
bit_xor_lshift (g1, 0, g1, 0, operand_sizes, g2, 0, operand_sizes, left_shift_amount)
else
bit_xor (op1, 0, op1, 0, op1_count, op2, 0, op2_count)
bit_xor (g1, 0, g1, 0, operand_sizes, g2, 0, operand_sizes)
end
op1_count := normalize (op1, 0, op1_count)
op2_count := normalize (op2, 0, op2_count)
end
target.copy_data (g2, 0, target_offset, operand_sizes)
end
end

View File

@@ -1,52 +0,0 @@
note
description: "Summary description for {NUMBER_SIZING}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Whatever you do will be insignificant, but it is very important that you do it. - Mahatma Gandhi"
deferred class
SPECIAL_SIZING
inherit
LIMB_MANIPULATION
MP_BASES
feature
sizeinbase (source: SPECIAL [NATURAL_32]; source_offset: INTEGER; size: INTEGER; base: INTEGER): INTEGER
require
size >= 0
base >= 2
local
lb_base: INTEGER
count: INTEGER
total_bits: INTEGER
do
if size = 0 then
Result := 1
else
count := leading_zeros (source [source_offset + size - 1])
total_bits := size * limb_bits - count
if pow2_p (base.to_natural_32) then
lb_base := big_base (base).to_integer_32
Result := (total_bits + lb_base - 1) // lb_base
else
Result := ((total_bits * chars_per_bit_exactly (base)) + 1).truncated_to_integer
end
end
end
sizeinbase_2exp (ptr: SPECIAL [NATURAL_32]; ptr_offset: INTEGER; ptr_count: INTEGER; base2exp: INTEGER): INTEGER
require
ptr_count > 0
ptr [ptr_offset + ptr_count - 1] /= 0
local
count: INTEGER
totbits: INTEGER
do
count := leading_zeros (ptr [ptr_offset + ptr_count - 1])
totbits := ptr_count * limb_bits - count
Result := (totbits + base2exp - 1) // base2exp
end
end

View File

@@ -1,37 +0,0 @@
note
description: "Summary description for {NUMBER_UTILITY}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "If a law is unjust, a man is not only right to disobey it, he is obligated to do so. - Thomas Jefferson"
deferred class
SPECIAL_UTILITY
feature
normalize (op1: SPECIAL [NATURAL_32]; op1_offset: INTEGER; op1_count: INTEGER): INTEGER
do
from
Result := op1_count
until
Result <= 0 or op1 [op1_offset + Result - 1] /= 0
loop
Result := Result - 1
end
end
reverse (target: SPECIAL [NATURAL_32]; target_offset: INTEGER; source: SPECIAL [NATURAL_32]; source_offset: INTEGER; count: INTEGER)
local
i: INTEGER
do
from
i := 0
until
i >= count
loop
target [target_offset + i] := source [source_offset + count - 1 - i]
i := i + 1
end
end
end

View File

@@ -1,66 +0,0 @@
note
description: "An INTEGER_X whos value cannot change"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Freedom is the emancipation from the arbitrary rule of other men. - Mortimer Adler (1902-2001)"
class
IMMUTABLE_INTEGER_X
inherit
READABLE_INTEGER_X
create
default_create,
make_from_integer,
make_from_integer_64,
make_from_integer_32,
make_from_integer_16,
make_from_integer_8,
make_from_natural,
make_from_natural_64,
make_from_natural_32,
make_from_natural_16,
make_from_natural_8,
make_from_string,
make_from_hex_string,
make_from_string_base,
make_random,
make_from_bytes,
make_random_prime,
make_random_max,
make_limbs,
make_bits,
make_set
convert
to_integer_64: {INTEGER_64},
to_integer_32: {INTEGER_32},
to_integer_16: {INTEGER_16},
to_integer_8: {INTEGER_8},
to_natural_64: {NATURAL_64},
to_natural_32: {NATURAL_32},
to_natural_16: {NATURAL_16},
to_natural_8: {NATURAL_8},
make_from_integer_64 ({INTEGER_64}),
make_from_integer_32 ({INTEGER_32}),
make_from_integer_16 ({INTEGER_16}),
make_from_integer_8 ({INTEGER_8}),
make_from_natural_64 ({NATURAL_64}),
make_from_natural_32 ({NATURAL_32}),
make_from_natural_16 ({NATURAL_16}),
make_from_natural_8 ({NATURAL_8}),
make_set ({READABLE_INTEGER_X})
feature
one: like Current
do
create Result.make_from_integer (1)
end
zero: like Current
do
create Result
end
end

View File

@@ -1,89 +0,0 @@
note
description: "An arbitrary precision integer"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "'For your own good' is a persuasive argument that will eventually make a man agree to his own destruction. - Janet Frame, Faces In The Water, 1982"
class
INTEGER_X
inherit
READABLE_INTEGER_X
export
{ANY}
abs,
plus,
minus,
product,
quotient,
opposite,
bit_complement,
bit_and,
bit_or,
bit_xor,
bit_not,
bit_xor_left_shift,
bit_shift_right,
bit_shift_left,
set_bit,
powm,
inverse,
modulo,
gcd,
invert_gf
end
create
default_create,
make_from_integer,
make_from_integer_64,
make_from_integer_32,
make_from_integer_16,
make_from_integer_8,
make_from_natural,
make_from_natural_64,
make_from_natural_32,
make_from_natural_16,
make_from_natural_8,
make_from_string,
make_from_hex_string,
make_from_string_base,
make_random,
make_from_bytes,
make_random_prime,
make_random_max,
make_limbs,
make_bits,
make_set
convert
to_integer_64: {INTEGER_64},
to_integer_32: {INTEGER_32},
to_integer_16: {INTEGER_16},
to_integer_8: {INTEGER_8},
to_natural_64: {NATURAL_64},
to_natural_32: {NATURAL_32},
to_natural_16: {NATURAL_16},
to_natural_8: {NATURAL_8},
make_from_integer_64 ({INTEGER_64}),
make_from_integer_32 ({INTEGER_32}),
make_from_integer_16 ({INTEGER_16}),
make_from_integer_8 ({INTEGER_8}),
make_from_natural_64 ({NATURAL_64}),
make_from_natural_32 ({NATURAL_32}),
make_from_natural_16 ({NATURAL_16}),
make_from_natural_8 ({NATURAL_8}),
make_set ({READABLE_INTEGER_X})
feature -- Constants
one: like Current
do
create Result.make_from_integer (1)
end
zero: like Current
do
create Result
end
end

View File

@@ -1,20 +0,0 @@
note
description: "An exception when a {STRING} couldn't be parsed in to a {INTEGER_X}"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Heresy is only another word for freedom of thought. - Graham Greene (1904-1991)"
class
INTEGER_X_STRING_EXCEPTION
inherit
DEVELOPER_EXCEPTION
redefine
internal_meaning
end
feature
internal_meaning: STRING = "Erorr parsing string as INTEGER_X"
end

View File

@@ -1,19 +0,0 @@
note
description: "An exception when an {INTEGER_X} doesn't have a modular inverse"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Whenever they burn books they will also, in the end, burn human beings. - Heinrich Heine (1797-1856), Almansor: A Tragedy, 1823"
class
INVERSE_EXCEPTION
inherit
DEVELOPER_EXCEPTION
redefine
internal_meaning
end
feature
internal_meaning: STRING = "No modular inverse"
end

View File

@@ -1,17 +0,0 @@
note
description: "Summary description for {LIMB_DEFINITION}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
deferred class
LIMB_DEFINITION
feature
limb_high_bit: INTEGER = 31
-- Index of the high bit of a limb
limb_bits: INTEGER = 32
-- Number of bits in a limb
end

View File

@@ -1,458 +0,0 @@
note
description: "Summary description for {LIMB_MANIPULATION}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
deferred class
LIMB_MANIPULATION
inherit
LIMB_BIT_SCANNING
LIMB_DEFINITION
feature
limb_low_bit: INTEGER = 0
-- Index of the low bit of a limb
limb_max: NATURAL_32 = 0xffffffff
-- Maximum value of limb type
integer_to_limb (integer: INTEGER): NATURAL_32
require
integer >= 0
do
Result := integer.to_natural_32
end
boolean_to_integer (boolean: BOOLEAN): INTEGER
do
Result := boolean.to_integer
ensure
boolean implies Result = 1
not boolean implies Result = 0
end
boolean_to_limb (boolean: BOOLEAN): NATURAL_32
do
Result := boolean_to_integer (boolean).to_natural_32
ensure
boolean implies Result = 1
not boolean implies Result = 0
end
extract_limb (count: INTEGER; xh: NATURAL_32; xl: NATURAL_32): NATURAL_32
require
count < limb_bits
count >= 0
do
if count = 0 then
Result := xh
else
Result := (xh |<< count).bit_or (xl |>> (limb_bits - count))
end
end
write_limb (limb_a: NATURAL_32; target: SPECIAL [NATURAL_8]; target_offset: INTEGER)
do
target [target_offset] := limb_a.to_natural_8
target [target_offset + 1] := (limb_a |>> 8).to_natural_8
target [target_offset + 2] := (limb_a |>> 16).to_natural_8
target [target_offset + 3] := (limb_a |>> 24).to_natural_8
end
write_limb_be (limb_a: NATURAL_32; target: SPECIAL [NATURAL_8]; target_offset: INTEGER)
do
target [target_offset] := (limb_a |>> 24).to_natural_8
target [target_offset + 1] := (limb_a |>> 16).to_natural_8
target [target_offset + 2] := (limb_a |>> 8).to_natural_8
target [target_offset + 3] := limb_a.to_natural_8
end
read_limb (source: SPECIAL [NATURAL_8]; source_offset: INTEGER): NATURAL_32
do
Result := source [source_offset + 3].to_natural_32 |<< 24
Result := Result.bit_or (source [source_offset + 2].to_natural_32 |<< 16)
Result := Result.bit_or (source [source_offset + 1].to_natural_32 |<< 8)
Result := Result.bit_or (source [source_offset].to_natural_32)
end
read_limb_be (source: SPECIAL [NATURAL_8]; source_offset: INTEGER): NATURAL_32
do
Result := source [source_offset].to_natural_32 |<< 24
Result := Result.bit_or (source [source_offset + 1].to_natural_32 |<< 16)
Result := Result.bit_or (source [source_offset + 2].to_natural_32 |<< 8)
Result := Result.bit_or (source [source_offset + 3].to_natural_32)
end
udiv_qrnnd (q: TUPLE [q: NATURAL_32]; r: TUPLE [r: NATURAL_32]; n1: NATURAL_32; n0: NATURAL_32; d: NATURAL_32)
require
d /= 0
n1 < d
local
d1: NATURAL_32
d0: NATURAL_32
q1: NATURAL_32
q0: NATURAL_32
r1: NATURAL_32
r0: NATURAL_32
m: NATURAL_32
do
d1 := d.bit_shift_right (16)
d0 := d.bit_and (0xffff)
q1 := n1 // d1
r1 := n1 - q1 * d1
m := q1 * d0
r1 := (r1 * 0x10000).bit_or (n0.bit_shift_right (16))
if r1 < m then
q1 := q1 - 1
r1 := r1 + d
if r1 >= d then
if r1 < m then
q1 := q1 - 1
r1 := r1 + d
end
end
end
r1 := r1 - m
q0 := r1 // d1
r0 := r1 - q0 * d1
m := q0 * d0
r0 := (r0 * 0x10000).bit_or (n0.bit_and (0xffff))
if r0 < m then
q0 := q0 - 1
r0 := r0 + d
if r0 >= d then
if r0 < m then
q0 := q0 - 1
r0 := r0 + d
end
end
end
r0 := r0 - m
q.q := (q1 * 0x10000).bit_or (q0)
r.r := r0
end
limb_inverse (limb_a: NATURAL_32): NATURAL_32
local
q: TUPLE [q: NATURAL_32]
r: TUPLE [r: NATURAL_32]
do
create q
create r
udiv_qrnnd (q, r, limb_a.bit_not, limb_max, limb_a)
Result := q.q
end
modlimb_invert (limb_a: NATURAL_32): NATURAL_32
require
limb_a.bit_test (0)
do
Result := modlimb_invert_table ((limb_a // 2).bit_and (0x7f).to_natural_8).to_natural_32
Result := 2 * Result - Result * Result * limb_a
Result := 2 * Result - Result * Result * limb_a
end
modlimb_invert_table (in: NATURAL_8): NATURAL_8
require
in >= 0
in <= 0x7f
do
inspect in
when 0 then
Result := 0x01
when 1 then
Result := 0xab
when 2 then
Result := 0xcd
when 3 then
Result := 0xb7
when 4 then
Result := 0x39
when 5 then
Result := 0xa3
when 6 then
Result := 0xc5
when 7 then
Result := 0xef
when 8 then
Result := 0xf1
when 9 then
Result := 0x1b
when 10 then
Result := 0x3d
when 11 then
Result := 0xa7
when 12 then
Result := 0x29
when 13 then
Result := 0x13
when 14 then
Result := 0x35
when 15 then
Result := 0xdf
when 16 then
Result := 0xe1
when 17 then
Result := 0x8b
when 18 then
Result := 0xad
when 19 then
Result := 0x97
when 20 then
Result := 0x19
when 21 then
Result := 0x83
when 22 then
Result := 0xa5
when 23 then
Result := 0xcf
when 24 then
Result := 0xd1
when 25 then
Result := 0xfb
when 26 then
Result := 0x1d
when 27 then
Result := 0x87
when 28 then
Result := 0x09
when 29 then
Result := 0xf4
when 30 then
Result := 0x15
when 31 then
Result := 0xbf
when 32 then
Result := 0xc1
when 33 then
Result := 0x6b
when 34 then
Result := 0x8d
when 35 then
Result := 0x77
when 36 then
Result := 0xf9
when 37 then
Result := 0x63
when 38 then
Result := 0x85
when 39 then
Result := 0xaf
when 40 then
Result := 0xb1
when 41 then
Result := 0xdb
when 42 then
Result := 0xfd
when 43 then
Result := 0x67
when 44 then
Result := 0xe9
when 45 then
Result := 0xd3
when 46 then
Result := 0xf5
when 47 then
Result := 0x9f
when 48 then
Result := 0xa1
when 49 then
Result := 0x4b
when 50 then
Result := 0x6d
when 51 then
Result := 0x57
when 52 then
Result := 0xd9
when 53 then
Result := 0x43
when 54 then
Result := 0x65
when 55 then
Result := 0x8f
when 56 then
Result := 0x91
when 57 then
Result := 0xbb
when 58 then
Result := 0xdd
when 59 then
Result := 0x47
when 60 then
Result := 0xc9
when 61 then
Result := 0xb3
when 62 then
Result := 0xd5
when 63 then
Result := 0x7f
when 64 then
Result := 0x81
when 65 then
Result := 0x2b
when 66 then
Result := 0x4d
when 67 then
Result := 0x37
when 68 then
Result := 0xb9
when 69 then
Result := 0x23
when 70 then
Result := 0x45
when 71 then
Result := 0x6f
when 72 then
Result := 0x71
when 73 then
Result := 0x9b
when 74 then
Result := 0xbd
when 75 then
Result := 0x27
when 76 then
Result := 0xa9
when 77 then
Result := 0x93
when 78 then
Result := 0xb5
when 79 then
Result := 0x5f
when 80 then
Result := 0x61
when 81 then
Result := 0x0b
when 82 then
Result := 0x2d
when 83 then
Result := 0x17
when 84 then
Result := 0x99
when 85 then
Result := 0x03
when 86 then
Result := 0x25
when 87 then
Result := 0x4f
when 88 then
Result := 0x51
when 89 then
Result := 0x7b
when 90 then
Result := 0x9d
when 91 then
Result := 0x07
when 92 then
Result := 0x89
when 93 then
Result := 0x73
when 94 then
Result := 0x95
when 95 then
Result := 0x3f
when 96 then
Result := 0x41
when 97 then
Result := 0xeb
when 98 then
Result := 0x0d
when 99 then
Result := 0xf7
when 100 then
Result := 0x79
when 101 then
Result := 0xe3
when 102 then
Result := 0x05
when 103 then
Result := 0x2f
when 104 then
Result := 0x31
when 105 then
Result := 0x5b
when 106 then
Result := 0x7d
when 107 then
Result := 0xe7
when 108 then
Result := 0x69
when 109 then
Result := 0x53
when 110 then
Result := 0x75
when 111 then
Result := 0x1f
when 112 then
Result := 0x21
when 113 then
Result := 0xcb
when 114 then
Result := 0xed
when 115 then
Result := 0xd7
when 116 then
Result := 0x59
when 117 then
Result := 0xc3
when 118 then
Result := 0xe5
when 119 then
Result := 0x0f
when 120 then
Result := 0x11
when 121 then
Result := 0x3b
when 122 then
Result := 0x5d
when 123 then
Result := 0xc7
when 124 then
Result := 0x49
when 125 then
Result := 0x33
when 126 then
Result := 0x55
when 127 then
Result := 0xff
end
end
bit_index_to_limb_index (bit_a: INTEGER): INTEGER
do
Result := bit_a // limb_bits
end
umul_ppmm (xh: CELL [NATURAL_32]; xl: CELL [NATURAL_32]; m0: NATURAL_32; m1: NATURAL_32)
local
t: NATURAL_64
do
t := limb_multiply (m0, m1)
xl.put (t.to_natural_32)
xh.put (t.bit_shift_right (limb_bits).to_natural_32)
end
bits_to_limbs (n: INTEGER): INTEGER
do
Result := (n + limb_bits - 1) // limb_bits
end
bits_top_limb (n: INTEGER): INTEGER
-- How many bits of the top limb would be occupied with n bits total
do
Result := (n + limb_bits - 1) \\ limb_bits
end
pow2_p (in: NATURAL_32): BOOLEAN
do
Result := in.bit_and (in - 1) = 0
end
limb_multiply (one: NATURAL_32 two: NATURAL_32): NATURAL_64
-- Return the lossless multiplication of `one' and `two'
do
Result := one.to_natural_64 * two.to_natural_64
end
end

View File

@@ -1,249 +0,0 @@
note
description: "A Linear congruential random number generator"
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "To limit the press is to insult a nation; to prohibit reading of certain books is to declare the inhabitants to be either fools or knaves. - Claude-Adrien Helvetius"
class
LINEAR_CONGRUENTIAL_RNG
inherit
RANDOM_NUMBER_GENERATOR
LIMB_MANIPULATION
SPECIAL_UTILITY
SPECIAL_ARITHMETIC
rename
add as add_special,
sub as sub_special,
mul as mul_special
export
{NONE}
all
end
INTEGER_X_DIVISION
create
make
feature
make (size: INTEGER)
require
size >= 0
size <= 128
local
a: INTEGER_X
m2exp: INTEGER
number: STRING_8
do
inspect size
when 0..16 then
m2exp := 32
number := "29cf535"
when 17 then
m2exp := 34
number := "A3D73AD"
when 18 then
m2exp := 36
number := "28f825c5"
when 19 then
m2exp := 38
number := "a3dd4cdd"
when 20 then
m2exp := 40
number := "28f5da175"
when 21..28 then
m2exp := 56
number := "AA7D735234C0DD"
when 29..32 then
m2exp := 64
number := "BAECD515DAF0B49D"
when 33..50 then
m2exp := 100
number := "292787EBD3329AD7E7575E2FD"
when 51..64 then
m2exp := 128
number := "48A74F367FA7B5C8ACBB36901308FA85"
when 65..78 then
m2exp := 156
number := "78A7FDDDC43611B527C3F1D760F36E5D7FC7C45"
when 79..98 then
m2exp := 196
number := "41BA2E104EE34C66B3520CE706A56498DE6D44721E5E24F5"
when 99..100 then
m2exp := 200
number := "4E5A24C38B981EAFE84CD9D0BEC48E83911362C114F30072C5"
when 101..238 then
m2exp := 256
number := "AF66BA932AAF58A071FD8F0742A99A0C76982D648509973DB802303128A14CB5"
end
create a.make_from_string_base (number, 16)
randinit_lc_2exp (a, 1, m2exp)
end
feature
randinit_lc_2exp (a: READABLE_INTEGER_X; c: NATURAL_32; m2exp: INTEGER)
local
seedn: INTEGER
do
seedn := bits_to_limbs (m2exp)
create seed.make (m2exp, a, seedn, c)
end
seed: RAND_LC_STRUCT
randseed (seed_a: READABLE_INTEGER_X)
local
seedz: READABLE_INTEGER_X
seedn: INTEGER
do
seedz := seed.seed
seedn := bits_to_limbs (seed.m2exp)
fdiv_r_2exp (seedz, seed_a, seed.m2exp)
seedz.item.fill_with (0, seedz.count, seedz.count - (seedn - seedz.count))
seedz.count := seedn
end
randget (target: SPECIAL [NATURAL_32]; target_offset: INTEGER; nbits: INTEGER)
local
rbitpos: INTEGER
chunk_nbits: INTEGER
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER
tn: INTEGER
r2p: SPECIAL [NATURAL_32]
r2p_offset: INTEGER
rcy: NATURAL_32
junk: INTEGER
last_nbits: INTEGER
savelimb: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
chunk_nbits := seed.m2exp // 2
tn := bits_to_limbs (chunk_nbits)
create tp.make_filled (0, tn)
from
rbitpos := 0
until
rbitpos + chunk_nbits > nbits
loop
r2p := target
r2p_offset := target_offset + rbitpos // limb_bits
if rbitpos \\ limb_bits /= 0 then
junk := lc (tp, tp_offset)
savelimb := r2p [r2p_offset]
lshift (r2p, r2p_offset, tp, tp_offset, tn, rbitpos \\ limb_bits, carry)
rcy := carry.item
r2p [r2p_offset] := r2p [r2p_offset].bit_or (savelimb)
if (chunk_nbits \\ limb_bits + rbitpos \\ limb_bits) > limb_bits then
r2p [r2p_offset + tn] := rcy
end
else
junk := lc (r2p, r2p_offset)
end
rbitpos := rbitpos + chunk_nbits
end
if rbitpos /= nbits then
r2p := target
r2p_offset := target_offset + rbitpos // limb_bits
last_nbits := nbits - rbitpos
tn := bits_to_limbs (last_nbits)
junk := lc (tp, tp_offset)
if rbitpos \\ limb_bits /= 0 then
savelimb := r2p [r2p_offset]
lshift (r2p, r2p_offset, tp, tp_offset, tn, rbitpos \\ limb_bits, carry)
rcy := carry.item
r2p [r2p_offset] := r2p [r2p_offset].bit_or (savelimb)
if rbitpos + tn * limb_bits - rbitpos \\ limb_bits < nbits then
r2p [r2p_offset + tn] := rcy
end
else
r2p.copy_data (tp, tp_offset, r2p_offset, tn)
end
if nbits \\ limb_bits /= 0 then
target [target_offset + nbits // limb_bits] := target [target_offset + nbits // limb_bits].bit_and (((0).to_natural_32.bit_not |<< (nbits \\ limb_bits)).bit_not)
end
end
end
lc (target: SPECIAL [NATURAL_32]; target_offset: INTEGER): INTEGER
local
tp: SPECIAL [NATURAL_32]
tp_offset: INTEGER
seedp: SPECIAL [NATURAL_32]
seedp_offset: INTEGER
ap: SPECIAL [NATURAL_32]
ap_offset: INTEGER
ta: INTEGER
tn: INTEGER
seedn: INTEGER
an: INTEGER
m2exp: INTEGER
bits: INTEGER
cy: INTEGER
xn: INTEGER
tmp: INTEGER
i: INTEGER
x: NATURAL_32
limb: NATURAL_32
count: INTEGER
junk: NATURAL_32
carry: CELL [NATURAL_32]
do
create carry.put (0)
m2exp := seed.m2exp
seedp := seed.seed.item
seedn := seed.seed.count
ap := seed.a.item
an := seed.a.count
ta := an + seedn + 1
tn := bits_to_limbs (m2exp)
if ta <= tn then
tmp := an + seedn
ta := tn + 1
end
create tp.make_filled (0, ta)
mul_special (tp, tp_offset, seedp, seedp_offset, seedn, ap, ap_offset, an, carry)
junk := carry.item
i := seed.cn
if i /= 0 then
add_n (tp, tp_offset, tp, tp_offset, seed.cp, 0, i, carry)
if carry.item /= 0 then
from
cy := 0
limb := 1
until
cy /= 0 or limb = 0
loop
if i >= tn then
cy := 1
else
x := tp [tp_offset + i]
limb := x + 1
tp [tp_offset + i] := limb
i := i + 1
end
end
end
end
tp [tp_offset + m2exp // limb_bits] := tp [tp_offset + m2exp // limb_bits].bit_and ((integer_to_limb (1) |<< m2exp \\ integer_to_limb (limb_bits)) - 1)
seed.seed.item.copy_data (tp, tp_offset, 0, tn)
bits := m2exp // 2
xn := bits // limb_bits
tn := tn - xn
if tn > 0 then
count := bits \\ limb_bits
if count /= 0 then
rshift (tp, tp_offset, tp, tp_offset + xn, tn, count, carry)
junk := carry.item
target.copy_data (tp, tp_offset, target_offset, xn + 1)
else
target.copy_data (tp, tp_offset + xn, target_offset, tn)
end
end
Result := (m2exp + 1) // 2
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +0,0 @@
note
description: "Summary description for {RANDSTRUCT}."
author: "Colin LeMahieu"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
quote: "Where men cannot freely convey their thoughts to one another, no other liberty is secure. - William E. Hocking (1873-1966), Freedom of the Press, 1947"
deferred class
RANDOM_NUMBER_GENERATOR
inherit
LIMB_MANIPULATION
feature
randseed (seed: READABLE_INTEGER_X)
deferred
end
randget (target: SPECIAL [NATURAL_32]; target_offset: INTEGER; count: INTEGER)
require
count = 0 or target.valid_index (target_offset)
count = 0 or target.valid_index (target_offset + bits_to_limbs (count) - 1)
deferred
ensure
target [target_offset + bits_to_limbs (count) - 1] = 0 or else most_significant_one (target [target_offset + bits_to_limbs (count) - 1]) <= bits_top_limb (count)
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +0,0 @@
Test suite order -
-Interfaces must be tested first (string conversions, Eiffel native construction conversions, etc, using known good large numbers verified by other big number libraries.
(If we don't have at least this then nothing else can be trusted)
-Integer Interfaces
-Real Interfaces
* Real MPF
* Real MPFR
-Rational
-Complex Integer
-Complex Complex Real
* Complex Real MPF
* Complex Real MPFR
-Complex Rational
-Test arithmetic functions for each eiffel MP constrcts using known values/solutions for "big" numbers and checking using previously tested known-good interfaces.
*Test arithmetic operations between similar types of MP constructs
*Test arithmetic operations between different types of MP constructs
TODO:
Reformat test suite order
Start testing interfaces
-Integer Interfaces
-Real Interfaces
* Real MPF
* Real MPFR
-Rational
-Complex Integer
-Complex Complex Real
* Complex Real MPF
* Complex Real MPFR
-Complex Rational

View File

@@ -1,43 +0,0 @@
note
description : "Library unit test root class"
date : "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision : "$Revision: 87787 $"
class
TEST
inherit
ARGUMENTS
create
make
feature {NONE} -- Initialization
make
local
do
end
test1: detachable TEST_INTEGER_X
test2: detachable TEST_INTEGER_FUNCTIONS
test3: detachable TEST_INTEGER_X_ASSIGNMENT
test4: detachable TEST_SPECIAL_ARITHMETIC
test5: detachable TEST_SPECIAL_DIVISION
test6: detachable TEST_SPECIAL_LOGIC
test7: detachable TEST_SPECIAL_NUMBER_THEORETIC
test9: detachable TEST_RANDSTRUCT_LC
test10: detachable TEST_RANDSTRUCT_MT
test11: detachable TEST_INTEGER_X_RANDOM
test12: detachable TEST_INTEGER_X_ACCESS
test13: detachable TEST_INTEGER_X_IO
test14: detachable TEST_INTEGER_X_NUMBER_THEORY
test15: detachable TEST_INTEGER_X_ARITHMETIC
test16: detachable TEST_SPECIAL_GCD
test17: detachable TEST_INTEGER_X_DIVISION
test18: detachable TEST_INTEGER_X_GCD
test19: detachable TEST_INTEGER_X_LOGIC
test20: detachable TEST_LIMB_MANIPULATION
test21: detachable IMMUTABLE_INTEGER_X
test22: detachable INTEGER_X
end

View File

@@ -1,19 +0,0 @@
note
description: "[
Eiffel tests that can be executed by testing tool.
]"
author: "EiffelStudio test wizard"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
testing: "type/manual"
class
TEST_INTEGER_FUNCTIONS
inherit
EQA_TEST_SET
feature -- Test routines
end

View File

@@ -1,557 +0,0 @@
note
description: "[
Eiffel tests that can be executed by testing tool.
]"
author: "EiffelStudio test wizard"
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
testing: "type/manual"
class
TEST_INTEGER_X
inherit
EQA_TEST_SET
INTEGER_X_ASSIGNMENT
undefine
default_create
end
feature -- Basic operations tests
test_init
local
one: INTEGER_X
do
create one
end
test_default_zero
local
one: INTEGER_X
do
create one
assert ("{INTEGER_X}.default_create", one.to_integer_32 = 0)
end
test_make_ui
local
one: INTEGER_X
do
create one.make_from_natural (0xffffffff)
assert ("{INTEGER_X}.make_ui", one.to_natural_32 = 0xffffffff)
end
test_as_natural
local
one: INTEGER_X
do
create one.make_from_natural (0xffffffff)
assert ("{INTEGER_X}.as_natural", one.to_natural_32 = 0xffffffff)
end
test_make_si
local
one: INTEGER_X
do
create one.make_from_integer (0x7fffffff)
assert ("{INTEGER_X}.make_si", one.to_integer_32 = 0x7fffffff)
end
test_as_integer
local
one: INTEGER_X
do
create one.make_from_integer (0x7fffffff)
assert ("{INTEGER_X}.as_integer", one.to_integer_32 = 0x7fffffff)
end
test_fits_natural_8_1
local
one: INTEGER_X
int: NATURAL_8
do
create one.make_from_string (int.max_value.out)
assert ("test fits natural 8 1", one.fits_natural_8)
end
test_fits_natural_8_2
local
one: INTEGER_X
int: NATURAL_8
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test fits natural 8 2", not one.fits_natural_8)
end
test_fits_natural_8_3
local
one: INTEGER_X
do
create one.make_from_integer (0)
assert ("test fits natural 8 3", one.fits_natural_8)
end
test_fits_natural_8_4
local
one: INTEGER_X
do
create one.make_from_integer (-1)
assert ("test fits natural 8 4", not one.fits_natural_8)
end
test_fits_natural_16_1
local
one: INTEGER_X
int: NATURAL_16
do
create one.make_from_string (int.max_value.out)
assert ("test fits natural 16 1", one.fits_natural_16)
end
test_fits_natural_16_2
local
one: INTEGER_X
int: NATURAL_16
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test fits natural 16 2", not one.fits_natural_16)
end
test_fits_natural_16_3
local
one: INTEGER_X
do
create one.make_from_integer (0)
assert ("test fits natural 16 3", one.fits_natural_16)
end
test_fits_natural_16_4
local
one: INTEGER_X
do
create one.make_from_integer (-1)
assert ("test fits natural 16 4", not one.fits_natural_16)
end
test_fits_natural_32_1
local
one: INTEGER_X
int: NATURAL_32
do
create one.make_from_string (int.max_value.out)
assert ("test fits natural 32 1", one.fits_natural_32)
end
test_fits_natural_32_2
local
one: INTEGER_X
int: NATURAL_32
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test fits natural 32 2", not one.fits_natural_32)
end
test_fits_natural_32_3
local
one: INTEGER_X
do
create one.make_from_integer (0)
assert ("test fits natural 32 3", one.fits_natural_32)
end
test_fits_natural_32_4
local
one: INTEGER_X
do
create one.make_from_integer (-1)
assert ("test fits natural 32 4", not one.fits_natural_32)
end
test_fits_natural_64_1
local
one: INTEGER_X
int: NATURAL_64
do
create one.make_from_string (int.max_value.out)
assert ("test fits natural 64 1", one.fits_natural_64)
end
test_fits_natural_64_2
local
one: INTEGER_X
int: NATURAL_64
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test fits natural 64 2", not one.fits_natural_64)
end
test_fits_natural_64_3
local
one: INTEGER_X
do
create one.make_from_integer (0)
assert ("test fits natural 64 3", one.fits_natural_64)
end
test_fits_natural_64_4
local
one: INTEGER_X
do
create one.make_from_integer (-1)
assert ("test fits natural 64 4", not one.fits_natural_64)
end
test_fits_integer_8_1
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_string (int.max_value.out)
assert ("test fits integer 8 1", one.fits_integer_8)
end
test_fits_integer_8_2
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_string (int.min_value.out)
assert ("test fits integer 8 2", one.fits_integer_8)
end
test_fits_integer_8_3
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test fits integer 8 3", not one.fits_integer_8)
end
test_fits_integer_8_4
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_string (int.min_value.out)
one.minus (one.one)
assert ("test fits integer 8 4", not one.fits_integer_8)
end
test_fits_integer_8_5
local
one: INTEGER_X
do
create one.make_from_integer (0)
assert ("test fits integer 8 5", one.fits_integer_8)
end
test_fits_integer_16_1
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_string (int.max_value.out)
assert ("test fits integer 16 1", one.fits_integer_16)
end
test_fits_integer_16_2
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_string (int.min_value.out)
assert ("test fits integer 16 2", one.fits_integer_16)
end
test_fits_integer_16_3
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test fits integer 16 3", not one.fits_integer_16)
end
test_fits_integer_16_4
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_string (int.min_value.out)
one.minus (one.one)
assert ("test fits integer 16 4", not one.fits_integer_16)
end
test_fits_integer_16_5
local
one: INTEGER_X
do
create one.make_from_integer (0)
assert ("test fits integer 16 5", one.fits_integer_16)
end
test_fits_integer_32_1
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.max_value.out)
assert ("test fits integer 32 1", one.fits_integer_32)
end
test_fits_integer_32_2
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.min_value.out)
assert ("test fits integer 32 2", one.fits_integer_32)
end
test_fits_integer_32_3
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test fits integer 32 3", not one.fits_integer_32)
end
test_fits_integer_32_4
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.min_value.out)
one.minus (one.one)
assert ("test fits integer 32 4", not one.fits_integer_32)
end
test_fits_integer_32_5
local
one: INTEGER_X
do
create one.make_from_integer (0)
assert ("test fits integer 32 5", one.fits_integer_32)
end
test_fits_integer_64_1
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_string (int.max_value.out)
assert ("test fits integer 64 1", one.fits_integer_64)
end
test_fits_integer_64_2
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_string (int.min_value.out)
assert ("test fits integer 64 2", one.fits_integer_64)
end
test_fits_integer_64_3
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test fits integer 64 3", not one.fits_integer_64)
end
test_fits_integer_64_4
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_string (int.min_value.out)
one.minus (one.one)
assert ("test fits integer 64 4", not one.fits_integer_64)
end
test_fits_integer_64_5
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.max_value.out)
assert ("test fits integer 64 5", one.fits_integer_64)
end
test_fits_integer_64_6
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.min_value.out)
assert ("test fits integer 64 6", one.fits_integer_64)
end
test_fits_integer_64_7
local
one: INTEGER_X
do
create one.make_from_integer (0)
assert ("test fits integer 64 7", one.fits_integer_64)
end
test_swap
local
one: INTEGER_X
two: INTEGER_X
do
create one.make_from_integer (1)
create two.make_from_integer (2)
swap (one, two)
assert ("{INTEGER_X}.swap 1", two.to_integer_32 = 1)
assert ("{INTEGER_X}.swap 2", one.to_integer_32 = 2)
end
test_init_set
local
one: INTEGER_X
two: INTEGER_X
do
create one.make_from_string ("0982430984230470238742037402394230948")
create two.make_set (one)
assert ("{INTEGER_X}.init_set", one ~ two)
end
test_sub
-- Test integer subtraction cases, ++ +- -+ --, 0 sum
local
posone: INTEGER_X
postwo: INTEGER_X
negone: INTEGER_X
negtwo: INTEGER_X
ans: INTEGER_X
do
create posone.make_from_integer (1000)
create postwo.make_from_integer (2000)
create negone.make_from_integer (-1000)
create negtwo.make_from_integer (-2000)
ans := posone - postwo
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = 1000 - 2000)
ans := postwo - negone
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = 2000 - -1000)
ans := negone - postwo
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = -1000 - 2000)
ans := negone - negtwo
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = -1000 - -2000)
ans := posone - posone
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = 1000 - 1000)
end
test_negative
local
one: INTEGER_X
two: INTEGER_X
do
create one.make_from_integer (1)
create two.make_from_integer (-1)
assert ("test negative", one ~ two or one ~ -two)
end
test_mul
-- Test multiplication cases, +- -+
local
posone: INTEGER_X
negone: INTEGER_X
ans: INTEGER_X
do
create posone.make_from_integer (1000)
create negone.make_from_integer (-1000)
ans := posone * posone
assert ("{INTEGER_X}.mul test", ans.to_integer_32 = 1000 * 1000)
ans := posone * negone
assert ("{INTEGER_X}.mul test", ans.to_integer_32 = 1000 * -1000)
end
test_div
-- Test integer division cases, pp, ppr, np, npr, nn, nnr
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
four: INTEGER_X
quot: INTEGER_X
do
create one.make_from_integer (42)
create two.make_from_integer (2)
create three.make_from_integer (-42)
create four.make_from_integer (-2)
quot := one / two
assert ("{INTEGER_X}.div test", quot.to_integer_32 = 42 // 2)
quot := two / one
assert ("{INTEGER_X}.div test", quot.to_integer_32 = 2 // 42)
quot := three / two
assert ("{INTEGER_X}.div test", quot.to_integer_32 = -42 // 2)
quot := two / three
assert ("{INTEGER_X}.div test", quot.to_integer_32 = 2 // -42)
quot := three / four
assert ("{INTEGER_X}.div test", quot.to_integer_32 = -42 // -2)
quot := four / three
assert ("{INTEGER_X}.div test", quot.to_integer_32 = -2 // -42)
end
test_abs
-- Test absolute value cases
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
ans: INTEGER_X
do
create one.make_from_integer (1)
create two.make_from_integer (-1)
create three.make_from_integer (0)
ans := one.abs_value
assert ("INTEGER_X.abs positive", ans.to_integer_32 = 1)
ans := two.abs_value
assert ("INTEGER_X.abs negative", ans.to_integer_32 = 1)
ans := three.abs_value
assert ("INTEGER_X.abs zero", ans.to_integer_32 = 0)
end
test_comp
-- Test comparison function cases
local
one: INTEGER_X
two: INTEGER_X
three:INTEGER_X
do
create one.make_from_integer (1000)
create two.make_from_integer (2000)
create three.make_from_integer (1000)
assert ("INTEGER_X.comp eq", one.is_equal (three) = TRUE)
assert ("INTEGER_X.comp lt", one.is_less (two) = TRUE)
assert ("INTEGER_X.comp lt", two.is_less (one) = FALSE)
assert ("INTEGER_X.comp le", one.is_less_equal (two) = TRUE)
assert ("INTEGER_X.comp le", one.is_less_equal (three) = TRUE)
assert ("INTEGER_X.comp le", two.is_less_equal (one) = FALSE)
assert ("INTEGER_X.comp gt", one.is_greater (two) = FALSE)
assert ("INTEGER_X.comp gt", two.is_greater (one) = TRUE)
assert ("INTEGER_X.comp ge", one.is_greater_equal (two) = FALSE)
assert ("INTEGER_X.comp ge", one.is_greater_equal (three) = TRUE)
assert ("INTEGER_X.comp ge", two.is_greater_equal (one) = TRUE)
end
end

View File

@@ -1,395 +0,0 @@
note
description: "Summary description for {TEST_INTEGER_X_ACCESS}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
class
TEST_INTEGER_X_ACCESS
inherit
EQA_TEST_SET
INTEGER_X_ACCESS
undefine
default_create
end
feature
test_get_integer_64_1
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_string (int.max_value.out)
assert ("test get integer 64 1 1", one.fits_integer_64)
assert ("test get integer 64 1 2", one.as_integer_64 = int.max_value)
end
test_get_integer_64_2
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_string (int.min_value.out)
assert ("test get integer 64 2 1", one.fits_integer_64)
assert ("test get integer 64 2 2", one.as_integer_64 = int.min_value)
end
test_get_integer_64_3
local
one: INTEGER_X
do
create one.make_from_string ("0")
assert ("test get integer 64 3 1", one.fits_integer_64)
assert ("test get integer 64 3 2", one.as_integer_64 = 0)
end
test_get_integer_64_4
local
one: INTEGER_X
do
create one.make_from_string ("-1")
assert ("test get integer 64 4 1", one.fits_integer_64)
assert ("test get integer 64 4 2", one.as_integer_64 = -1)
end
test_get_integer_64_5
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test get integer 64 5 1", not one.fits_integer_64)
assert ("test get integer 64 5 2", one.as_integer_64 = 0)
end
test_get_integer_64_6
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_string (int.min_value.out)
one.minus (one.one)
assert ("test get integer 64 6 1", not one.fits_integer_64)
assert ("test get integer 64 6 2", one.as_integer_64 = -1)
end
test_get_integer_32_1
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.max_value.out)
assert ("test get integer 32 1 1", one.fits_integer_32)
assert ("test get integer 32 1 2", one.as_integer_32 = int.max_value)
end
test_get_integer_32_2
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.min_value.out)
assert ("test get integer 32 2 1", one.fits_integer_32)
assert ("test get integer 32 2 2", one.as_integer_32 = int.min_value)
end
test_get_integer_32_3
local
one: INTEGER_X
do
create one.make_from_string ("0")
assert ("test get integer 32 3 1", one.fits_integer_32)
assert ("test get integer 32 3 2", one.as_integer_32 = 0)
end
test_get_integer_32_4
local
one: INTEGER_X
do
create one.make_from_string ("-1")
assert ("test get integer 32 4 1", one.fits_integer_32)
assert ("test get integer 32 4 2", one.as_integer_32 = -1)
end
test_get_integer_32_5
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test get integer 32 5 1", not one.fits_integer_32)
assert ("test get integer 32 5 2", one.as_integer_32 = 0)
end
test_get_integer_32_6
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_string (int.min_value.out)
one.minus (one.one)
assert ("test get integer 32 6 1", not one.fits_integer_32)
assert ("test get integer 32 6 2", one.as_integer_32 = -1)
end
test_get_integer_16_1
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_string (int.max_value.out)
assert ("test get integer 16 1 1", one.fits_integer_16)
assert ("test get integer 16 1 2", one.as_integer_16 = int.max_value)
end
test_get_integer_16_2
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_string (int.min_value.out)
assert ("test get integer 16 2 1", one.fits_integer_16)
assert ("test get integer 16 2 2", one.as_integer_16 = int.min_value)
end
test_get_integer_16_3
local
one: INTEGER_X
do
create one.make_from_string ("0")
assert ("test get integer 16 3 1", one.fits_integer_16)
assert ("test get integer 16 3 2", one.as_integer_16 = 0)
end
test_get_integer_16_4
local
one: INTEGER_X
do
create one.make_from_string ("-1")
assert ("test get integer 16 4 1", one.fits_integer_16)
assert ("test get integer 16 4 2", one.as_integer_16 = -1)
end
test_get_integer_16_5
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test get integer 16 5 1", not one.fits_integer_16)
assert ("test get integer 16 5 2", one.as_integer_16 = 0)
end
test_get_integer_16_6
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_string (int.min_value.out)
one.minus (one.one)
assert ("test get integer 16 6 1", not one.fits_integer_16)
assert ("test get integer 16 6 2", one.as_integer_16 = -1)
end
test_get_integer_8_1
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_string (int.max_value.out)
assert ("test get integer 8 1 1", one.fits_integer_8)
assert ("test get integer 8 1 2", one.as_integer_8 = int.max_value)
end
test_get_integer_8_2
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_string (int.min_value.out)
assert ("test get integer 8 2 1", one.fits_integer_8)
assert ("test get integer 8 2 2", one.as_integer_8 = int.min_value)
end
test_get_integer_8_3
local
one: INTEGER_X
do
create one.make_from_string ("0")
assert ("test get integer 8 3 1", one.fits_integer_8)
assert ("test get integer 8 3 2", one.as_integer_8 = 0)
end
test_get_integer_8_4
local
one: INTEGER_X
do
create one.make_from_string ("-1")
assert ("test get integer 8 4 1", one.fits_integer_8)
assert ("test get integer 8 4 2", one.as_integer_8 = -1)
end
test_get_integer_8_5
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_string (int.max_value.out)
one.plus (one.one)
assert ("test get integer 8 5 1", not one.fits_integer_8)
assert ("test get integer 8 5 2", one.as_integer_8 = 0)
end
test_get_integer_8_6
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_string (int.min_value.out)
one.minus (one.one)
assert ("test get integer 8 6 1", not one.fits_integer_8)
assert ("test get integer 8 6 2", one.as_integer_8 = -1)
end
test_get_str_1
local
one: INTEGER_X
output: STRING
do
create one.make_limbs (4)
one.item [0] := 0x87654321
one.item [1] := 0xcccccccc
one.item [2] := 0x33333333
one.item [3] := 0xffffffff
one.count := 4
output := one.out_base (16)
assert ("test get str 1", "ffffffff33333333cccccccc87654321" ~ output)
end
test_get_str_2
local
one: INTEGER_X
output: STRING
do
create one.make_limbs (4)
one.item [0] := 0x87654321
one.item [1] := 0xcccccccc
one.item [2] := 0x33333333
one.item [3] := 0xffffffff
one.count := 4
output := one.out_base (10)
assert ("test get str 2", "340282366857555933463031183799994368801" ~ output)
end
test_get_str_3
local
one: INTEGER_X
two: INTEGER_X
output: STRING
i: INTEGER
base: INTEGER
do
from
i := 0
until
i > 1000
loop
base := i \\ 61 + 2
create one.make_random (256)
output := one.out_base (base)
create two.make_from_string_base (output, base)
assert ("test get str 3", one ~ two)
i := i + 1
end
end
test_get_str_4
local
one: INTEGER_X
output: STRING
do
create one.make_limbs (8)
one.item [0] := 0x99811941
one.item [1] := 0x841FD605
one.item [2] := 0xD960A1BF
one.item [3] := 0x5E433EFC
one.item [4] := 0x48C9BC93
one.item [5] := 0x1C8B6FB1
one.item [6] := 0x8CA06DE0
one.item [7] := 0xC6182337
one.count := 8
output := one.out_base (10)
assert ("test get str 4", output ~ "89600591407770348063754312463218194105764385355557091513583682190076098451777")
end
test_get_str_5
local
one: INTEGER_X
output: STRING
do
create one.make_limbs (8)
one.item [0] := 0x99811941
one.item [1] := 0x841FD605
one.item [2] := 0xD960A1BF
one.item [3] := 0x5E433EFC
one.item [4] := 0x48C9BC93
one.item [5] := 0x1C8B6FB1
one.item [6] := 0x8CA06DE0
one.item [7] := 0xC6182337
one.count := 8
output := one.out_base (3)
assert ("test get str 5", output ~ "110022012022022000201210111012211020111202020222100010210022020220110011011010201011020001011210101000122212110112010121211022120122101102102020102011202010010112")
end
test_get_str_6
local
one: INTEGER_X
output: STRING
do
create one.make_limbs (8)
one.item [7] := 0x8134b7f7
one.item [6] := 0x8d570cbf
one.item [5] := 0xeb5f7c66
one.item [4] := 0x7aa64334
one.item [3] := 0xbb6cd783
one.item [2] := 0x22792988
one.item [1] := 0x6ec0f7ac
one.item [0] := 0x4438ad87
one.count := 8
output := one.out_base (7)
assert ("test get str 6", output ~ "5050422450443414252030234161450453214063666050554216601312032162510626626621233550541413260")
end
test_get_str_7
local
one: INTEGER_X
output: STRING
do
create one.make_limbs (8)
one.item [0] := 0x8134b7f7
one.item [1] := 0x8d570cbf
one.item [2] := 0xeb5f7c66
one.item [3] := 0x7aa64334
one.item [4] := 0xbb6cd783
one.item [5] := 0x22792988
one.item [6] := 0x6ec0f7ac
one.item [7] := 0x4438ad87
one.count := 8
output := one.out_base (7)
assert ("test get str 7", output ~ "2460223246331335544520513341363224654146046636101125253015521231163466226621435340120452343")
end
test_get_str_8
local
one: INTEGER_X
output: STRING
do
create one.make_from_integer (-1)
output := one.out_hex
assert ("test get str 7", output ~ "-1")
end
end

View File

@@ -1,208 +0,0 @@
note
description: "Summary description for {TEST_INTEGER_ARITHMETIC}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
class
TEST_INTEGER_X_ARITHMETIC
inherit
EQA_TEST_SET
INTEGER_X_ARITHMETIC
undefine
default_create
end
feature
test_add_1
-- Test integer addition cases, ++ +- -+ --, 0 sum
local
posone: INTEGER_X
postwo: INTEGER_X
negone: INTEGER_X
negtwo: INTEGER_X
ans: INTEGER_X
do
create posone.make_from_integer (1000)
create postwo.make_from_integer (2000)
create negone.make_from_integer (-1000)
create negtwo.make_from_integer (-2000)
ans := posone + postwo
assert ("{INTEGER_X}.add test", ans.to_integer_32 = 1000 + 2000)
ans := postwo + negone
assert ("{INTEGER_X}.add test", ans.to_integer_32 = 2000 + -1000)
ans := negone + postwo
assert ("{INTEGER_X}.add test", ans.to_integer_32 = -1000 + 2000)
ans := negone + negtwo
assert ("{INTEGER_X}.add test", ans.to_integer_32 = -1000 + -2000)
ans := posone + negone
assert ("{INTEGER_X}.add test", ans.to_integer_32 = 1000 + -1000)
end
test_add_2
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one.make_limbs (6)
create two.make_from_hex_string ("343bd97a 7e17702a 800c8f10 54ad58f6 1f07c505")
create three.make_from_hex_string ("ffffffff ffffffff ffffffff ffffffff 7ffffffc")
create expected.make_from_hex_string ("1343bd97a7e17702a800c8f1054ad58f59f07c501")
add (one, two, three)
assert ("test add 2", one ~ expected)
end
test_add_3
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("a9993e364706816aba3e25717850c26c9cd0d89d")
create three.make_from_hex_string ("8913681113524c02ac9b2b8777f53c1feb356bfbc122bf1970d1ccc8fc43f9bb8aec1812ee98e4a2")
create expected.make_from_hex_string ("8913681113524c02ac9b2b8777f53c1feb356bfc6abbfd4fb7d84e33b6821f2d033cda7f8b69bd3f")
add (one, two, three)
assert ("test add 3", one ~ expected)
end
test_add_4
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("-7231ea35689f4fd7ce163d502a7e14c99947e909fb2a9d7cad460fb337fae053af6e5a5419a6800c19f28b09a3a1f005621dd631b6d93fcc32e4e6069e76fb15")
create three.make_from_hex_string ("1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
create expected.make_from_hex_string ("1ff8dce15ca9760b02831e9c2afd581eb3666b816f604d5628352b9f04cc8051fac5091a5abe6597ff3e60d74f65c5e0ffa9de229ce4926c033cd1b19f9618904ea")
add (one, two, three)
assert ("test add 4", one ~ expected)
end
test_sub_1
local
one_three: INTEGER_X
two: INTEGER_X
expected: INTEGER_X
do
create one_three.make_from_hex_string ("014fae42 56ad0915 2a7b2b66 fe887b52 e06ffa35 d359cd33 14156137 564096ef 90eb9c01 9ee82ea9")
create two.make_from_hex_string ("1")
create expected.make_from_hex_string ("-014fae42 56ad0915 2a7b2b66 fe887b52 e06ffa35 d359cd33 14156137 564096ef 90eb9c01 9ee82ea8")
sub (one_three, two, one_three)
assert ("test sub 1", one_three ~ expected)
end
test_sub_2
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("1429cb78799228669deb4a9025f308ab78be74ae")
create three.make_from_hex_string ("-f7c5cdcb7d66c16bbf17e81de30488c02078684")
create expected.make_from_hex_string ("23a628553168947d59dcc912042351377ac5fb32")
sub (one, two, three)
assert ("test sub 2", one ~ expected)
end
test_mul_1
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one.make_limbs (10)
create two.make_limbs (5)
create three.make_limbs (6)
create expected.make_from_hex_string ("30f2de49 bab11556 78be37e5 d4205117 663c6cc5 5fd1e2bd 41b4a8fd 35ce30b2 07939fb8 c29af9f6")
two.item [0] := 0x9f07c4ff
two.item [1] := 0xd4ad58f1
two.item [2] := 0x800c8f0e
two.item [3] := 0x7e17702a
two.item [4] := 0x343bd97a
two.count := 5
three.item [0] := 0xfb4ab80a
three.item [1] := 0x2077ac6a
three.item [2] := 0x5bdd4431
three.item [3] := 0x6672da8e
three.item [4] := 0xefe650c5
three.count := 5
mul (one, two, three)
assert ("test mul 1", expected ~ one)
end
test_mul_2
local
one_three: INTEGER_X
two: INTEGER_X
expected: INTEGER_X
do
create one_three.make_limbs (6)
create two.make_limbs (5)
create expected.make_from_hex_string ("30f2de49 bab11556 78be37e5 d4205117 663c6cc5 5fd1e2bd 41b4a8fd 35ce30b2 07939fb8 c29af9f6")
two.item [0] := 0x9f07c4ff
two.item [1] := 0xd4ad58f1
two.item [2] := 0x800c8f0e
two.item [3] := 0x7e17702a
two.item [4] := 0x343bd97a
two.count := 5
one_three.item [0] := 0xfb4ab80a
one_three.item [1] := 0x2077ac6a
one_three.item [2] := 0x5bdd4431
one_three.item [3] := 0x6672da8e
one_three.item [4] := 0xefe650c5
one_three.count := 5
mul (one_three, two, one_three)
assert ("test mul 1", expected ~ one_three)
end
test_mul_3
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("-e69e4c55 8d0e2ed0 10128582 48b54fe8 8e87802e c871b791 5347fc54 8fb749de 9bc6e6b7 1868a715 859bcde6 96d6f196 37ad0367 26bc4cea 65f0d20e 67321392")
create three.make_from_hex_string ("000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff")
create expected.make_from_hex_string ("-1cd3c98ab1a1c5da020250b04916a9fd11d0f005d90e36f22a68ff8a91f6e93bd378dcd6e30d14e2b0b379bcd2dade32c6f5a06ce4d7899d4cbe1a41cce642723ff1961b3aa72f1d12fefed7a7db74ab01771787fd1378e486eacb803ab7048b62164391948e79758ea7a64321969290e69c852fc98d943b3159a0f2df198cdec6e")
mul (one, two, three)
assert ("test mul 3", one ~ expected)
end
test_mul_2exp_1
local
one: INTEGER_X
two: INTEGER_X
expected: INTEGER_X
do
create one.make_limbs (7)
create two.make_from_hex_string ("2 fe13c053 7bbc11ac aa07d793 de4e6d5e 5c94eee8")
create expected.make_from_hex_string ("0000000b f84f014d eef046b2 a81f5e4f 7939b579 7253bba0")
mul_2exp (one, two, 2)
assert ("test mul 2exp 1", one ~ expected)
end
test_mul_2exp_2
local
one: INTEGER_X
two: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("8 00000000 00000000 00000000 00000000 00000000")
create expected.make_from_hex_string ("8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000")
mul_2exp (one, two, 0x80)
assert ("test mul 2exp 2", one ~ expected)
end
end

View File

@@ -1,217 +0,0 @@
note
description: "Summary description for {TEST_INTEGER_X_ASSIGNMENT}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
class
TEST_INTEGER_X_ASSIGNMENT
inherit
EQA_TEST_SET
INTEGER_X_ASSIGNMENT
undefine
default_create
end
feature
test_set_str_1
local
target: INTEGER_X
do
create target
set_str (target, "100", 10)
assert ("test set str 1 1", target.item [0] = 100 and target.count = 1)
set_str (target, "10000000000", 10)
assert ("test set str 1 2", target.item [0] = 0x540be400 and target.item [1] = 0x00000002 and target.count = 2)
end
test_set_str_2
local
target: INTEGER_X
do
create target
set_str (target, "1000", 16)
assert ("test set str 1 1", target.item [0] = 0x1000 and target.count = 1)
set_str (target, "100000000000", 16)
assert ("test set str 1 2", target.item [0] = 0x00000000 and target.item [1] = 0x00001000 and target.count = 2)
end
test_set_str_3
local
target: INTEGER_X
do
create target
set_str (target, " 1 0 0 0 ", 16)
assert ("test set str 3 1", target.item [0] = 0x1000 and target.count = 1)
set_str (target, " 1 0 0 0 0 0 0 0 0 0 0 0 ", 16)
assert ("test set str 3 2", target.item [0] = 0x00000000 and target.item [1] = 0x00001000 and target.count = 2)
end
test_set_str_4
local
target: INTEGER_X
do
create target
set_str (target, " 0x 1 0 0 0 ", 0)
assert ("test set str 3 1", target.item [0] = 0x1000 and target.count = 1)
set_str (target, " 0", 0)
assert ("test set str 3 2", target.count = 0)
end
test_set_str_5
local
one: INTEGER_X
do
create one.make_from_string_base ("5050422450443414252030234161450453214063666050554216601312032162510626626621233550541413260", 7)
assert ("test set str 5", one.item [7] = 0x8134b7f7 and one.item [6] = 0x8d570cbf and one.item [5] = 0xeb5f7c66 and one.item [4] = 0x7aa64334 and one.item [3] = 0xbb6cd783 and one.item [2] = 0x22792988 and one.item [1] = 0x6ec0f7ac and one.item [0] = 0x4438ad87 and one.count = 8)
end
test_set_str_6
local
one: INTEGER_X
do
create one.make_from_string_base ("2460223246331335544520513341363224654146046636101125253015521231163466226621435340120452343", 7)
assert ("test set str 6", one.item [0] = 0x8134b7f7 and one.item [1] = 0x8d570cbf and one.item [2] = 0xeb5f7c66 and one.item [3] = 0x7aa64334 and one.item [4] = 0xbb6cd783 and one.item [5] = 0x22792988 and one.item [6] = 0x6ec0f7ac and one.item [7] = 0x4438ad87 and one.count = 8)
end
test_set_str_7
local
one: INTEGER_X
do
create one.make_from_hex_string ("1")
assert ("test set str 7", one.item [0] = 0x1 and one.count = 1)
end
test_set_1
local
one: INTEGER_X
two: INTEGER_X
do
create one.make_from_hex_string ("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff")
assert ("test set 1 1", one.item [0] = 0xfcfdfeff and one.item [1] = 0xf8f9fafb and one.item [2] = 0xf4f5f6f7 and one.item [3] = 0xf0f1f2f3 and one.count = 4)
create two
two.copy (one)
assert ("test set 1 2", one ~ two)
assert ("test set 1 3", one.item [0] = 0xfcfdfeff and one.item [1] = 0xf8f9fafb and one.item [2] = 0xf4f5f6f7 and one.item [3] = 0xf0f1f2f3 and one.count = 4)
assert ("test set 1 4", two.item [0] = 0xfcfdfeff and two.item [1] = 0xf8f9fafb and two.item [2] = 0xf4f5f6f7 and two.item [3] = 0xf0f1f2f3 and two.count = 4)
end
test_set_from_integer_64_1
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_integer_64 (int.min_value)
assert ("test set from integer 64 1 1", one.fits_integer_64)
assert ("test set from integer 64 1 2", one.to_integer_64 = int.min_value)
end
test_set_from_integer_64_2
local
one: INTEGER_X
do
create one.make_from_integer_64 (-1)
assert ("test set from integer 64 2 1", one.fits_integer_64)
assert ("test set from integer 64 2 2", one.to_integer_64 = -1)
end
test_set_from_integer_64_3
local
one: INTEGER_X
int: INTEGER_64
do
create one.make_from_integer_64 (int.max_value)
assert ("test set from integer 64 3 1", one.fits_integer_64)
assert ("test set from integer 64 3 2", one.to_integer_64 = int.max_value)
end
test_set_from_integer_32_1
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_integer_32 (int.min_value)
assert ("test set from integer 32 1 1", one.fits_integer_32)
assert ("test set from integer 32 1 2", one.to_integer_32 = int.min_value)
end
test_set_from_integer_32_2
local
one: INTEGER_X
do
create one.make_from_integer_32 (-1)
assert ("test set from integer 32 2 1", one.fits_integer_32)
assert ("test set from integer 32 2 2", one.to_integer_32 = -1)
end
test_set_from_integer_32_3
local
one: INTEGER_X
int: INTEGER_32
do
create one.make_from_integer_32 (int.max_value)
assert ("test set from integer 32 3 1", one.fits_integer_32)
assert ("test set from integer 32 3 2", one.to_integer_32 = int.max_value)
end
test_set_from_integer_16_1
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_integer_16 (int.min_value)
assert ("test set from integer 16 1 1", one.fits_integer_16)
assert ("test set from integer 16 1 2", one.to_integer_16 = int.min_value)
end
test_set_from_integer_16_2
local
one: INTEGER_X
do
create one.make_from_integer_16 (-1)
assert ("test set from integer 16 2 1", one.fits_integer_16)
assert ("test set from integer 16 2 2", one.to_integer_16 = -1)
end
test_set_from_integer_16_3
local
one: INTEGER_X
int: INTEGER_16
do
create one.make_from_integer_16 (int.max_value)
assert ("test set from integer 16 3 1", one.fits_integer_16)
assert ("test set from integer 16 3 2", one.to_integer_16 = int.max_value)
end
test_set_from_integer_8_1
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_integer_8 (int.min_value)
assert ("test set from integer 8 1 1", one.fits_integer_8)
assert ("test set from integer 8 1 2", one.to_integer_8 = int.min_value)
end
test_set_from_integer_8_2
local
one: INTEGER_X
do
create one.make_from_integer_8 (-1)
assert ("test set from integer 8 2 1", one.fits_integer_8)
assert ("test set from integer 8 2 2", one.to_integer_8 = -1)
end
test_set_from_integer_8_3
local
one: INTEGER_X
int: INTEGER_8
do
create one.make_from_integer_8 (int.max_value)
assert ("test set from integer 8 3 1", one.fits_integer_8)
assert ("test set from integer 8 3 2", one.to_integer_8 = int.max_value)
end
end

View File

@@ -1,32 +0,0 @@
note
description: "Summary description for {INTEGER_X_DIVISION}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
class
TEST_INTEGER_X_DIVISION
inherit
EQA_TEST_SET
INTEGER_X_DIVISION
undefine
default_create
end
feature
test_tdiv_q_1
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("-014fae42 56ad0915 2a7b2b66 fe887b52 e06ffa35 d359cd33 14156137 564096ef 90eb9c01 9ee82ea9")
create three.make_from_hex_string ("474c50aa 62d128fa b3b99224 0846a26e f58bf664")
create expected.make_from_hex_string ("-04b547f5 df885395 a422bbce 998d2570 9019af3a")
tdiv_q (one, two, three)
assert ("test tdiv q 1", one ~ expected)
end
end

View File

@@ -1,92 +0,0 @@
note
description: "Summary description for {TEST_INTEGER_X_GCD}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
class
TEST_INTEGER_X_GCD
inherit
EQA_TEST_SET
INTEGER_X_GCD
undefine
default_create
end
feature
test_gcd_1
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("75bd a09fab66 22ddfba5 6141c975")
create three.make_from_hex_string ("db7c 2abf62e3 5e668076 bead208b")
create expected.make_from_integer (1)
gcd (one, two, three)
assert ("test gcd 1", one ~ expected)
end
test_gcd_2
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("1f3e 0565ad11 0943df37 0be1f345")
create three.make_from_hex_string ("db7c 2abf62e3 5e668076 bead208b")
create expected.make_from_integer (1)
gcd (one, two, three)
assert ("test gcd 2", one ~ expected)
end
test_gcd_3
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("b900 97df5038 7e2f36a6 2ed3a8f4")
create three.make_from_hex_string ("db7c 2abf62e3 5e668076 bead208b")
create expected.make_from_integer (1)
gcd (one, two, three)
assert ("test gcd 3", one ~ expected)
end
test_gcd_4
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("905a 1c3f4cec 73b96934 ac732c70")
create three.make_from_hex_string ("db7c 2abf62e3 5e668076 bead208b")
create expected.make_from_integer (1)
gcd (one, two, three)
assert ("test gcd 4", one ~ expected)
end
test_gcd_5
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("1ffb369d437c5d32145fd9a1223ab960e362ffd5545b675f7ead44be35a12c61699c05dd8ecafb643b9feb6912fb6df6c57eca1c0e4ff132ed5d77d6bb5d96a4395")
create three.make_from_hex_string ("1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
create expected.make_from_hex_string ("1")
gcd (one, two, three)
assert ("test gcd 5", one ~ expected)
end
end

View File

@@ -1,89 +0,0 @@
note
description: "Summary description for {TEST_INTEGER_X_IO}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
class
TEST_INTEGER_X_IO
inherit
EQA_TEST_SET
INTEGER_X_IO
undefine
default_create
end
feature
test_export_1
local
one: INTEGER_X
two: SPECIAL [NATURAL_8]
junk: TUPLE [junk: INTEGER]
do
create junk
create one.make_limbs (6)
one.item [0] := 0x7393172a
one.item [1] := 0xe93d7e11
one.item [2] := 0x2e409f96
one.item [3] := 0x6bc1bee2
one.count := 4
create two.make_filled (0, 16)
output (two, 0, junk, 1, 1, -1, one)
assert ("test output 1 1", two [0] = 0x6b and two [1] = 0xc1 and two [2] = 0xbe and two [3] = 0xe2)
assert ("test output 1 2", two [4] = 0x2e and two [5] = 0x40 and two [6] = 0x9f and two [7] = 0x96)
assert ("test output 1 3", two [8] = 0xe9 and two [9] = 0x3d and two [10] = 0x7e and two [11] = 0x11)
assert ("test output 1 4", two [12] = 0x73 and two [13] = 0x93 and two [14] = 0x17 and two [15] = 0x2a)
end
test_import_1
local
one: INTEGER_X
two: SPECIAL [NATURAL_8]
do
create two.make_filled (0, 16)
two [0] := 0x6b two [1] := 0xc1 two [2] := 0xbe two [3] := 0xe2
two [4] := 0x2e two [5] := 0x40 two [6] := 0x9f two [7] := 0x96
two [8] := 0xe9 two [9] := 0x3d two [10] := 0x7e two [11] := 0x11
two [12] := 0x73 two [13] := 0x93 two [14] := 0x17 two [15] := 0x2a
create one
input (one, 16, 1, 1, -1, two, 0)
assert ("test input 1", one.item [0] = 0x7393172a and one.item [1] = 0xe93d7e11 and one.item [2] = 0x2e409f96 and one.item [3] = 0x6bc1bee2)
end
test_export_2
local
one: INTEGER_X
two: SPECIAL [NATURAL_8]
junk: TUPLE [junk: INTEGER]
do
create junk
create one.make_limbs (6)
one.item [0] := 0x0c0d0e0f
one.item [1] := 0x08090a0b
one.item [2] := 0x04050607
one.item [3] := 0x00010203
one.count := 4
create two.make_filled (0, 16)
output (two, 0, junk, 1, 1, -1, one)
assert ("test export 1 1", two [0] = 0x01 and two [1] = 0x02 and two [2] = 0x03 and two [3] = 0x04)
assert ("test export 1 2", two [4] = 0x05 and two [5] = 0x06 and two [6] = 0x07 and two [7] = 0x08)
assert ("test export 1 3", two [8] = 0x09 and two [9] = 0x0a and two [10] = 0x0b and two [11] = 0x0c)
assert ("test export 1 4", two [12] = 0x0d and two [13] = 0x0e and two [14] = 0x0f and two [15] = 0x00)
end
test_import_2
local
one: INTEGER_X
two: SPECIAL [NATURAL_8]
do
create two.make_filled (0, 16)
two [0] := 0x01 two [1] := 0x02 two [2] := 0x03 two [3] := 0x04
two [4] := 0x05 two [5] := 0x06 two [6] := 0x07 two [7] := 0x08
two [8] := 0x09 two [9] := 0x0a two [10] := 0x0b two [11] := 0x0c
two [12] := 0x0d two [13] := 0x0e two [14] := 0x0f two [15] := 0x0
create one
input (one, 16, 1, 1, -1, two, 0)
assert ("test import 2", one.item [0] = 0x0d0e0f00 and one.item [1] = 0x090a0b0c and one.item [2] = 0x05060708 and one.item [3] = 0x01020304)
end
end

View File

@@ -1,126 +0,0 @@
note
description: "Summary description for {TEST_INTEGER_X_LOGIC}."
author: ""
date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
revision: "$Revision: 87787 $"
class
TEST_INTEGER_X_LOGIC
inherit
EQA_TEST_SET
INTEGER_X_LOGIC
undefine
default_create
end
feature
test_xor_1
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("7253bba0 7253bba0 7253bba0 7253bba0 7253bba0")
create three.make_from_hex_string ("5fc2780a 6f778235 9540faf2 7bc9cdab cb929ddd")
create expected.make_from_hex_string ("2d91c3aa 1d243995 e7134152 099a760b b9c1267d")
bit_xor (one, two, three)
assert ("test xor 1", one ~ expected)
end
test_xor_lshift_1
local
one: INTEGER_X
two: INTEGER_X
three: INTEGER_X
expected: INTEGER_X
do
create one
create two.make_from_hex_string ("7253bba0 7253bba0 7253bba0 7253bba0 7253bba0")
create three.make_from_hex_string ("5fc2780a 6f778235 9540faf2 7bc9cdab cb929ddd")
create expected.make_from_hex_string ("5fc2 780a6f77 f0662ee0 88a1c069 bff87032 ef8ebba0 7253bba0")
bit_xor_lshift (one, two, three, 48)
assert ("test xor lshift 1", one ~ expected)
end
test_walking_xor_1
local
i: INTEGER
ones: INTEGER_X
zero: INTEGER_X
cursor: INTEGER_X
xored: INTEGER_X
j: INTEGER
do
create zero
create ones.make_from_hex_string ("ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff")
from
i := 0
until
i >= 256
loop
cursor := zero.bit_complement_value (i)
xored := cursor.bit_xor_value (ones)
from
j := 0
until
j >= 256
loop
assert ("test walking xor 1 iteration: " + i.out, (j /= i) = xored.bit_test (j))
j := j + 1
end
i := i + 1
end
end
test_walking_set_bit_1
local
i: INTEGER
j: INTEGER
zero: INTEGER_X
cursor: INTEGER_X
do
create zero.default_create
from
i := 0
until
i >= 256
loop
cursor := zero.set_bit_value (true, i)
from
j := 0
until
j >= 256
loop
assert ("test walking set bit 1 iteration: " + i.out, (j = i) = cursor.bit_test (j))
j := j + 1
end
i := i + 1
end
end
test_bit_clear_1
local
one: INTEGER_X
expected: INTEGER_X
do
create one.make_from_hex_string ("c 7ea29e73 e8b0ed09 f2d91bac ab1cd267 343dfdb2")
create expected.make_from_hex_string ("4 7ea29e73 e8b0ed09 f2d91bac ab1cd267 343dfdb2")
bit_clear (one, 0xa3)
assert ("test bit clear 1", one ~ expected)
end
test_bit_clear_2
local
one: INTEGER_X
expected: INTEGER_X
do
create one.make_from_hex_string ("ece1f5243f82d99431001da4573c")
one.set_bit (False, 226)
create expected.make_from_hex_string ("ece1f5243f82d99431001da4573c")
assert ("test bit clear 2", one ~ expected)
end
end

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