1
0
forked from GitHub/gf-core
Commit Graph

249 Commits

Author SHA1 Message Date
hallgren
df4183d92e PGFService.hs: add web API function "abstrjson"
Abstract syntax trees are represented as strings in the web API. To make them
easier to manipulate in JavaScript, the new function converts them to JSON.

To support structural editing, the nodes are numbered in the same way as in
the bracketed string created when linearizing an abstract syntax tree.

Example: "Pred (That Fish) Fresh" is converted to

	{fun:"Pred",fid:3,
	 children:[{fun:"That",fid:1,
		    children:[{fun:"Fish",fid:0}]},
		   {fun:"Fresh",fid:2}]}
2012-04-02 15:42:43 +00:00
hallgren
c234e58a6a PGF run-time library: function names in BracketedString (experimental)
+ Make room for function names in the BracketedString data structure.
+ Fill in function names when linearizing an abstract syntax tree to a
  BracketedString.
+ Fill in wildCId when it is not obvious what the function is.
+ Function bracketedLinearize: for compatibility with the other linearization
  functions, return Leaf "" instead of error "cannot linearize".
+ Export flattenBracketedString from module PGF.
+ PGFServce: make function names available in the JSON representation of
  BracketedString.
2012-03-18 20:12:26 +00:00
hallgren
661d7edfe7 PGFService.hs: command=browse can now produce output in JSON format.
To get JSON output, add the parameter format=json. The JSON structure contains
the output from the function PGF.browse.
The default is format=html for backwards compatibility.
2012-03-16 13:55:19 +00:00
hallgren
7091ba131a PGFService.hs: add output format option to the commands abstrtree, parsetree and alignment
Supported output formats: gv, png, svg.
2012-03-08 11:25:15 +00:00
hallgren
139e90b2e1 gf-server.cabal: always build the fastcgi module (pgf-server), lower version requirement on the cgi package
+ The flag fastcgi is removed: building the fastcgi is the main purpose of
  this cabal file again.
+ pgf-http superseded by gf-server, but is still available as an option
+ Require cgi>=3001.7.3 instead of cgi>=3001.8.0.
2012-03-05 16:38:54 +00:00
hallgren
cc2299dde7 PGFService.hs bug fix: pattern match failure in doParse
doParse was missing a branch for PGF.ParseIncomplete.
Also introduced the operator .= to simply the code that builds JSON objects.
2012-02-29 16:21:34 +00:00
hallgren
9dbe4ba41a src/server/ContentService.hs: fix compilaton problem 2012-02-23 16:46:21 +00:00
hallgren
714e4d4975 pgf-http setup: update path to minibar 2011-10-18 15:35:30 +00:00
hallgren
99795c3035 pgf service: include the start category in grammar info 2011-10-18 14:31:40 +00:00
hallgren
b318509528 More functionality in "gf -server" mode
"gf -server" mode now includes PGF service and the services to support
example-based grammar writing. (But gf -server is not quite ready to replace
pgf-http yet...) 

Also bumped GF version number to 3.2.10-darcs
2011-10-10 16:16:16 +00:00
hallgren
be1830479f pgf-http: fix a bug that caused "+" to be treaded as " " in PGF service requests URLs.
This was a bug in my workaround for a bug in the httpd-shed package. It
made it impossible to use the glue token "&+" for Turkish input in the minibar,
for example.
2011-08-25 16:58:17 +00:00
hallgren
249ce61701 pgf-service: apply the OpenMath LaTeX function only when linearizing to a
concrete language whose name ends with LaTeX.
This change also avoids duplicating output and, in addition to the linearize
command, applies the transfer also when using the linearizeAll command.
2011-08-24 09:37:55 +00:00
hallgren
42ccbf2d8e pgf-service: add Jordis transfer function for OpenMath LaTeX output 2011-08-23 16:25:00 +00:00
hallgren
51994104de pgf service: external service hook: always format the output as a JSON string 2011-08-22 16:10:56 +00:00
hallgren
3e2f768072 pgf service: added a hook for external services
This is really reinventing CGI, people should learn how to write CGI scripts
instead...
TODO: better handling of temporary files
2011-08-22 15:34:44 +00:00
hallgren
b80696f958 gf-server: make pgf-service work the Apache mod_fastcgi
pgf-service now appears to works with Apache mod_fastcgi (under Mac OS X) in
addition to lighttpd.

