C Cod - Documentation
Compile C on Demand

Installation

Note that the configure/make combo is simpilfied. It may not work for all OS's. Help on making this more universal would be appriciated.

Linux Machines:

Download the source package. Extract the tarball and configure. CSP will be all ready for use.

./configure
make install

Windows Machines:

Download and execute the latest setup EXE package for Win32. This will include the MingW development environment along with C Cod and CSP. IIS will be all set to use CSP.


Program Usage

Type "ccod --help" to display this information.

Usage: ccod [options] -- file [file options]
       ccod file [file options]

Options:
  -v, --version     Display version information
  -h, --help        Display this information
  -c, --cc          Assigns the compiler (gcc is used as the default)
  -x, --clean       Removes the cached program, recompiles, and runs.
  -z, --clean-only  Removes the cached program and does not compile or run.
  -o, --options     Compiler specific options.

Examples:
  ccod source.c foo bar       # Runs source.c.
  ccod -c g++ -- source.cpp   # Runs source.cpp using the g++ compiler.
  ccod -o -O2 -s -- source.c  # Runs source.c using the compiler options.


Pragma Options

To add a pragma, place it near the top of the source file. Example...

#!/usr/bin/ccod
<?
#pragma CCOD:options -O2
#pragma CCOD:library expat
#pragma CCOD:std c89

#include <expat.h>

printf("RAD\n");
?>
Pragmas can also defined as a comment style... //@pragma CCOD:std c89

Complete List of Options
  • CCOD:compiler
  • Choose the compiler application to use to compile the source file. (default : gcc)
  • CCOD:csp
  • Expose script to CSP interface. [yes/no] (default : no)
  • CCOD:directory
  • Set the default directory to execute the source file in.
  • CCOD:ignoreUploadError
  • Ignore errors relating to file uploads for CSP scripts. [yes/no] (default : no)
  • CCOD:library
  • Link a shared or static library.
  • CCOD:options
  • Adds custom compiler options to the existing options. (default : -I. -w -s)
  • CCOD:recompile
  • Always recompile the source prior to executing. [yes/no] (default : no)
  • CCOD:script
  • Maximum number of bytes allowed to be sent to a CSP page before displaying an error. [number] (default : 50KB)
  • CCOD:sessions
  • Turn CSP Session on or off [yes/no] (default : yes)
  • CCOD:source
  • Add a source file.
  • CCOD:std
  • Choose what standard of C is used. Check your GNU C documentation for more information. (default : c99)
  • CCOD:upload
  • Maximum number of bytes allowed to be sent to a CSP page before displaying an error. [number] (default : 50KB)


    CSP Functions

    [Response Object]
    Response.SetBuffer(int);
    Response.GetBuffer();
    Response.SetContentType(const char *contype);
    Response.GetContentType();
    Response.SetStatus(const char *status);
    Response.GetStatus();
    Response.AddHeader(const char *header, const char *value);
    Response.Flush();
    Response.Write(const char *fmt, ...);
    Response.Clear();
    Response.End();
    Response.Redirect(const char *location);
    Response.BinaryWrite(const unsigned char *buf, int bufsize);
    
    [Response.Cookies Object]
    Response.Cookies.Set(const char *key, const char *value);
    Response.Cookies.Get(const char *key);
    Response.Cookies.Exists(const char *key);		
    Response.Cookies.GetHasKeys(const char *key);
    Response.Cookies.SetKey(const char *key, const char *skey, const char *value);
    Response.Cookies.GetKey(const char *key, const char *skey);
    Response.Cookies.SetExpires(const char *key, time_t date);
    Response.Cookies.GetExpires(const char *key);
    Response.Cookies.SetDomain(const char *key, const char *domain);
    Response.Cookies.GetDomain(const char *key);
    Response.Cookies.SetPath(const char *key, const char *path);
    Response.Cookies.GetPath(const char *key);
    Response.Cookies.SetSecure(const char *key, int secure);
    Response.Cookies.GetSecure(const char *key);
    
    [Request Object]
    Request.GetTotalBytes();
    Request.BinaryRead(void *buf, int size);
    Request.Get(const char *key);
    Request.Exists(const char *key);
    
    [Request.QueryString Object]
    Request.QueryString.Count;
    Request.QueryString.Get(const char *key);
    Request.QueryString.Key(int index);
    Request.QueryString.Value(int index);
    Request.QueryString.Exists(const char *key);
    
    [Request.Form Object]
    Request.Form.Count;
    Request.Form.Get(const char *key);
    Request.Form.Key(int index);
    Request.Form.Value(int index);
    Request.Form.Exists(const char *key);
    
    [Request.ServerVariables Object]
    Request.ServerVariables.GetCount();
    Request.ServerVariables.Count;
    Request.ServerVariables.Get(const char *key);
    Request.ServerVariables.Key(int index);
    Request.ServerVariables.Value(int index);
    Request.ServerVariables.Exists(const char *key);
    
    [Request.Cookies Object]
    Request.Cookies.Get(const char *key);
    Request.Cookies.Exists(const char *key);		
    Request.Cookies.GetHasKeys(const char *key);
    Request.Cookies.GetKey(const char *key, const char *skey);
    
    [Server Object]
    Server.URLEncode(const char *str);
    Server.HTMLEncode(const char *str);
    Server.MapPath(const char *str);
    Server.GetScriptTimeout();
    Server.SetScriptTimeout(int NumSeconds);
    
    [Session Object]
    Session.Abandon();
    Session.SetTimeout(int minutes);
    Session.GetTimeout();
    Session.GetSessionID();
    Session.GetCount();
    Session.Get(const char *key);
    Session.Set(const char *key, const char *value);
    Session.Key(int index);
    Session.Value(int index);
    Session.Exists(const char *key);
    Session.Remove(const char *key);
    Session.RemoveAll();
    
    [Session.Contents Object]
    Session.Contents.GetCount();
    Session.Contents.Get(const char *key);
    Session.Contents.Set(const char *key, const char *value);
    Session.Contents.Key(int index);
    Session.Contents.Value(int index);
    Session.Contents.Exists(const char *key);
    Session.Contents.Remove(const char *key);
    Session.Contents.RemoveAll();
    


    Copyright @ 2004-2008 Joshua J Baker