1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-29 13:01:30 +00:00
Files
Interlisp.maiko/src/lpread.c
Nick Briggs 5481a14812 Replace all K&R style function definitions with new-style function definitions.
Add some missing default function result types (int).
Add some missing void result types where appropriate.

	modified:   src/Cldeetr.c
	modified:   src/atom.c
	modified:   src/bbtsub.c
	modified:   src/bitblt.c
	modified:   src/byteswap.c
	modified:   src/chardev.c
	modified:   src/chatter.c
	modified:   src/colorbltfns.c
	modified:   src/common.c
	modified:   src/dir.c
	modified:   src/dlpi.c
	modified:   src/doskbd.c
	modified:   src/dosmouse.c
	modified:   src/draw.c
	modified:   src/dsk.c
	modified:   src/dspsubrs.c
	modified:   src/ejlisp.c
	modified:   src/ether.c
	modified:   src/imagefile.c
	modified:   src/imagefile2.c
	modified:   src/inet.c
	modified:   src/initdsp.c
	modified:   src/initkbd.c
	modified:   src/kbdsubrs.c
	modified:   src/ldeboot.c
	modified:   src/llcolor.c
	modified:   src/llstk.c
	modified:   src/loader.c
	modified:   src/loopsops.c
	modified:   src/lpdual.c
	modified:   src/lpmain.c
	modified:   src/lpread.c
	modified:   src/lptran.c
	modified:   src/lpwrite.c
	modified:   src/main.c
	modified:   src/misc7.c
	modified:   src/mkatom.c
	modified:   src/mnwevent.c
	modified:   src/mnxmeth.c
	modified:   src/mouseif.c
	modified:   src/ocr.c
	modified:   src/ocrproc.c
	modified:   src/oether.c
	modified:   src/oldeether.c
	modified:   src/osmsg.c
	modified:   src/picture.c
	modified:   src/rawcolor.c
	modified:   src/rawrs232c.c
	modified:   src/rpc.c
	modified:   src/rs232c.c
	modified:   src/socdvr.c
	modified:   src/socket.c
	modified:   src/testdsp.c
	modified:   src/testtool.c
	modified:   src/timeoday.c
	modified:   src/timeofday.c
	modified:   src/timer.c
	modified:   src/truecolor.c
	modified:   src/tty.c
	modified:   src/ufn.c
	modified:   src/ufs.c
	modified:   src/unixcomm.c
	modified:   src/unixfork.c
	modified:   src/unwind.c
	modified:   src/uraid.c
	modified:   src/vesainit.c
	modified:   src/vgainit.c
	modified:   src/vmemsave.c
	modified:   src/xcursor.c
	modified:   src/xinit.c
	modified:   src/xlspwin.c
	modified:   src/xmkicon.c
	modified:   src/xrdopt.c
	modified:   src/xwinman.c
2017-06-22 17:31:40 -07:00

101 lines
3.9 KiB
C

/* $Id: lpread.c,v 1.2 1999/01/03 02:07:19 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
static char *id = "$Id: lpread.c,v 1.2 1999/01/03 02:07:19 sybalsky Exp $ Copyright (C) Venue";
/************************************************************************/
/* */
/* (C) Copyright 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#include "version.h"
/*
============================================================================
NAME : read.c
PURPOSE : translation of lp-problem and storage in sparse matrix
SHORT : Subroutines for yacc program to store the input in an intermediate
data-structure. The yacc and lex programs translate the input.
First the problemsize is determined and the date is read into
an intermediate structure, then readinput fills the sparse matrix.
USAGE : call yyparse(); to start reading the input.
call readinput(); to fill the sparse matrix.
============================================================================
Rows : contains the amount of rows + 1
Rows-1 is the amount of constraints (no bounds)
Rows also contains the rownr 0 which is the objectfunction
Columns : contains the amount of columns (different variable names
found in the constraints)
Nonnuls : contains the amount of nonnuls = sum of different entries
of all columns in the constraints and in the objectfunction
Hash_tab : contains all columnnames on the first level of the structure
the row information is kept under each column structure
in a linked list (also the objext funtion is in this structure)
Bound information is also stored under under the column name
First_rside : points to a linked list containing all relational operators
and the righthandside values of the constraints
the linked list is in reversed order with respect to the
rownumbers
============================================================================
*/
#include "lpkit.h"
#include "lpglob.h"
extern REAL Infinite;
/*
* transport the data from the intermediate structure to the sparse matrix
* and free the intermediate structure
*/
void readlispinput(lprec *lp, float *lisprhs, short *lisprelns, int *lispcend, lispmr *lispmat,
short *lispints, float *lisplowbo, float *lispupbo)
{
int i, j, k, index, nn_ind;
int x;
/* initialize lower and upper bound arrays */
for (i = 0; i <= Sum; i++) {
lp->orig_lowbo[i] = lisplowbo[i];
if (lispupbo[i] > 1.0e20)
lp->orig_upbo[i] = Infinite;
else
lp->orig_upbo[i] = lispupbo[i];
}
for (i = Rows; i >= 0; i--) { lp->orig_rh[i] = lisprhs[i]; }
memcpy(lp->col_end, lispcend, (Columns + 1) * sizeof(int));
#ifdef BYTESWAP
for (i = 0; i < Sum + 1; i++) lp->must_be_int[i] = lispints[i ^ 1];
#else
memcpy(lp->must_be_int, lispints, (Sum + 1) * sizeof(short));
#endif /* BYTESWAP */
for (i = 0; i < Non_zeros; i++) {
lp->mat[i].row_nr = lispmat[i].rownr;
lp->mat[i].value = lispmat[i].value;
}
set_maxim(lp); /* We always maximize. */
for (i = Rows; i > 0; i--) {
#ifdef BYTESWAP
set_constr_type(lp, i, lisprelns[i ^ 1]);
#else
set_constr_type(lp, i, lisprelns[i]);
#endif /* BYTESWAP */
}
} /* readlispinput */
/* ===================== END OF read.c ===================================== */