1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
/* glpstr.h (segmented character string) */
/*----------------------------------------------------------------------
-- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Andrew Makhorin,
-- Department for Applied Informatics, Moscow Aviation Institute,
-- Moscow, Russia. All rights reserved. E-mail: <mao@mai2.rcnet.ru>.
--
-- This file is part of GLPK (GNU Linear Programming Kit).
--
-- GLPK is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2, or (at your option)
-- any later version.
--
-- GLPK is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-- License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with GLPK; see the file COPYING. If not, write to the Free
-- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
----------------------------------------------------------------------*/
#ifndef _GLPSTR_H
#define _GLPSTR_H
#include "glpdmp.h"
#define clear_str glp_clear_str
#define compare_str glp_compare_str
#define create_str glp_create_str
#define create_str_pool glp_create_str_pool
#define delete_str glp_delete_str
#define get_str glp_get_str
#define set_str glp_set_str
typedef struct STR STR;
typedef struct SQE SQE;
struct STR
{ /* segmented character string of arbitrary length */
DMP *pool;
/* memory pool holding string elements */
int len;
/* current string length */
SQE *head;
/* pointer to the first string element */
SQE *tail;
/* pointer to the last string element */
};
#define SQE_SIZE 12
/* number of characters allocated in each string element */
struct SQE
{ /* element of segmented character string */
char data[SQE_SIZE];
/* characters allocated in this element */
SQE *next;
/* pointer to the next string element */
};
extern STR *clear_str(STR *str);
/* clear segmented character string */
extern int compare_str(STR *str1, STR *str2);
/* compare segmented character strings */
extern STR *create_str(DMP *pool);
/* create segmented character string */
extern DMP *create_str_pool(void);
/* create pool for segmented character strings */
extern void delete_str(STR *str);
/* delete segmented character string */
extern char *get_str(char *to, STR *str);
/* extract value from segmented character string */
extern STR *set_str(STR *str, char *from);
/* assign value to segmented character string */
#endif
/* eof */
|