AMiLDA FORUM

You are not logged in.

Announcement

### Our Homepage is down at the moment...work in progress !! ###

#1 2006-12-12 20:54:58

Pieter
New member
Netherlands
From: Groningen
Registered: 2006-12-11
Last visit: 2008-05-10
Posts: 3

Adding functions to GoAhead

First read the README in the goahead-2.1.8/LINUX directory to fix yourself a working copy. You can add a function to aspFunctions.c and it's definition to aspFunctions.h. Also add a line in main.c to link the function to ASP interpreter.

Common pitfalls when scripting:
- Make sure your form-item names do not conflict with variable names in your script. This causes trouble (I haven't exactly found out why, but I don't care, just don't do this smile).
- Don't get seduced by the wonderful things shell-scripting promises. I've spend more than a day on making a nice small interface for AMiLDA entirely written for /bin/sh, using mostly sed. Haserl did the HTML-embedding and BusyBox httpd did the serving. It worked, but extremely slow. I also have done some benchmarks with the Lua language (which Haserl also supports, development version only (0.9.13)), but this was very slow as well. It may work for routers running OpenWrt (have more resources, X-wrt (webinterface for OpenWrt) uses shell scripting), but for ADM5120 routers: stick with GoAhead and make your own functions in plain C.

Copy/paste from GoAhead docs:
The server-side JavaScript interpreter supports:
    * Case sensitivity
    * White space
    * Semicolons
    * Comments
    * Identifiers
    * Data types including numbers, booleans, strings with backslash characters
    * Full expressions
    * If/else, for, return
    * Global function calls
It does NOT support:
    * Arrays
    * Objects
    * Labeled statements
    * Control flow statements including: break, case, continue, default, do/while, export, for/in, function, import, switch, var, while, with
    * Regular expressions

For the developers/admins:
It might be an idea to start a Wiki for all information management?
I'm currently busy on my own rewrite (mostly the scripts, not all the C functions) and I'd like to contribute. Where can I apply?

Last edited by Pieter (2006-12-12 20:56:35)

Offline

 

#2 2006-12-12 22:41:49

sergioag
Developer
Peru
From: Lima
Registered: 2006-02-16
Last visit: 2011-08-15
Posts: 166
Website

Re: Adding functions to GoAhead

Hi

There are good points you mentions. GoAhead appears the best choice. I have written all intensive parts in C, while leaving only the work-flow part in server-side JavaScript. That ensures a good performance, while being powerful enough to build something good.

If you want to contribute, just send me the files via email or add a ticket to BugZilla at bugs.amilda.org.

Regards,

Sergio

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB