File:  [Coherent Logic Development] / freem / src / freem.h
Revision 1.4: download - view: text, annotated - select for diffs
Sat Mar 22 18:43:54 2025 UTC (4 months, 1 week ago) by snw
Branches: MAIN
CVS tags: v0-63-1-rc1, v0-63-0-rc1, v0-63-0, v0-62-3, v0-62-2, HEAD
Make STRLEN 255 chars and add BIGSTR macro for larger buffers

    1: /*
    2:  *   $Id: freem.h,v 1.4 2025/03/22 18:43:54 snw Exp $
    3:  *    libfreem data structures and prototypes
    4:  * 
    5:  *    NOTE: Caller must pre-allocate memory for *all* APIs!
    6:  *
    7:  *  
    8:  *   Author: Serena Willis <snw@coherent-logic.com>
    9:  *    Copyright (C) 1998 MUG Deutschland
   10:  *    Copyright (C) 2020, 2025 Coherent Logic Development LLC
   11:  *
   12:  *
   13:  *   This file is part of FreeM.
   14:  *
   15:  *   FreeM is free software: you can redistribute it and/or modify
   16:  *   it under the terms of the GNU Affero Public License as published by
   17:  *   the Free Software Foundation, either version 3 of the License, or
   18:  *   (at your option) any later version.
   19:  *
   20:  *   FreeM is distributed in the hope that it will be useful,
   21:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   23:  *   GNU Affero Public License for more details.
   24:  *
   25:  *   You should have received a copy of the GNU Affero Public License
   26:  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
   27:  *
   28:  *   $Log: freem.h,v $
   29:  *   Revision 1.4  2025/03/22 18:43:54  snw
   30:  *   Make STRLEN 255 chars and add BIGSTR macro for larger buffers
   31:  *
   32:  *   Revision 1.3  2025/03/09 19:14:25  snw
   33:  *   First phase of REUSE compliance and header reformat
   34:  *
   35:  *
   36:  * SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
   37:  * SPDX-License-Identifier: AGPL-3.0-or-later 
   38:  **/
   39: 
   40: #ifndef _LIBFREEM_H
   41: # define _LIBFREEM_H
   42: 
   43: #include "merr.h"
   44: #include <sys/types.h>
   45: 
   46: #if !defined(STRLEN)
   47: # define STRLEN 255
   48: #endif
   49: 
   50: #if !defined(BIGSTR)
   51: # define BIGSTR 65535
   52: #endif
   53: 
   54: #define MREF_RT_LOCAL 0
   55: #define MREF_RT_GLOBAL 1
   56: #define MREF_RT_SSVN 2
   57: #define MREF_RT_SSV MREF_RT_SSVN
   58: 
   59: #define MREF_ST_NEW 0
   60: #define MREF_ST_INIT 1
   61: #define MREF_ST_ERR 10
   62: 
   63: #define MLIB_ERRLEN 180
   64: 
   65: typedef struct freem_ref_t {
   66: 
   67:     /*
   68:      * The 'reftype' field can be one of:
   69:      * 
   70:      *  MREF_RT_LOCAL
   71:      *  MREF_RT_GLOBAL
   72:      *  MREF_RT_SSVN
   73:      */
   74:     short reftype;
   75: 
   76:     /*
   77:      * The 'name' field is the name of the local variable,
   78:      * global variable, or SSV.
   79:      */
   80:     char name[STRLEN];    
   81: 
   82:     /*
   83:      * Returned data goes in a string, so it is important to make sure
   84:      * that your application accounts for canonical numbers as needed.
   85:      */
   86:     char value[STRLEN];   
   87: 
   88:     short status;
   89: 
   90:     unsigned int subscript_count;
   91:     char subscripts[255][STRLEN];
   92: 
   93: } freem_ref_t;
   94: 
   95: typedef struct freem_ent_t {
   96: 
   97:     /* name of function or procedure entry point */
   98:     char name[256];
   99: 
  100:     /* return value */
  101:     char value[STRLEN];
  102: 
  103:     /* value of ierr on return */
  104:     short status;
  105: 
  106:     /* argument count and array */
  107:     unsigned int argument_count;
  108:     char arguments[255][256];
  109: 
  110: } freem_ent_t;
  111: 
  112: #ifndef TRUE
  113: # define TRUE 1
  114: #endif
  115: 
  116: #ifndef FALSE
  117: # define FALSE 0
  118: #endif
  119: 
  120: #ifdef __cplusplus
  121:  extern "C" {
  122: #endif
  123: 
  124: extern pid_t freem_init(char *environment_name, char *namespace_name);
  125: extern short freem_version(char *result);
  126: extern short freem_set(freem_ref_t *ref);
  127: extern short freem_get(freem_ref_t *ref);
  128: extern short freem_kill(freem_ref_t *ref);
  129: extern short freem_data(freem_ref_t *ref);
  130: extern short freem_order(freem_ref_t *ref);
  131: extern short freem_query(freem_ref_t *ref);
  132: extern short freem_lock(freem_ref_t *ref, long lck_timeout);
  133: extern short freem_unlock(freem_ref_t *ref, long lck_timeout);
  134: extern short freem_tstart(char *tp_id, short serial, short restartable, char **sym_save);
  135: extern short freem_trestart(void);
  136: extern short freem_trollback(int tp_levels);
  137: extern short freem_tcommit(void);
  138: extern int freem_tlevel(void);
  139: extern short freem_function(freem_ent_t *ent);
  140: extern short freem_procedure(freem_ent_t *ent);
  141: extern short freem_errmsg(int code, char *msg);
  142:      
  143: #ifdef __cplusplus
  144:  }
  145: #endif
  146: 
  147: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>