Using EXTERN - PowerPoint PPT Presentation

About This Presentation
Title:

Using EXTERN

Description:

These functions can do anything you wish provided you can create the dll. ... Reading Weather information from the BBC weather website. ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 14
Provided by: iah
Category:
Tags: extern | bbc | using | weather

less

Transcript and Presenter's Notes

Title: Using EXTERN


1
Using EXTERN
  • Dave Doulton

2
Contents
  • What are EXTERN functions?
  • How do you use them?
  • How do you create them?
  • Examples of usage.

3
What are EXTERN Functions?
  • EXTERN and EXTERNS are two functions held in the
    extern.dll (Dynamically Linked Library).
  • These functions can do anything you wish provided
    you can create the dll.
  • Your dll is placed in the SIR directory in place
    of the supplied version.
  • Note they can both take string or numeric
    parameters which can do different things but only
    return a numeric from EXTERN and a string from
    EXTERNS

4
How do you use them?
  • EXTERN
  • num EXTERN ( X )
  • Invokes a user-supplied external function from
    the EXTERN dll.
  • The function can take a numeric or string
    parameter and calls a different user function for
    each case.
  • The extern.dll library supplied by SIR contains
    dummy functions which return zero.
  • EXTERNS
  • str EXTERNS ( X )
  • Invokes a user-supplied external function from
    the EXTERN dll.
  • The function can take a numeric or string
    parameter and calls a different user function for
    each case.
  • The extern.dll library supplied by SIR contains
    dummy functions which return blank (a zero length
    string).

5
How do you create them?
  • To create the functions you can used the supplied
    template which can be found in the api/examples
    subdirectory of the directory where SIR is
    installed.

6
How do you create them?
  • //
  • // Skeleton of user defined EXTERN function.
  • //
  • // Use this to build your own extern.dll to use
    the PQL EXTERN and EXTERNS functions.
  • // See the examples in the API directory.
  • //
  • ifndef __StdCall
  • ifdef _WIN32
  • define __StdCall __stdcall
  • else
  • define __StdCall
  • endif
  • endif
  • //
  • // The sirdbms executable links to these
    functions as defined
  • //
  • const char __StdCall SIRExtern1 (char
    buffer)
  • double __StdCall SIRExtern2 (char buffer)

7
How do you create them?
  • //
  • // PQL Function strEXTERNS(string)
  • //
  • const char __StdCall SIRExtern1 (char buffer)
  • return ""
  • //
  • // PQL Function numEXTERN(string)
  • //
  • double __StdCall SIRExtern2 (char buffer)
  • return 0
  • //
  • // PQL Function strEXTERNS(num)
  • //
  • const char __StdCall SIRExtern3 (double num)

8
Examples of usage
  • David Baxter has made a dll that reads web pages.
  • Note not all web pages can be read. It is a
    matter of trial and error to check if the pages
    you want are readable.
  • The web addresses are entered without the http//
    in the version I am using and that will be
    available on the SUG website.

9
Examples of usage
  • I have 5 example programs
  • Writing the contents of a web page to a file.
  • Reading Share prices from the msn money website.
  • Reading Weather information from the BBC weather
    website.
  • Reading Train Live Running from the National rail
    website.
  • Reading Formula 1 results from F1 web pages

10
Examples of usage
  • The descriptions of the extern functionality in
    this dll are as follows
  • numEXTERN(string)
  • It takes a url filename and returns a socket id.
    Its quick and dirty and just goes to port 80
  • strEXTERNS(num)
  • Num is the socket id from before and it returns a
    single character at a time from the http server.
  • numEXTERN(num)
  • Num is the socket id from before and cleans up.

11
Examples of usage
  • The example programs use a subprocedure to read
    from the web server up to the next .
  • This usually results in fairly small chunks of
    text to analyse.
  • The lines are searched for predetermined text
    that allows the extraction of the required data.

12
Examples of usage
  • See the example programs.

13
Any Questions?
Write a Comment
User Comments (0)
About PowerShow.com