One difference appears to be that while lighttpd passes the name of the PGF
file in the SCRIPT_FILENAME variable, Apache passes it in PATH_TRANSLATED.
But perhaps this depends on exactly how the fastcgi service is configured.
The following is what I added to the Apache configuration file to test this:

	<Directory /Library/WebServer/Documents/fcgi-bin>
	  SetHandler fastcgi-script
	  Options +ExecCGI
	</Directory>
	Action pgf-service /fcgi-bin/pgf-service
	AddHandler pgf-service .pgf
2011-06-21 15:49:31 +00:00
hallgren
4b86179f12 gf-server: enable -rtsopts when compiling with ghc>=7.0 2011-06-21 15:45:13 +00:00
hallgren
1780b14d3a gf-server.cabal: a separate flag for the content service
* Use cabal install -ffastcgi to compile the fastcgi server.
  * Use cabal install -fcontent to compile the content service (off by default,
    currently broken)
  * Use both flag to compile both.
2011-06-21 15:38:57 +00:00
krasimir
93dcac2819 the user can now upload their own grammars in the editor 2011-03-07 21:05:29 +00:00
hallgren
b8c1a09896 The name of the fastcgi executable has changed back to pgf-service 2011-01-09 15:32:17 +00:00
krasimir
cdebaef7ef The GF editor now lets the user to upload his/her own grammars 2010-12-28 16:26:10 +00:00
hallgren
da4f5cf607 gf-server.cabal: changes to stop cabal from demanding hsql even when content-server is not going to be built 2010-12-23 17:02:13 +00:00
hallgren
0a52aaf81d PGF web service: make the generated index.html for pgf-http a bit more informative 2010-12-22 15:06:02 +00:00
hallgren
18338b0ee4 gf-server.cabal: update description of fastcgi flag 2010-12-22 15:05:10 +00:00
hallgren
a5b661700b gf-server.cabal: make hsql-mysql optional like fastcgi
content-service depends on hsql-mysql, which depends on a C library, so like
fastcgi, only compile it if you ask for it explicitly with -ffastcgi.
2010-12-22 14:59:49 +00:00
hallgren
5dd58dfca6 gf-server.cabal: Change the default for the flag fastcgi to False
If you want the fastcgi server, use cabal install -ffastcgi.

This is to avoid problems when you only want to compile pgf-http and the
fastcgi library fails to install, which it usually does, since it depends on
a C library which is not installed automatically with cabal.
2010-12-22 14:49:17 +00:00
hallgren
681c5d25dd PGF web service: Use Content-Type text/javascript from JSON output
The Content-Type used to be text/json, but this caused warning messages in
some web browers.
2010-12-22 14:47:35 +00:00
krasimir
9ae3a7b30d tweak gf-server.cabal 2010-12-22 12:32:13 +00:00
hallgren
c9d9db121a pgf-http now uses $datadir/www instead of ./www as the document root
Along with the changes to Setup.hs it should now be enough to do

	cabal install
	pgf-http
	open http://localhost:41296/

to run the PGF service locally and play with some example grammars in minibar.
2010-12-17 16:35:59 +00:00
hallgren
31c09c8846 RunHTTP.hs: remove hardcoded document root
The document root is now part of the arguments passed to runHTTP.
2010-12-17 16:33:54 +00:00
hallgren
72148feeb9 Install minibar and some example grammars along with pgf-http
Together with the changes to pgf-http, this should make it much easier to run
the PGF service and minibar locally.
2010-12-17 16:29:22 +00:00
hallgren
5fd4efd960 Split pgf-server into pgf-fcgi and pgf-http.
The dependency on the fastcgi package made pgf-server difficult to compile, so
it is now split into

  - pgf-fgci (main module in pgf-fcgi.hs), which is built only if fastcgi is
    already installed or if you turn on the fastcgi flag (e.g. by doing
    'cabal install -f fastcgi').

  - pgf-http (main module in pgf-http.hs) which is always built (and hopefully
    has no problematic dependencies.) 

