File: x_zzledt.c

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (86 lines) | stat: -rw-r--r-- 2,143 bytes parent folder | download
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

/* Copyright (C) 1998 Chancelier Jean-Philippe */
/************************************
 * reading functions for scilab 
 * Scilab 1997
 *   Jean-Philippe Chancelier 
 ************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef STRICT
#define STRICT
#endif
#include <windows.h>
#include "wgnuplib.h"
#include "wresource.h"
#include "wcommon.h"
#include "plot.h"

extern char input_line[MAX_LINE_LEN + 1];

/***********************************************************************
 * line editor win32 version 
 * Input function for Scilab 
 * zzledt1 for scilab 
 * zzledt  for scilab -nw 
 **********************************************************************/

char save_prompt[10];


#ifdef __STDC__
void C2F (zzledt1) (char *buffer, int *buf_size, int *len_line, int *eof, long int dummy1)
#else
void C2F (zzledt1) (buffer, buf_size, len_line, eof, dummy1)
     char *buffer;
     int *buf_size;
     int *len_line;
     int *eof;
     long int dummy1;		/* added by FORTRAN to give buffer length */
#endif
{
  set_is_reading (TRUE);
  read_line (save_prompt);
  strncpy (buffer, input_line, *buf_size);
  *len_line = strlen (buffer);
/** fprintf(stderr,"[%s,%d]\n",buffer,*len_line); **/
  *eof = FALSE;
  set_is_reading (FALSE);
  return;
}

/**** Warning here : eof can be true  ***/
#ifdef __STDC__
void C2F (zzledt) (char *buffer, int *buf_size, int *len_line, int *eof, long int dummy1)
#else
void C2F (zzledt) (buffer, buf_size, len_line, eof, dummy1)
     char *buffer;
     int *buf_size;
     int *len_line;
     int *eof;
     long int dummy1;		/* added by FORTRAN to give buffer length */
#endif
{
  int i;
  set_is_reading (TRUE);
  i = read_line (save_prompt);
  strncpy (buffer, input_line, *buf_size);
  *len_line = strlen (buffer);
/** fprintf(stderr,"[%s,%d]\n",buffer,*len_line); **/
  *eof = (i == 1) ? TRUE : FALSE;
  set_is_reading (FALSE);
  return;
}

void C2F (setprlev) (pause)
     int *pause;
{
  if (*pause == 0)
    sprintf (save_prompt, "-->");
  else if (*pause > 0)
    sprintf (save_prompt, "-%d->", *pause);
  else
    sprintf (save_prompt, ">>", *pause);
}