home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / fpl-v115.lha / FPL / src / FPL.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-18  |  23.1 KB  |  618 lines

  1. #ifndef FPL_H
  2. #define FPL_H
  3. /*
  4. **   $Filename: libraries/FPL.h $
  5. **   $Release: 10.0 $
  6. **   $Date: 1994/18/11 12:48:56 $
  7. **
  8. **   (C) Copyright 1992, 1993 by FrexxWare
  9. **       All Rights Reserved
  10. */
  11.  
  12. /************************************************************************
  13.  *                                                                      *
  14.  * fpl.library - A shared library interpreting script langauge.         *
  15.  * Copyright (C) 1992-1994 FrexxWare                                    *
  16.  * Author: Daniel Stenberg                                              *
  17.  *                                                                      *
  18.  * This program is free software; you may redistribute for non          *
  19.  * commercial purposes only. Commercial programs must have a written    *
  20.  * permission from the author to use FPL. FPL is *NOT* public domain!   *
  21.  * Any provided source code is only for reference and for assurance     *
  22.  * that users should be able to compile FPL on any operating system     *
  23.  * he/she wants to use it in!                                           *
  24.  *                                                                      *
  25.  * You may not change, resource, patch files or in any way reverse      *
  26.  * engineer anything in the FPL package.                                *
  27.  *                                                                      *
  28.  * This program is distributed in the hope that it will be useful,      *
  29.  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
  30.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                 *
  31.  *                                                                      *
  32.  * Daniel Stenberg                                                      *
  33.  * Ankdammsgatan 36, 4tr                                                *
  34.  * S-171 43 Solna                                                       *
  35.  * Sweden                                                               *
  36.  *                                                                      *
  37.  * FidoNet 2:201/328    email:dast@sth.frontec.se                       *
  38.  *                                                                      *
  39.  ************************************************************************/
  40.  
  41. /*
  42.  *  OBSOLETE RETURN CODES! USE THE NEW 'FPLERR_*' ONES!!!
  43.  */
  44.  
  45. #ifndef OUTDATE_OLD
  46.  
  47. enum {
  48.   FPL_COULDNT_OPEN_DOS = 2,
  49.   FPL_DIVISION_BY_ZERO,
  50.   FPL_ILLEGAL_ANCHOR,
  51.   FPL_ILLEGAL_ARRAY,
  52.   FPL_ILLEGAL_ASSIGN,
  53.   FPL_ILLEGAL_BREAK,
  54.   FPL_ILLEGAL_CONDOP,
  55.   FPL_ILLEGAL_CONTINUE,
  56.   FPL_ILLEGAL_DECLARE,
  57.   FPL_ILLEGAL_PARAMETER,
  58.   FPL_ILLEGAL_PREOPERATION,
  59.   FPL_ILLEGAL_PROTOTYPE,
  60.   FPL_ILLEGAL_RESIZE,
  61.   FPL_ILLEGAL_STATEMENT,
  62.   FPL_ILLEGAL_VARIABLE,
  63.   FPL_INTERNAL_ERROR,
  64.   FPL_INSIDE_NOT_FOUND,
  65.   FPL_MISSING_APOSTROPHE,
  66.   FPL_MISSING_ARGUMENT,
  67.   FPL_MISSING_BRACE,
  68.   FPL_MISSING_BRACKET,
  69.   FPL_MISSING_OPERAND,
  70.   FPL_MISSING_PARENTHESES,
  71.   FPL_MISSING_SEMICOLON,
  72.   FPL_NO_ACTION,
  73.   FPL_OPEN_ERROR,
  74.   FPL_OUT_OF_MEMORY,
  75.   FPL_OUT_OF_REACH,
  76.   FPL_OUT_OF_STACK,
  77.   FPL_PROGRAM_STOPPED,
  78.   FPL_READONLY_VIOLATE,
  79.   FPL_SYNTAX_ERROR,
  80.   FPL_UNBALANCED_COMMENT,
  81.   FPL_UNEXPECTED_END,
  82.   FPL_UNMATCHED_BRACE,
  83.   FPL_IDENTIFIER_NOT_FOUND,
  84.   FPL_IDENTIFIER_USED,
  85.  
  86.   FPL_UNKNOWN_ERROR /* this or higher is unknown error codes! */
  87.  
  88. };
  89.  
  90. #endif
  91.  
  92. /***** ALL BY FPL SUPPLIED, IMPLEMENTED AND SUPPORTED RETURN CODES: ******/
  93. typedef enum {
  94.   FPL_OK,
  95.   FPL_EXIT_OK,         /* no error, the program stated simply exit() */
  96.   FPLERR_COULDNT_OPEN_DOS, /* NOT USED */
  97.   FPLERR_DIVISION_BY_ZERO,
  98.   FPLERR_ILLEGAL_ANCHOR,
  99.   FPLERR_ILLEGAL_ARRAY,
  100.   FPLERR_ILLEGAL_ASSIGN,
  101.   FPLERR_ILLEGAL_BREAK,
  102.   FPLERR_ILLEGAL_CONDOP,
  103.   FPLERR_ILLEGAL_CONTINUE,
  104.   FPLERR_ILLEGAL_DECLARE,
  105.   FPLERR_ILLEGAL_PARAMETER,
  106.   FPLERR_ILLEGAL_PREOPERATION,
  107.   FPLERR_ILLEGAL_PROTOTYPE,
  108.   FPLERR_ILLEGAL_RESIZE,
  109.   FPLERR_ILLEGAL_STATEMENT,
  110.   FPLERR_ILLEGAL_VARIABLE,
  111.   FPLERR_INTERNAL_ERROR,
  112.   FPLERR_INSIDE_NOT_FOUND,
  113.   FPLERR_MISSING_APOSTROPHE,
  114.   FPLERR_MISSING_ARGUMENT,
  115.   FPLERR_MISSING_BRACE,
  116.   FPLERR_MISSING_BRACKET,
  117.   FPLERR_MISSING_OPERAND,
  118.   FPLERR_MISSING_PARENTHESES,
  119.   FPLERR_MISSING_SEMICOLON,
  120.   FPLERR_NO_ACTION,
  121.   FPLERR_OPEN_ERROR,
  122.   FPLERR_OUT_OF_MEMORY,
  123.   FPLERR_OUT_OF_REACH,
  124.   FPLERR_OUT_OF_STACK,
  125.   FPLERR_PROGRAM_STOPPED,
  126.   FPLERR_READONLY_VIOLATE,
  127.   FPLERR_SYNTAX_ERROR,
  128.   FPLERR_UNBALANCED_COMMENT,
  129.   FPLERR_UNEXPECTED_END,
  130.   FPLERR_UNMATCHED_BRACE,
  131.   FPLERR_IDENTIFIER_NOT_FOUND,
  132.   FPLERR_IDENTIFIER_USED,
  133.  
  134.   FPLERR_MISSING_COLON, /* new from version 7 */
  135.   FPLERR_MISSING_WHILE, /* new from version 7 */
  136.  
  137.   /* NEW ONES FROM V11: */
  138.  
  139.   FPLERR_ILLEGAL_CASE,
  140.   FPLERR_ILLEGAL_DEFAULT,
  141.   FPLERR_UNEXPECTED_INT_STATEMENT,
  142.   FPLERR_UNEXPECTED_STRING_STATEMENT,
  143.   FPLERR_STRING_INDEX,
  144.   FPLERR_ILLEGAL_REFERENCE,
  145.   FPLERR_TOO_MANY_PARAMETERS,
  146.  
  147.   FPLERR_UNKNOWN_ERROR /* this or higher is unknown error codes! */
  148.  
  149.   } ReturnCode;
  150.  
  151. /*********************************************************************
  152.  *
  153.  * Parameter and return type defines:
  154.  *
  155.  */
  156.   
  157. #define FPL_STRVARARG     'C' /* as in 'C'haracter variable */
  158. #define FPL_INTVARARG     'N' /* as in 'N'numeric variable */
  159. #define FPL_STRVARARG_OPT (FPL_STRVARARG^32)
  160. #define FPL_INTVARARG_OPT (FPL_INTVARARG^32)
  161. #define FPL_OPTVARARG     'R' /* as in 'R'eference to C or N */
  162. #define FPL_STRARRAYVARARG 'B' /* string array reference */
  163. #define FPL_INTARRAYVARARG 'D' /* integer array reference */
  164. #define FPL_VOIDARG       'V' /* as in 'V'oid, no return values */
  165.  
  166. #define FPL_OPTARG        'A' /* like in 'A'll accepted, which then can
  167.                                  be any one of CNSI */
  168.  
  169. #define FPL_STRARG        'S' /* as in 'S'tring */
  170. #define FPL_INTARG        'I' /* as in 'I'nteger */
  171. #define FPL_OPTEXPRARG      'O' /* as in 'O'ptionally S or I */
  172. #define FPL_STRARG_OPT    (FPL_STRARG^32)
  173. #define FPL_INTARG_OPT    (FPL_INTARG^32)
  174. #define FPL_OPTARG_OPT    (FPL_OPTARG^32)
  175. #define FPL_ARGLIST       '>'
  176.  
  177. /*********************************************************************
  178.  * fplInit() and fplReset() tags:
  179.  ********************************************************************/
  180.  
  181. #define FPLTAG_END            0
  182. #define FPLTAG_DONE           0
  183. #define FPLSEND_DONE          0
  184. #define FPLSEND_END          0
  185. #define FPLREF_DONE          0
  186. #define FPLREF_END          0
  187. /* End of tag list defines! */
  188.  
  189. #define FPLTAG_INTERVAL       1 /* data is a function pointer */
  190. /* Define the interval function pointer! */
  191.  
  192. #define FPLTAG_ZERO_TERMINATE 2 /* obsolete tag from version 5*/
  193.  
  194. #define FPLTAG_STACK          3 /* data is size in bytes */
  195. /* Important only for the Amiga library version! Default startup size of the
  196.    library stack. */
  197.  
  198. #define FPLTAG_USERDATA       4 /* data is free to use to anything! */
  199. /* Userdata able to read anywhere with GetUserdata(): */
  200.  
  201. #define FPLTAG_FUNCDATA       FPLTAG_USERDATA /* data is free to use */
  202. /* Specifies private data to a specific function. */
  203.  
  204. #define FPLTAG_FUNCTION       5 /* data is a function pointer */
  205. /* fplAddFunction() tag only. function handler routine for this function. */
  206.  
  207. #define FPLTAG_MAXSTACK          6 /* OBSOLETE from version 9.5 */
  208.  
  209. #define FPLTAG_STACKLIMIT     7 /* data is size in bytes */
  210. /* (Amiga) Absolute maximum memory area used as stack by one single FPL
  211.    program. */
  212.  
  213. /* removed obsolete tag `FPLTAG_FREE' ! */
  214.  
  215. #define FPLTAG_INTERNAL_ALLOC 9 /* data is function pointer */
  216. /* To a "void *(*)(long)" (on Amiga, the parameter will be sent in d0
  217.    and *not* on the stack)! */
  218. #define FPLTAG_INTERNAL_DEALLOC 10 /* data is function pointer */
  219. /* To a "void (*)(void *, long);" (on Amiga, the parameters will be sent in
  220.    the registers a1 and d0 and *NOT* on the stack as all other functions do. */
  221.  
  222. #define FPLTAG_INTERPRET 11 /* data is a char pointer */
  223. /* To a fully FPL syntax statement to be interpreted instead of the
  224.    actual main function of the program that is about to get started. */
  225.  
  226. #define FPLTAG_STARTPOINT 12 /* data is a char pointer */
  227. /* To the alternative start position of this program. */
  228. #define FPLTAG_STARTLINE  13 /* data is integer */
  229. /* The line of the upper start point if not 1. */
  230.  
  231. #define FPLTAG_STOREGLOBALS 14 /* data is boolean */
  232. /* This enables/disables the FPL global symbol storage ability. */
  233.  
  234. #define FPLTAG_CACHEALLFILES 15 /* data is one of the defines below */
  235. /* Should FPL cache all files exporting functions? */
  236.  
  237. #define FPLTAG_CACHEFILE 16 /* data is one of the defines below */
  238. /* Should FPL cache this file. Default is FPLTAG_CACHEALLFILES or false. */
  239.  
  240. #define FPLCACHE_NONE    0 /* never cache */
  241. #define FPLCACHE_ALWAYS  1 /* always cache */
  242. #define FPLCACHE_EXPORTS 2 /* cache if symbols were exported */
  243.  
  244. #define FPLTAG_FILEID 17 /* data is a unique file identification 32-bit */
  245. /* This fileID is used by FPL. Associate this program with this fileID!
  246.    If you ever make a FPLSEND_FLUSHCACHEDFILES and this file is removed from
  247.    memory, FPL will use this when requesting the file from you!
  248.    If this file doesn't declare any `export' functions, if you never flushes
  249.    this file or if you don't allow saved export variables, this tag can be
  250.    ignored (FPL will then create a temporary fileID to use). */
  251.  
  252. #define FPLTAG_PROGNAME 18 /* data is char pointer to zero terminated name */
  253. /* When using fplExecuteScript(), FPL does not have a name for the program.
  254.    If you want anything but <unknown program> in a possible error report,
  255.    you should use this. fplEXecuteFile() automatically sets this tag, but
  256.    if you don't want the program to be named as the file name, use this tag
  257.    then too! */
  258.  
  259. #define FPLTAG_FILEGLOBALS 19 /* data is pointer to long */
  260. #define FPLTAG_ISCACHED FPLTAG_FILEGLOBALS
  261. /* Supply this tag with a pointer to a `long' and receive a zero (0) if no
  262.    global symbols was declared, or a non-zero (_not_ the number of symbols)
  263.    value if any global symbols were declared.
  264.  
  265.    If this leaves a non-zero value, it means that FPL has stored symbols
  266.    associated with this program's ID. If you do not want them, use the
  267.    {FPLSEND_FREEFILE, filename} tag to clean up. If you want to be able
  268.    to start the same program using the old global symbol values (and not
  269.    confusing the interpreter), use the same file name on next start.
  270.    */
  271.  
  272. #define FPLTAG_FILENAMEGET 20 /* data is boolean */
  273. /* This tag tells FPL that the program name is ok to use as file name to load
  274.    the program from after a flush. fplExecuteFile() uses this tag as default.
  275.    */
  276.  
  277. #define FPLTAG_MINSTACK 21 /* OBSOLETE from version 9.5 */
  278.  
  279. #define FPLTAG_LOCKUSED 22 /* data is boolean */
  280. /* (Amiga) This tag makes FPL to Lock() on the file currently executed with
  281.    fplExecuteFile() or a program exeuted with that function that declared
  282.    global data. */
  283.  
  284. /**** NEW FROM VERSION 5: ****/
  285.  
  286. #define FPLTAG_HASH_TABLE_SIZE 23 /* data is a long */
  287. /* This sets the hash table size. USE ONLY IN fplInit()!!! */
  288.  
  289. #define FPLTAG_NEWLINE_HOOK 24 /* data is a standard long (*)(void *); */
  290. /* Called after every newline character read. The argument is sent in register
  291.    A0 in the Amiga version. The argument is so far only the fplinit() return
  292.    code. This might be subject to change to next release!! If you intend to
  293.    use this, use caution! */
  294.  
  295. /**** NEW FROM VERSION 5.3: ****/
  296. #define FPLTAG_ALLFUNCTIONS 25 /* data is boolean */
  297. /* Enables the FPL_UNKNOWN_FUNCTION interface message. Whenever FPL finds a
  298.    function not recognized, it will still parse all arguments and call the
  299.    interface function. */
  300.  
  301. /**** NEW FROM VERSION 6: ****/
  302.  
  303. #define FPLTAG_STRING_RETURN 27 /* data is pointer to a char pointer */
  304. /* enables the top level FPL program to return a string to the calling
  305.    program in the pointer the data supplies a pointer to. NULL disables
  306.    the ability. The string should be freed using the brand new function
  307.    fplFreeString() */
  308.  
  309. /**** NEW FROM VERSION >6: ****/
  310. #define FPLTAG_NESTED_COMMENTS 28 /* data is boolean */
  311. /* This fplInit() tag makes FPL allow nested comments. Default is off. */
  312.  
  313. /**** NEW FROM VERSION 8: ****/
  314.  
  315. #define FPLTAG_REREAD_CHANGES 29 /* data is boolean */
  316. /* Alter 'reread' status of files */
  317.  
  318. #define FPLTAG_FLUSH_NOT_IN_USE 30 /* data is boolean */
  319. /* Alter 'flush' status of files */
  320.  
  321. /**** NEW FROM VERSION 9: ****/
  322.  
  323. #define FPLTAG_IDENTITY 31 /* data is pointer to a string */
  324. /* Set host process identification string */
  325.  
  326. #define FPLTAG_DEBUG 32 /* data is boolean */
  327. /* Make this execution use debug mode from the beginning! */
  328.  
  329. #define FPLTAG_KIDNAP_CACHED 33 /* data is boolean */
  330. /* Only useful when calling fplExecuteScript():
  331.    If this program get cached, then FPL will duplicate it to keep a fair
  332.    copy of it, making no troubles for the calling program to always
  333.    free the executing program after executions! */
  334.  
  335. #define FPLTAG_ERROR_BUFFER 34 /* data is char pointer */
  336. /* Set this pointer to point to a buffer with the minimum size of
  337.    FPL_ERRORMSG_LENGTH bytes. If any FPL error occures, the buffer will
  338.    hold the FPL error message. fplGetErrorMsg() will not be necessary
  339.    if this is used! */
  340.  
  341. /**** NEW FROM VERSION 10: ****/
  342.  
  343. #define FPLTAG_PREVENT_RUNNING_SAME 35 /* data is boolean */
  344. /* Executution of a cached program (already in memory) will abort immediately
  345.    with an OK return code! FPLTAG_REREAD_CHANGES is prioritized and will
  346.    override this tag.*/
  347.  
  348. /**** NEW FROM A FUTURE VERSION  (expected anyway): ****/
  349. #define FPLTAG_COMPILE 26
  350.  
  351. #define _FPL_DUMMY    100      /* ignore this */
  352.  
  353. /**********************************************************************
  354.  * Here follows the tags for the fplSend() function. New for V3.
  355.  *********************************************************************/
  356.  
  357. #define FPLSEND_STRING    (_FPL_DUMMY +1)
  358. /* Use this when returning a string from a user function. See FPLSEND_STRLEN */
  359.  
  360. #define FPLSEND_STRLEN  (_FPL_DUMMY +2)
  361. /* Specifies the length of the returned string. If this is -1, a strlen()
  362.    will be performed by FPL to find out the real length! */
  363.  
  364. #define FPLSEND_INT    (_FPL_DUMMY +3)
  365. /* You return an integer from the function. */
  366.  
  367. #define FPLSEND_GETRESULT (_FPL_DUMMY +4)
  368. /* You specify a pointer to a `long' to hold the result of the last interval
  369.    function call. */
  370.  
  371. #define FPLSEND_GETLINE (_FPL_DUMMY +5)
  372. /* You specify a pointer to a `long' to hold the number of the current line the
  373.    interpreter is working on. */
  374.  
  375. #define FPLSEND_GETRETURNCODE (_FPL_DUMMY +6)
  376. /* You specify a pointer to a `long'  to hold the value received by the last
  377.    return() or exit() call in the FPL program. */
  378.  
  379. #define FPLSEND_GETUSERDATA (_FPL_DUMMY +7)
  380. /* You specify a pointer to a `long'  to hold the userdata specified in the
  381.    `FPLTAG_USERDATA' tag's data field in the fplInit() call. */
  382.  
  383. #define FPLSEND_GETCOLUMN (_FPL_DUMMY +8)
  384. /* You specify a pointer to a `long'  to hold the number of the current column
  385.    the interpreter is working on. */
  386.  
  387. #define FPLSEND_FLUSHCACHE (_FPL_DUMMY +9)
  388. /* specify TRUE/FALSE wheather you want FPL to flush (empty) the internal
  389.    memory cache/queue. */
  390.  
  391. #define FPLSEND_FREEFILE (_FPL_DUMMY +10) /* data is a program name pointer */
  392. /* FPL frees all functions associated with the given program! */
  393.  
  394. #define FPLSEND_PROGRAMFILE FPLSEND_STRING
  395. /* Used when returning a program's file name to FPL. */
  396.  
  397. #define FPLSEND_PROGRAM (_FPL_DUMMY +11) /* data is pointer to an array */
  398. /* When using functions in different source files, this is one way to give
  399.    FPL information about where to find a certain function! */
  400.  
  401. #define FPLSEND_GETPROGNAME (_FPL_DUMMY +12)
  402. /* Get pointer to the last interpretated FPL program name. If any error has
  403.    occurred, this will be the failing program name! */
  404.  
  405. #define FPLSEND_CONFIRM (_FPL_DUMMY +13)
  406. /* Used to confirm the query from FPL. Currently, taht can only be
  407.    FPL_FLUSH_FILE. */
  408.  
  409. #define FPLSEND_FLUSHFILE (_FPL_DUMMY +14)
  410. /* Flush the file with the specified fileID. If no ID is specified, all unused
  411.    files will be flushed. */
  412.  
  413. #define FPLSEND_STEP (_FPL_DUMMY +15)
  414. /* Moves the current interpret position. Negative number is backwards and
  415.    positive forwards. */
  416.  
  417. #define FPLSEND_GETSTACKSIZE (_FPL_DUMMY + 16) /* data is pointer to long */
  418. /* (Amiga) Receive the current stack size! */
  419.  
  420. #define FPLSEND_GETSTACKUSED (_FPL_DUMMY + 17) /* data is pointer to long */
  421. /* (Amiga) Receive the current amount of stack used (this isn't an exact
  422.    figure) */
  423.  
  424. #define FPLSEND_SETPROGNAME (_FPL_DUMMY + 18) /* data is char pointer */
  425. /* This tag forces a new name to the current (executing) program.
  426.    See also FPLTAG_PROGNAME */
  427.  
  428. #define FPLSEND_SETFILENAMEGET (_FPL_DUMMY + 19) /* data is boolean */
  429. /* This tag sets or clears the same FPLTAG_FILENAMEGET option */
  430.  
  431. /**** NEW FOR VERSION 4: ****/
  432.  
  433. #define FPLSEND_GETSYMBOL_FUNCTIONS    (_FPL_DUMMY + 20)
  434. #define FPLSEND_GETSYMBOL_MYFUNCTIONS    (_FPL_DUMMY + 21)
  435. #define FPLSEND_GETSYMBOL_FPLFUNCTIONS    (_FPL_DUMMY + 22)
  436. #define FPLSEND_GETSYMBOL_VARIABLES    (_FPL_DUMMY + 23)
  437. #define FPLSEND_GETSYMBOL_CACHEDFILES    (_FPL_DUMMY + 24)
  438. #define FPLSEND_GETSYMBOL_FREE        (_FPL_DUMMY + 25)
  439. /* See FPL.guide for information and docs */
  440.  
  441. /**** NEW FOR VERSION 5: ****/
  442.  
  443. #define FPLSEND_GETPROG (_FPL_DUMMY + 26)
  444. /* Supply a pointer to a char pointer, and you'll get a pointer to the current
  445.    program. */
  446.  
  447. #define FPLSEND_GETINTERVAL (_FPL_DUMMY + 27)
  448. /* Supply a pointer to a function pointer, and you'll receive a pointer to the
  449.    specified interval function. */
  450.  
  451. #define FPLSEND_GETNEWLINE_HOOK (_FPL_DUMMY + 28)        /* OBSOLETE!!! */
  452.  
  453. #define FPLSEND_GETFUNCTION (_FPL_DUMMY + 29)
  454. /* Supply a pointer to a function pointer, and you'll receive a pointer to the
  455.    specified interface function. */
  456.  
  457. #define FPLSEND_GETSYMBOL_ALLVARIABLES (_FPL_DUMMY + 30)
  458. #define FPLSEND_GETSYMBOL_ALLFUNCTIONS (_FPL_DUMMY + 31)
  459. /* See FPL.guide for information */
  460.  
  461. /**** NEW FOR VERSION 5.3: ****/
  462. #define FPLSEND_GETVIRLINE (_FPL_DUMMY + 32)
  463. /* return the virtual line number in the long you send a pointer to!
  464.    NOTE: The virtual line number is most often the "real" line number of your
  465.    program. FPL counts every appearance of \x0a in the program and that makes
  466.    the VIRTUAL line number since that has nothing to do with how FPL really
  467.    counts the lines!
  468.    Future versions will be able to change this line number run-time, using the
  469.    #line - instruction!
  470.    */
  471.  
  472. #define FPLSEND_GETVIRFILE (_FPL_DUMMY + 33)
  473. /* return the virtual filename in the char pointer you send a pointer to!
  474.    NOTE: The virtual file name is most often the name of the current
  475.    executed program. 
  476.    Future versions will be able to change this line number run-time, using the
  477.    #line - instruction!
  478.    */
  479.  
  480. /**** NEW FOR VERSION 6: ****/
  481. #define FPLSEND_DONTCOPY_STRING (_FPL_DUMMY + 34)
  482. /* The string we send to FPL is allocated with fplAllocString(). */
  483.  
  484.  
  485. /**** NEW FOR VERSION 10: ****/
  486. #define FPLSEND_RESULT (_FPL_DUMMY + 35)
  487. /* Supply a pointer to a long that will get the result code of a following
  488.    query-tag, This pointer is static within FPL and is only then needed to
  489.    be set whenever it's changed! NULL is valid, but no result will be
  490.    available then!
  491.    */
  492.  
  493. #define FPLSEND_IS_FILE_CACHED (_FPL_DUMMY + 36)
  494. /* Supply a char pointer of a program name. This tag will make FPL report if
  495.    the specified program is cashed - left in memory. FPL will store the result
  496.    (TRUE or FALSE) in the long pointed to by the FPLSEND_RESULT tag.
  497.    */
  498.  
  499. #define FPLSEND_GETRETURNINT (_FPL_DUMMY + 37)
  500. /* Like FPLSEND_GETRETURNCODE, but this returns a pointer to the actual
  501.    number (long). If no value was returned, this will return NULL. */
  502.  
  503.  /***********************************************************************
  504.   *
  505.   * Funclib defines (new from version 7) [Amiga only]
  506.   *
  507.   *****/
  508.  
  509. #define FPLLIB_NONE  0 /* nothing at all! */
  510. #define FPLLIB_FORCE (1<<0)
  511. #define FPLLIB_KEEP  (1<<1)
  512.  
  513. struct fplArgument {
  514.   /*
  515.    * Interface function argument structure...
  516.    */
  517.  
  518.   char *name;        /* Name */
  519.   long ID;              /* ID */
  520.   void **argv;          /* Pointer array of all arguments in the same order as
  521.                they were read. Integers are simply stored in the
  522.                pointer (read docs for info about this). */
  523.   long argc;            /* Number of members in the array above */
  524.   void *key;        /* The return code from your initial fplInit() call! */
  525.   char *format;        /* Pointer to the actual format string of this
  526.                function. Functions using '>' in their format
  527.                string can get quite a long string here... */
  528.   void *funcdata;    /* The same data as passed in the FPLTAG_FUNCDATA tag
  529.                of your AddFunction() call. Your possibility to
  530.                pass function specific data through the library. */
  531.   /* NEW FOR FPL 5.10 */
  532.   char ret;        /* Expected return type. Especially useful when
  533.                using functions with optional return types. */
  534.   /* NEW FOR V10 */
  535.   void *variable;       /* Holds the [previous] variable contents of an
  536.                            external variable. If ->argc is set, the ->argv
  537.                            will hold the optionally new contents of this
  538.                            variable */
  539. };
  540.  
  541. struct fplSymbol {
  542.   /*
  543.    * Using the functions FPLSEND_GETSYMBOL_XXXXXXX will result in a pointer
  544.    * to a structure like this!
  545.    *
  546.    * Free that pointer by FPLSEND_GETSYMBOL_FREE.
  547.    */
  548.   long num;
  549.   char **array;
  550. };
  551.  
  552. /****************************/
  553. /***** STRING LENGTH: *******/
  554. /****************************/
  555. /* Since the no-zero-terminated-strings theories was introduced, we can't
  556.    use a simple strlen() to get the string length. This macro will do the
  557.    job for you. (Extensively typecasted to apply to ANSI standard.)
  558.    Supply the name of the structure pointer you received in the interface
  559.    function, and the number of the string. Returns the length of that
  560.    string. */
  561. #define FPL_STRING_LENGTH(arg, n)\
  562.   ((long)*(long *)((char *)(arg)->argv[n]-sizeof(long)))
  563.  
  564. /* Supply a string pointer received in the interface function. Returns
  565.    the length of the FPL-string! */
  566. #define FPL_STRLEN(arg)\
  567.   ((long)*(long *)((char *)(arg)-sizeof(long)))
  568.  
  569. /****************************/
  570. /***** FPLARGUMENT.ID: ******/
  571. /****************************/
  572. #define FPL_GENERAL_ERROR -1
  573. /* There was an error in the interpreting.
  574.    arg->argv[0] contains the error number.
  575.    */
  576.  
  577. #define FPL_FILE_REQUEST  -2
  578. /* FPL wants a file from you that was previously flushed! The arg->argv[0]
  579.    contains the fileID of the program. Use FPLSEND_PROGRAM or
  580.    FPLSEND_PROGFILE to respond. */
  581.  
  582. #define FPL_FLUSH_FILE -3
  583. /* FPL allows you to remove the allocation associated with a certain program.
  584.    The arg->argv[0] contains the fileID. Respond with FPLSEND_CONFIRM and the
  585.    data field TRUE if you really do want to flush that program. */
  586.  
  587. #define FPL_WARNING -4
  588. /* FPL warning. ->argv[0] holds the error number. Return a fplSend() with
  589.    {FPLSEND_CONFIRM, TRUE} if you want FPL to try to continue anyway! */
  590.  
  591. #if DEVELOP
  592. #define FPL_HIJACK_READ -5
  593. /* The program accessed a variable that previously has been hijacked!
  594.    This is currently not implemented, but are tested in the laboratories! */
  595. #endif
  596.  
  597. #define FPL_UNKNOWN_FUNCTION -6 /* New from version 5.3 */
  598. /* The program has interpreted an unknown function identifier. The name
  599.    is found in the ->name member, and the parameters are read as usual via
  600.    the ->format member from the ->argc and ->argv members. ->funcdata are
  601.    reserved for future use, do not depend upon it to hold anything
  602.    particular. This is activated with FPLTAG_ALLFUNCTIONS. */
  603.  
  604. #define FPL_COMPILE -7 /* development ID */
  605.  
  606.  
  607. /****************************/
  608. /****** Limitations: ********/
  609. /****************************/
  610. /* Max length of a resulting error message: */
  611. #define FPL_ERRORMSG_LENGTH 100
  612.  
  613. #define FPLNAME "fpl.library"
  614.  
  615. #define FPL_VERSION  10
  616. #define FPL_REVISION 0
  617. #endif
  618.