The modules FastCGIUtils and PGFService no longer depend on fastcgi.
2010-11-26 14:30:51 +00:00
hallgren
9532a34a2a pgf-server: more useful JSON output from lineraizeAll
Example:

Request: http://www.grammaticalframework.org:41296/grammars/Quiz.pgf?command=linearizeAll&tree=Run+YouPl

Response: [{"to":"QuizEng","texts":["you run"]},
           {"to":"QuizSwe","texts":["ni l??per","ni springer"]}]

Compared to the old command linearize:

Request: http://www.grammaticalframework.org:41296/grammars/Quiz.pgf?command=linearize&tree=Run+YouPl'

Response: [{"to":"QuizEng","text":"you run"},
           {"to":"QuizSwe","text":"ni l??per"}]
2010-11-25 18:30:30 +00:00
aarne
62cfeef03e linearizeAll in PGFService 2010-11-24 21:17:29 +00:00
hallgren
d0efcc035c Make PGFService.hs compile again
+ PGFService.hs: add Nothing arguments in calls to PGF.parse_ and
  PGF.getPArseOutput
+ gf-server.cabal: mark content-server as not buildable, since required source
  files are missing.
2010-11-09 15:08:37 +00:00
krasimir
042790fdf6 the PGF service now can do both random and exhaustive generation. these functions now return both the generated tree and its linearization 2010-10-13 12:32:49 +00:00
krasimir
95733f0b1b the exhaustive/random generator now knows how to handle computable functions in the types 2010-10-11 17:18:28 +00:00
krasimir
be9ad26aea refactor the API for random generation again. Now PGF contains probabilities in the abstract syntax 2010-10-02 13:03:57 +00:00
krasimir
72f505d7df update PGFService to work after the extensions in the random generation API 2010-09-30 07:35:54 +00:00
hallgren
5e1f2c069f pgf-server HTTP mode: omit charset from ContentType for static files
When pfg-server servers a static file in HTTP mode, it is output as is, so
specifying charset="iso-8859-1" could be wrong. 

Note: the a charset can be specified with a meta tag in HTML files,
e.g. for files in UTF-8:

<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
2010-09-24 12:34:38 +00:00
hallgren
af8645a2f3 pgf-server HTTP mode: support the Accept-Language header
It is needed for the userLanguage field in the grammar info from pgf-server
2010-09-10 11:20:49 +00:00
hallgren
cff7dfcf7b pgf-server HTTP mode: workaround for bugs in the httpd-shed package that prevented the fridge and translate web apps from working
queryToArguments "?&input=bla+bla"
           returns [("&input","bla+bla")]
 but should return [("input","bla bla")]
2010-09-03 13:12:08 +00:00
hallgren
c5f0b31dbe pgf-server HTTP mode feature: return the contents of index.html when the URL refers to a directory 2010-09-02 14:10:07 +00:00
hallgren
c234222cd9 Bug fix: add missing error handler for statically served files in pgf-server HTTP mode 2010-09-02 13:54:16 +00:00
hallgren
ea67281820 Standalone HTTP version of pgf-server
pgf-server can now act as a standalone HTTP server. To activate this mode,
start it with

	pfg-server http

to use the default port number (41296), or give an explicit port number, e.g.,

	pgf-server http 8080

The HTTP server serves PGF files in the same way as the old FastCGI interface.
In addition, it also serves static files. The document root for static files
is the www subdirectory of the current directory where pgf-server is started.

In spite of these addition, backwards compatibility is maintaned. The old
FastCGI interface continues to work as before. (It is activated when
pgf-server is started without arguments.)
2010-09-01 14:08:52 +00:00
krasimir
9aa7c88c5a native representation for HOAS in PMCFG and incremental type checking of the parse forest 2010-08-09 10:10:08 +00:00
krasimir
b20821dfc3 more advanced complete function in the PGFService 2010-08-24 15:58:22 +00:00
krasimir
39e83436e2 bugfix in the PGF browser 2010-07-31 16:04:15 +00:00
krasimir
57ec23e630 the PGF service now generates samples of the syntax in the browsing information 2010-07-31 15:54:03 +00:00
krasimir
b8214aff83 fix: FastCGIUtils.outputHTML should do UTF8 encoding 2010-07-31 13:56:55 +00:00