Browse Source

Version 0.55

pull/1/head
debian 8 years ago
parent
commit
5d88e120ca
44 changed files with 551 additions and 93 deletions
  1. +22
    -0
      NEWS
  2. +2
    -2
      src/conf.h
  3. +94
    -12
      src/debug.c
  4. +13
    -2
      src/debug.h
  5. +23
    -1
      src/dev.c
  6. +4
    -1
      src/dev.h
  7. +15
    -5
      src/err.c
  8. +1
    -1
      src/err.h
  9. +54
    -0
      src/ex/NifeDebugTerms
  10. +8
    -4
      src/foncs.c
  11. +2
    -1
      src/foncs.h
  12. +8
    -2
      src/gplot.c
  13. +2
    -1
      src/gplot.h
  14. +12
    -1
      src/help.c
  15. +1
    -1
      src/help.h
  16. +33
    -9
      src/histo.c
  17. +2
    -1
      src/histo.h
  18. +16
    -1
      src/i2c.c
  19. +3
    -1
      src/i2c.h
  20. +34
    -6
      src/lib.c
  21. +3
    -1
      src/lib.h
  22. +1
    -1
      src/libmath.c
  23. +1
    -1
      src/libmath.h
  24. +1
    -1
      src/libmathc99.c
  25. +1
    -1
      src/mth.c
  26. +1
    -1
      src/mth.h
  27. +31
    -6
      src/net.c
  28. +3
    -1
      src/net.h
  29. +30
    -9
      src/nife.c
  30. +1
    -1
      src/nife.h
  31. +1
    -1
      src/scs.c
  32. +1
    -1
      src/scs.h
  33. +8
    -1
      src/stackC.c
  34. +2
    -1
      src/stackC.h
  35. +50
    -1
      src/stackF.c
  36. +2
    -1
      src/stackF.h
  37. +8
    -1
      src/stackL.c
  38. +2
    -1
      src/stackL.h
  39. +15
    -1
      src/stackN.c
  40. +3
    -1
      src/stackN.h
  41. +9
    -1
      src/stackV.c
  42. +2
    -1
      src/stackV.h
  43. +23
    -5
      src/tasks.c
  44. +3
    -1
      src/tasks.h

+ 22
- 0
NEWS View File

@@ -1,5 +1,27 @@
History of Nife releases :

2015-08-10 - Nife 0.55 is released.
* Changing the log file contents to be able to use it for debugging.
The log file is in the subdirectory .nife. His name is the type
.nife_PID.log, PID being its number of pid.
We can display the content in real time with tail -f.
The .nifeNS_pid.log and .nifeRPC_PID.log files are those of the
server networks and its bodies.
Log files are deleted at the end of the Nife session unless an error
occured.
* Added "savelog function to save the logs before going out.
* Placing aid debugging functions. All these functions begin with the _
character and are listed with ?libp function.
* Added shell script command, ex/NifeDebugTerms, to facilitate
establishment and closing of the display terminals for the logs.
* Added the possibility, in graphic mode, to open or close
terminals with keys 'home' and 'end'. These functionalities are
based on performance in the window manager of the above script.
* Reorganization of system functions in the function stack.
* Improved tasks and consoles.
* Added the ability to execute external command interactively, with the
character ! at the beginning of the line.

2014-08-31 - Nife 0.51 is released.
* Finalising the version 1.0 of the functions dump and restore with the
definition of the NBLF, Nife Binary Linkable Format.


+ 2
- 2
src/conf.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#ifdef HAVE_CONFIG_H
#include "../config.h"
#else
#define VERSION "0.51"
#define VERSION "0.55"
#endif

#ifdef HAVE_COMEDILIB_H


+ 94
- 12
src/debug.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,27 +26,77 @@ along with this program. If not, see <http://www.gnu.org/licenses/>

#include "nife.h"
#include "mth.h"
#include "foncs.h"
#include "debug.h"
#include "stackC.h"

int Debug=1; /* OK by default */
int InDebugFct=0;

static void D_Logname(char*B)
{
switch(Debug) {
case 1:
sprintf(B,".nife_%d.log",getpid());
break;
case 2:
sprintf(B,".nifeNS_%d.log",getpid());
break;
case 3:
sprintf(B,".nifeRPC_%d.log",getpid());
break;
default:
*B='\0';
}
}

void D_Reset(void)
{
int fd, nc;
char NF[24];
nc=chdir(".nife");
if (Debug) {
sprintf(NF,".nife_%d.log",getpid());
nc=chdir(".nife");
D_Logname(NF);
if ((fd=open(NF,O_CREAT|O_RDWR|O_TRUNC,0644)) < 0) perror(NF);
else {
dup2(fd,2);
close(fd);
}
nc=chdir("..");
} else dup2(1,2);
nc=chdir("..");
}

void D_Update(void)
void IFD_SaveLog(void)
{
char NF[24],comm[50],*newf;
newf = getString();
if (Debug) {
D_Logname(NF);
sprintf(comm,"cp .nife/%s %s",NF, newf);
runCommand(comm);
}
}

static void DebugTerms(char c)
{
char comm[24];
if (Debug) {
sprintf(comm,"ex/NifeDebugTerms -%c", c);
runCommand(comm);
}
}

void IFD_DebugTOn(void)
{
DebugTerms('r');
}

void IFD_DebugTOff(void)
{
DebugTerms('s');
}

void IFD_Update(void)
{
if (Debug) Debug=0;
else Debug=1;
@@ -56,7 +106,39 @@ void D_Update(void)
void D_Trace(char * M)
{
if (Debug) {
fprintf(stderr," %s",M);
fprintf(stderr,"%s ",M);
fflush(stderr);
}
}

void D_Close(void)
{
int nc;
char NF[24];
fclose(stderr);
if (Debug) {
nc=chdir(".nife");
D_Logname(NF);
unlink(NF);
nc=chdir("..");
}
}

void D_Tracenl(char * M)
{
if (Debug) {
fprintf(stderr,"%s\n",M);
fflush(stderr);
}
}

void D_TraceH(char * M, int l)
{
int i;
if (Debug) {
fprintf(stderr,"HEX:");
for (i=0;i<l;i++) fprintf(stderr," %x",(int)((unsigned char)M[i]));
fprintf(stderr,"\n");
fflush(stderr);
}
}
@@ -65,18 +147,18 @@ static char D_Mes[20];
void * Malloc(int s)
{
void * M;
D_Trace("\n");
D_Tracenl("EOL");
M=malloc(s);
sprintf(D_Mes,"Malloc %d : %lx\n",s,(long)M);
D_Trace(D_Mes);
sprintf(D_Mes,"Malloc %d : %lx",s,(long)M);
D_Tracenl(D_Mes);
return M;
}

void Free(void *A)
{
D_Trace("\n");
sprintf(D_Mes,"Free : %lx\n",(long)A);
D_Trace(D_Mes);
D_Tracenl("EOL");
sprintf(D_Mes,"Free : %lx",(long)A);
D_Tracenl(D_Mes);
free(A);
}


+ 13
- 2
src/debug.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,10 +18,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#ifndef __NIFE_DEBUG_H__
#define __NIFE_DEBUG_H__
extern int Debug;
extern int InDebugFct;

#define _IFD_BEGIN_ int fd; fd=dup(1); dup2(2,1); InDebugFct=1;
#define _IFD_END_ dup2(fd,1); close(fd); InDebugFct=0;

extern void D_Reset(void);
extern void D_Update(void);
extern void IFD_Update(void);
extern void IFD_SaveLog(void);
extern void IFD_DebugTOn(void);
extern void IFD_DebugTOff(void);
extern void D_Close(void);

extern void D_Trace(char * M);
extern void D_Tracenl(char * M);
extern void D_TraceH(char * M, int l);

extern void * Malloc(int s);
extern void Free(void * A);


+ 23
- 1
src/dev.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>

#include <stdio.h>
#include <string.h>
#include "debug.h"
static int DFL_did=0, DFL_sid=0, DFL_cid=0;

#ifdef _WITH_COMEDILIB
@@ -153,6 +154,13 @@ char driver[24], nomdev[24];
}
}

void IFD_listDev (void)
{
_IFD_BEGIN_
IF_listDev();
_IFD_END_
}

#ifdef _WITH_COMEDILIB
static void show_subdev(int i, int V)
{
@@ -227,6 +235,13 @@ int i, n_subdev;
#endif
}

void IFD_showDev (void)
{
_IFD_BEGIN_
IF_showDev();
_IFD_END_
}

void IF_devShowDflt (void)
{
#ifdef _WITH_COMEDILIB
@@ -246,6 +261,13 @@ int n_subdev;
#endif
}

void IFD_devShowDflt (void)
{
_IFD_BEGIN_
IF_devShowDflt();
_IFD_END_
}

static void dev_read(int did, int sid, int cid)
{
#ifdef _WITH_COMEDILIB


+ 4
- 1
src/dev.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,11 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#define __NIFE_DEV_H__

extern void IF_listDev (void);
extern void IFD_listDev (void);
extern void IF_showDev (void);
extern void IFD_showDev (void);
extern void IF_devRead (void);
extern void IF_devWrite (void);
extern void IF_devDflt (void);
extern void IF_devShowDflt (void);
extern void IFD_devShowDflt (void);
extern void IF_devDflW (void);
extern void IF_devDflR (void);



+ 15
- 5
src/err.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "nife.h"
#include "mth.h"
#include "err.h"
#include "debug.h"
#include "histo.h"
#include "stackF.h"
#include "stackN.h"
@@ -132,29 +133,39 @@ void stopErr(char *M, char *F)
exit(1);
}

static ErrPrintf(char *M)
{
printf(M);
if (InDebugFct==0) fprintf(stderr,M);
}

static void traiteErr(int n, char * L)
{
int v;
ERROR=n;
if (D_Cod==0) {
if (ECHOOFF) printf("\n");
/* if (InDebugFct==0) fprintf(stderr,"\n"); A VOIR ! */
printf("%s : %s !!\a\n",L,TabErr[n]);
if (InDebugFct==0) fprintf(stderr,"%s : %s !!\a\n",L,TabErr[n]);
}
if (inSonProc) exit(1);
if (fctEnCours) {
if (D_Cod==0) printf("Compilation aborted !\n");
if (D_Cod==0) ErrPrintf("Compilation aborted !\n");
else
if (ADDRONE == VIDE) printf("Inside compilation aborted !\n");
if (ADDRONE == VIDE) ErrPrintf("Inside compilation aborted !\n");
_MODIF_fctEnCours_(0);
rmLastFct();
}
if (ADDRONE != VIDE) return;
if (FD_IN) {
printf("In loading file %s : line %d !\n", getFDname(),getFDlig());
if (InDebugFct==0) fprintf(stderr, "In loading file %s : line %d !\n", getFDname(),getFDlig());
closeFD();
}
if (iTERM) {
printf("In loading stdin : line %d !\n", getFDlig());
if (InDebugFct==0) fprintf(stderr,"In loading stdin : line %d !\n", getFDlig());
close(FD_IN); /* pipe ou autre */
v = dup(iTERM); /* stdin on term */
iTERM = 0;
@@ -183,8 +194,7 @@ void IF_NoError(void)
void IF_LibError(void)
{
long P;
getParLong(&P);
putString(TabErr[(int)P]);
if (getParLong(&P)) putString(TabErr[(int)P]);
}

void IF_IsError(void)


+ 1
- 1
src/err.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 54
- 0
src/ex/NifeDebugTerms View File

@@ -0,0 +1,54 @@
#! /bin/sh
# Ce script a ete fait pour l'environnement Gnome,
# mais il peut etre adapte tres facilement.
# Pour cela suivre les commentaires.

explic ()
{
echo "Erreur : $1 !" >&2
echo "Utilisation : $0 [-s|-r]" >&2
echo " option -s=stopper l'affichage des logs" >&2
echo " option -r=relancer l'affichage des logs" >&2
exit 1
}

TERMCOM='gnome-terminal' # mettre ici le nom de la commande qui va bien !

if ! test $TERMCOM ; then
echo "Commande $TERMCOM absente !" >&2
exit 1
fi


if [ $# -gt 1 ]; then
explic "Parametres trop nombreux"
fi
Mode=0
if [ $# -eq 1 ]; then
[ "$1" = "-s" ] && Mode=1
[ "$1" = "-r" ] && Mode=2
[ $Mode -eq 0 ] && explic "$1 : parametre non valable"
# arret des terminaux
liste=`ps -fe|grep -v 'sh -c'|grep 'tail -f .nife'|sed 's/ */ /g'|cut -d' ' -f2`
for pid in $liste
do
kill $pid 2>/dev/null
done
[ $Mode -eq 1 ] && exit 0
fi

IFS='
'
liste=`ls .nife/.nife*` 2>/dev/null
if [ "$liste" = "" ]; then
echo "Pas de fichier log ! Nife n'est pas en action !" >&2
exit 2
fi

for l in $liste
do
com="tail -f $l"
$TERMCOM -e "sh -c '$com'" -t "$l" # A mettre a jour si TERMCOM
# a ete modifie !!
done


+ 8
- 4
src/foncs.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "nife.h"
#include "mth.h"
#include "err.h"
#include "debug.h"
#include "foncs.h"
#include "histo.h"
#include "stackN.h"
@@ -91,7 +92,6 @@ char * Sh;
if ((pid = fork()) == -1) stopErr("runComm","fork");
if (pid == 0) { /* fils */
_MODIF_inSonProc_(1);
termReset();
if ((Sh=getenv("SHELL")) == NULL) execlp("sh","sh","-c",com,NULL);
else execlp(Sh,"sh","-c",com,NULL);
perror("sh");
@@ -99,8 +99,12 @@ char * Sh;
}
waitpid(pid,NULL,0);
_MODIF_WAITPID_(0);
termInit();
printf("\n");
}

void runCommandT (char * com)
{
D_Trace("$"); D_Tracenl(com);
runCommand(com);
}

void IF_toCsv(void)


+ 2
- 1
src/foncs.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,5 +31,6 @@ extern void IF_xytXgraph(void);
extern void IF_resUsage(void);

extern void runCommand( char * C);
extern void runCommandT( char * C);

#endif

+ 8
- 2
src/gplot.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "stackN.h"
#include "stackC.h"
#include "err.h"
#include "debug.h"

#define GPO_STD 0 /* standard */
#define GPO_MRG 0x100 /* merge */
@@ -365,6 +366,11 @@ struct GPlot * N;
printf("<end of GNUPlot list>\n");
}


void IFD_show_stackGP(void)
{
_IFD_BEGIN_
IF_show_stackGP();
_IFD_END_
}



+ 2
- 1
src/gplot.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,5 +27,6 @@ extern void IF_gplot_commapp(void);
extern void IF_gplot_append(void);
extern void IF_gplot_replace(void);
extern void IF_show_stackGP(void);
extern void IFD_show_stackGP(void);

#endif

+ 12
- 1
src/help.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>

#include "help.h"
#include "nife.h"
#include "lib.h"
#include "mth.h"

#define LHLP 200 /* longueur MAX des lignes du fichier hlp */
static char buf[LHLP];
@@ -59,6 +61,15 @@ int debut=0,l;
void helpStd(char * L)
{
dropTrSuite();
if (fctExists(L)==0) {
printf("%s is not a User System function !\n",L);
return;
}
if (*L == '_') {
printf("%s :\n",L);
printf("The same as '%s', but with all displays in the log file.\n", L+1);
L++;
}
helpShow(L);
}



+ 1
- 1
src/help.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 33
- 9
src/histo.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -80,6 +80,11 @@ void closeFD(void)
else _MODIF_FD_IN_(0);
}

int getiFD(void)
{
return iFD;
}

int getFDlig(void)
{
return FD_L[iFD];
@@ -207,6 +212,7 @@ int lireLigne(int fd, char *b, char *s, int nc)
char *d, *f, c, c2, c3, *h, *w, *Wl, *rac;
int n, i, l, ls=0, ins=0, ignTild=0, nbT=0, Nc;
unsigned int j;
char bufd[50];
/* printf("lireLigne ... \n"); */
d = b;
f = b+nc;
@@ -333,7 +339,7 @@ unsigned int j;
ignTild=1;
Nc=read(fd,&c2,1);
Nc=read(fd,&c3,1);
if (c2 == '[') {
if (c2 == '[') { /* CSI - see XTerm Control Sequences */
switch(c3) {
case '2' : /* Insert */
if (ins) {
@@ -350,8 +356,8 @@ unsigned int j;
fflush(stdout);
}
break;
case 'A' :
case 'B' :
case 'A' : /* UpArrow */
case 'B' : /* DownArrow */
ins = 0;
/* efface la ligne en cours */
l=d-b;
@@ -395,14 +401,24 @@ unsigned int j;
fflush(stdout);
}
break;
case 'H' : /* home : debug terms ON */
case '1' : /* home numeric */
IFD_DebugTOn();
break;
case 'F' : /* end : debug terms OFF */
case '4' : /* end numeric */
IFD_DebugTOff();
break;
default:
printf("\nESC [ %d (%c) !\n",(int)c3, c3);
sprintf(bufd,"# ignore : ESC [ %d (%c) !",(int)c3, c3);
D_Tracenl(bufd);
*d='\0';
/* **************
printf("> %s",b);
fflush(stdout);
fflush(stdout); */
}
} else {
if (c2 == 'O') {
if (c2 == 'O') { /* SS3 - see XTerm Control Sequences */
switch(c3) {
case 'P' : /* F1 */
break;
@@ -412,12 +428,20 @@ unsigned int j;
break;
case 'S' : /* F4 */
break;
case 'H' : /* home : debug terms ON */
IFD_DebugTOn();
break;
case 'F' : /* end : debug terms OFF */
IFD_DebugTOff();
break;
}
} else {
printf("\nESC %d %d (%c) !\n",(int)c2,(int)c3, c3);
sprintf(bufd,"# ignore : ESC %d %d (%c) !",(int)c2,(int)c3, c3);
D_Tracenl(bufd);
*d='\0';
/* **************
printf("> %s",b);
fflush(stdout);
fflush(stdout); */
}
}
break;


+ 2
- 1
src/histo.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@ extern int iTERM;
extern void IF_showFD(void);
extern void addFD(int fd, char *N);
extern void closeFD(void);
extern int getiFD(void);
extern int getFDlig(void);
extern char * getFDname(void);
extern int lireLigne(int fd, char * buf, char * buf2, int max);


+ 16
- 1
src/i2c.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -237,6 +237,7 @@ unsigned long funcs;
#include "stackN.h"
#include "i2c.h"
#include "err.h"
#include "debug.h"

void IF_listI2C (void)
{
@@ -247,6 +248,13 @@ void IF_listI2C (void)
#endif
}

void IFD_listI2C (void)
{
_IFD_BEGIN_
IF_listI2C();
_IFD_END_
}

void IF_showI2C (void)
{
long n;
@@ -275,6 +283,13 @@ char Bus[10], filename[20];
#endif
}

void IFD_showI2C (void)
{
_IFD_BEGIN_
IF_showI2C();
_IFD_END_
}

static void i2c_read(int id, int add, int off)
{
#ifdef _WITH_I2C


+ 3
- 1
src/i2c.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#define __NIFE_I2C_H__

extern void IF_listI2C (void);
extern void IFD_listI2C (void);
extern void IF_showI2C (void);
extern void IFD_showI2C (void);
extern void IF_I2CRead (void);
extern void IF_I2CWrite (void);



+ 34
- 6
src/lib.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -344,9 +344,12 @@ void initLib(void)
addFonE("del_ofunc",IF_delOFct, F_PROG);
addFonE("fscan",IF_scanFct, F_PROG);
addFonc("?cs",IF_show_stackC);
addFonP("_?cs",IFD_show_stackC);
addFonP("?f",IF_show_stackF);
/* addFonP("?l",IF_showFD); for debugging */
addFonP("_?f",IFD_show_stackF);
/* addFonP("?l",IF_showFD); for internal debugging */
addFonP("?v",IF_show_stackV);
addFonP("_?v",IFD_show_stackV);
addFonE("del_var",IF_delVar,F_PROG);
addFonP("vdrop",rmLastVar);
addFonP("reset_var",IF_setVarI);
@@ -363,8 +366,10 @@ void initLib(void)
addFonP("df_stop",IF_DF_STOP);
****************/
addFonc("?ls",IF_show_stackL);
addFonP("_?ls",IFD_show_stackL);
addFonc("?s",IF_show_stack);
/* addFonc("?libX",show_lib_addr); for debugging */
addFonP("_?s",IFD_show_stack);
/* addFonc("?libX",show_lib_addr); for internal debugging */
addFonc("?libs",IF_show_liball);
addFonc("?lib",IF_show_libstd);
addFonc("?libM",IF_show_libmath);
@@ -387,7 +392,9 @@ void initLib(void)
addFonc("BIN",IF_BIN);
addFonc("echo_on",IF_ECHOON);
addFonc("echo_off",IF_ECHOFF);
addFonc("DEBUG_I/O",D_Update);
addFonP("DEBUG_I/O",IFD_Update);
addFonP("\"saveLog",IFD_SaveLog);
/* addFonP("?logs",IFD_DebugTOn); */
addFonc("NBTAB",IF_NBTAB);
addFonc("NBLIG",IF_NBLIG);
addFonE("Var",IF_debVar, F_PROG);
@@ -396,6 +403,7 @@ void initLib(void)
addFonP("var_up",IF_VARUP);
addFonP("var_down",IF_VARDOWN);
addFonc("?vars",IF_vars);
addFonP("_?vars",IFD_vars);
addFonc("drop",IF_drop);
addFonc("dup",IF_dup);
addFonc("swap",IF_swap);
@@ -460,6 +468,7 @@ void initLib(void)
addFonG("xy_xgraph",IF_xyXgraph);
addFonG("xyt_xgraph",IF_xytXgraph);
addFonG("?gp",IF_show_stackGP);
addFonP("_?gp",IFD_show_stackGP);
addFonG("gplot",IF_gplot_new);
addFonG("gplotM",IF_gplot_newM);
addFonG("gplotRaz",IF_delAllGP);
@@ -472,6 +481,7 @@ void initLib(void)
addFonP(":!",IF_debFctS);
addFonP("Task",IF_NewTask);
addFonP("?t",IF_show_Tasks);
addFonP("_?t",IFD_show_Tasks);
addFonP("?task_run",IF_statusTask);
addFonP("del_task",IF_delTask);
addFonP("\"f",IF_execCS);
@@ -480,6 +490,7 @@ void initLib(void)
addFonP("\"v?",IF_execCSvl);
addFonP("stop_task",IF_stopTask);
addFonP("?console",IF_showCons);
addFonP("_?console",IFD_showCons);
addInst(";",IF_finFct);
addInst("'",IF_debBackC);
addInst("`",IF_debBackC1);
@@ -496,7 +507,7 @@ void initLib(void)
addFonc("do_leave",IF_DO_Leave);
addFonc("*do_leave",IF_DO_MLeave);
addFonc("do_next",IF_DO_Next);
/* addFonc("?do",IF_DO_Show); for debugging */
/* addFonc("?do",IF_DO_Show); for internal debugging */
addFonc("ndo",IF_nDO);
addInst("loop",IF_LOOP);
addInst("+loop",IF_PLOOP);
@@ -510,18 +521,24 @@ void initLib(void)
addInst("goto_end",IF_JEND);
addFonE("help",IF_help, F_CORE);
addFonD("?dev",IF_listDev);
addFonP("_?dev",IFD_listDev);
addFonD("dev_info",IF_showDev);
addFonP("_dev_info",IFD_showDev);
addFonD("dev_read",IF_devRead);
addFonD("dev_write",IF_devWrite);
addFonD("dev_dflt",IF_devDflt);
addFonD("?dev_dflt",IF_devShowDflt);
addFonP("_?dev_dflt",IFD_devShowDflt);
addFonD("dev_dflW",IF_devDflW);
addFonD("dev_dflR",IF_devDflR);
addFonD("?i2c",IF_listI2C);
addFonP("_?i2c",IFD_listI2C);
addFonD("i2c_info",IF_showI2C);
addFonP("_i2c_info",IFD_showI2C);
addFonD("i2c_read",IF_I2CRead);
addFonD("i2c_write",IF_I2CWrite);
addFonN("?n",IF_netList);
addFonP("_?n",IFD_netList);
addFonN("netOn",IF_netOn);
addFonN("netOff",IF_netOff);
addFonN("netDt>",IF_netDt);
@@ -535,12 +552,22 @@ void initLib(void)
addFonN("NetErr",IF_NetErrVal);
addFonN("Me",IF_Me);
addFonN("?ns",IF_netStackList);
addFonP("_?ns",IFD_netStackList);
addFonN(">net",IF_netU2S);
addFonN("net>",IF_netS2U);
addFonN("ndrop",IF_netDropS);
/* triList(); */
}

int fctExists(char * L)
{
int i;
for (i=0;i<NBFonc;i++) {
if (strcmp(L,Fonctions[i].nam) == 0) return 1;
}
return 0;
}

void * libByName(char * L)
{
int i;
@@ -552,6 +579,7 @@ int i;
}
return VIDE;
}

void * libByInd(long i)
{
return((void*)Fonctions[i].fct);
@@ -588,7 +616,7 @@ int i;
void * A;
short T=0;
InExec = C;
D_Trace(C);
/* D_Trace(C); pas pour le moment */
if (sigsetjmp(ENV_INT,1)) {
interInfos("execLib",C);
return 1;


+ 3
- 1
src/lib.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@ extern int InstallOn;
extern void initLib(void);
extern int execLibNrpc(char * C);
extern int execLib(char * C);
extern int fctExists(char *);
extern void * libByName(char *);
extern void * libByInd(long i);
extern char * libByAddr(void *A);
extern long iLibByAddr(void *A);


+ 1
- 1
src/libmath.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 1
- 1
src/libmath.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 1
- 1
src/libmathc99.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 1
- 1
src/mth.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 1
- 1
src/mth.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 31
- 6
src/net.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -447,10 +447,11 @@ uint32_t k;
char *sF, nF[30];
i=readMess(s);
NET_BUF[i]='\0';
/* D_Trace(NET_BUF); */
D_TraceH(NET_BUF,i); /* to debug */
switch(*NET_BUF) {
case NET_OFF :
send1car(s, NET_OFF+1);
D_Close();
exit(0); /* stop the Nrpc client */
break;
case NET_EXE :
@@ -498,7 +499,7 @@ char c, *sN, *sF;

i=readMess(s);
NET_BUF[i]='\0';
/* D_Trace(NET_BUF); */
D_TraceH(NET_BUF,i); /* for debug */
switch(*NET_BUF) {
case NET_ONR :
CalDT=1;
@@ -536,7 +537,10 @@ char c, *sN, *sF;
delCli(M1.pid, Sin.sin_addr);
send1car(s, NET_OFF+1);
if (STS) {
if (NCli == 0) exit(0); /* stop the server */
if (NCli == 0) {
D_Close();
exit(0); /* stop the server */
}
STS=0;
}
break;
@@ -683,13 +687,19 @@ static int connSock(void)
return 0; /* OK */
}

static void InterruptRpc(int S)
{
D_Close();
exit(0);
}

void main_Nrpc(void) /* main function for Nrpc client */
{
int sock, nsock;
socklen_t ln;
struct sockaddr_in Nsin;

signal(SIGTERM, SIG_DFL);
signal(SIGTERM, InterruptRpc);
if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
stopServ(0, "socket",1);
bzero(&Nsin,sizeof(Nsin));
@@ -725,6 +735,7 @@ static void startNrpc(void)
close(0);
close(1);
/* close(2); */
if (Debug) Debug=3;
D_Reset();
IF_stack_clear(); /* clear all stacks */
IF_stackL_clear();
@@ -763,6 +774,7 @@ int pid;
close(0);
close(1);
/* close(2); */
if (Debug) Debug=2;
D_Reset();
close(Sock);
IF_stack_clear(); /* clear all stacks */
@@ -933,6 +945,13 @@ void IF_netList (void)
printf("<end of net list>\n");
}

void IFD_netList (void)
{
_IFD_BEGIN_
IF_netList();
_IFD_END_
}

void IF_netStackList (void)
{
if (NET) {
@@ -943,7 +962,13 @@ void IF_netStackList (void)
readAff(Sock, NET_SLI+1);
close(Sock);
}
/* printf("<end of net stack>\n"); */
}

void IFD_netStackList (void)
{
_IFD_BEGIN_
IF_netStackList();
_IFD_END_
}

void IF_netDropS (void)


+ 3
- 1
src/net.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,10 +31,12 @@ extern void IF_netOff(void);
extern void IF_netDt(void);
extern void IF_netDepth(void);
extern void IF_netList(void);
extern void IFD_netList(void);
extern void IF_netStopS(void);
extern void IF_netDropS(void);
extern void IF_netRusage (void);
extern void IF_netStackList (void);
extern void IFD_netStackList (void);
extern void IF_netU2S (void);
extern void IF_netS2U (void);
extern void IF_netExec (void);


+ 30
- 9
src/nife.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -112,7 +112,7 @@ char Lib[8];
#ifdef _MULTI_THREADING_
strcpy(Lib,"mt-");
#endif
printf("nife (Networking Industrial Forth-like Environment) - version %s%s-%ld/%ld\n\t (c) S.E.R.I.A.N.E. 2009-2014\n",Lib,VERSION,sizeof(long)*8,sizeof(double)*8);
printf("nife (Networking Industrial Forth-like Environment) - version %s%s-%ld/%ld\n\t (c) S.E.R.I.A.N.E. 2009-2015\n",Lib,VERSION,sizeof(long)*8,sizeof(double)*8);
}

int isSepa(char c, int m)
@@ -144,13 +144,32 @@ PFC tS;
return Err;
}

static void traiteLigne(char *b)
static void traiteLigne(char *b, int Ctx)
{
char *mot, *d, *f, *w;
/* case of sh command : ! */
if (*b=='!') {
runCommandT(b+1);
return;
}
d=b; f=b+strlen(d);
#ifdef DEBUG
printf("traiteLigne : <%s>\n",d);
#endif
switch(Ctx) {
case 1 : /* compileFile */
D_Trace(" #");
break;
case 2 : /* IF_ExecCS */
D_Trace("# ExecCS:");
break;
case 3 : /* makeFunction */
D_Trace("# makeFunction:");
break;
default : /* 0 */
if (getiFD()) D_Trace(" #");
}
D_Tracenl(b);
while (d<f) {
if (noErr()) break;
/* recherche du 1er mot */
@@ -199,7 +218,7 @@ int i=0;
printf("In file %s line %d !\n",f,i);
break;
}
traiteLigne(bufP);
traiteLigne(bufP,1);
i++;
}
fclose(F);
@@ -361,7 +380,7 @@ void IF_ExecCS(void)
char * f;
f = getString();
if (f != NULL) {
if (strlen(f)>0) traiteLigne(f);
if (strlen(f)>0) traiteLigne(f,2);
free((void*)f);
}
}
@@ -371,7 +390,7 @@ void * makeFunction(char * f)
void *M;
if ((M = malloc(strlen(f)+8)) == NULL) stopErr("makeFunction","malloc");
sprintf((char*)M,": _f %s ;",f);
traiteLigne((char*)M);
traiteLigne((char*)M,3);
free(M);
if (noErr() == 0) {
M = fctByName("_f");
@@ -414,7 +433,7 @@ void IF_Load(void)

int main(int N, char *P[])
{
int n;
int n,Ctx;
char *dirW = ".nife";
if (N > 2) {
fprintf(stderr,"nife [nif-file]\n");
@@ -463,16 +482,18 @@ char *dirW = ".nife";
if ((FD_IN+iTERM) == 0) {
printf("> ");
fflush(stdout);
}
Ctx=0;
} else Ctx=1;
razErr();
if ((n=lireLigne(FD_IN,bufP,bufP2,LBUF)) == -1)
printf("Line too long!\n");
else
if (n>0) traiteLigne(bufP);
if (n>0) traiteLigne(bufP,0);
}
IF_delAllGP();
IF_netStopS();
IF_netOff();
D_Close();
termReset();
printf("Bye !\n");
return 0;


+ 1
- 1
src/nife.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 1
- 1
src/scs.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 1
- 1
src/scs.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by


+ 8
- 1
src/stackC.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "nife.h"
#include "mth.h"
#include "err.h"
#include "debug.h"
#include "stackC.h"
#include "stackF.h"

@@ -212,6 +213,12 @@ char s;
} else printf("<end of character stack>\n");
}

void IFD_show_stackC(void)
{
_IFD_BEGIN_
IF_show_stackC();
_IFD_END_
}

void suiteString(char *S)
{


+ 2
- 1
src/stackC.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,6 +33,7 @@ extern void IF_typeC(void);
extern void IF_timeC(void);
extern void IF_dateC(void);
extern void IF_show_stackC(void);
extern void IFD_show_stackC(void);
extern void IF_debString(void);

extern void dump_eltC(int fd, char*A);


+ 50
- 1
src/stackF.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "nife.h"
#include "mth.h"
#include "err.h"
#include "debug.h"
#include "lib.h"
#include "stackF.h"
#include "stackN.h"
@@ -216,6 +217,39 @@ struct Fct *Elt;
return Elt;
}

void replaceFctS(void)
{
void * Next, * Next2;
struct Fct *Elt, *N, *N2;
if (stackF != VIDE) {
Elt = (struct Fct *)stackF;
if (Elt->n == VIDE) return;
Next = Elt->n;
N = (struct Fct*) Next;
if (N->typ) return;
stackF = Elt->n;
Elt->n = VIDE;
while (Next != VIDE) {
N = (struct Fct*) Next;
Next2 = N->n;
if (Next2==VIDE) {
N->n = (void*)Elt;
return;
} else {
N2 = (struct Fct*) Next2;
if (N2->typ) {
Elt->n = Next2;
N->n = (void*)Elt;
return;
}
}
Next = N->n;
}
}
else messErr(7);
return;
}

void IF_show_stackF(void)
{
void * Next;
@@ -231,6 +265,13 @@ char Ctyp;
printf("<end of functions stack>\n");
}

void IFD_show_stackF(void)
{
_IFD_BEGIN_
IF_show_stackF();
_IFD_END_
}

static char cod[MAXCODE];
static int i_cod;
/* pile pour IF ELSE THEN */
@@ -313,6 +354,7 @@ int i,l, *ea, *Ea;
if (F->typ) {
F->typ=2;
addFonU(F->l,M);
replaceFctS();
}
/* printf("Total Fct : %d + %d !\n",i_cod,(3*sizeof(int))); */
_MODIF_fctEnCours_(0);
@@ -477,10 +519,12 @@ char Lib[LDFLT+1];
i_adB = 0;
i_adD = 0;
}

static void newFct0(char * S)
{
newFct2(S,0);
}

static void newFct1(char * S)
{
newFct2(S,1);
@@ -565,6 +609,9 @@ struct Fct * FR;
} else {
printf("Called in %s err=%d i=%d/%d cod=<%x>\n",
codByAddr(A),noErr(),(int)(C-D),i,*C);
if (InDebugFct==0) fprintf(stderr,
"Called in %s err=%d i=%d/%d cod=<%x>\n",
codByAddr(A),noErr(),(int)(C-D),i,*C);
break; /* end of while */
}
}
@@ -1293,10 +1340,12 @@ void IF_delFct(void)
{
putTrSuite(rmFct);
}

void IF_delAFct(void)
{
putTrSuite(rmAFct);
}

void IF_delOFct(void)
{
putTrSuite(rmOFct);


+ 2
- 1
src/stackF.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -65,6 +65,7 @@ typedef unsigned char Code;

extern int D_Cod;
extern void IF_show_stackF(void);
extern void IFD_show_stackF(void);
extern void IF_debFct(void);
extern void IF_debFctS(void);
extern void IF_finFct(void);


+ 8
- 1
src/stackL.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "nife.h"
#include "mth.h"
#include "err.h"
#include "debug.h"
#include "stackL.h"


@@ -178,6 +179,12 @@ char s;
} else printf("<end of logical stack>\n");
}

void IFD_show_stackL(void)
{
_IFD_BEGIN_
IF_show_stackL();
_IFD_END_
}

void dump_stackL(int fd)
{


+ 2
- 1
src/stackL.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@ extern void IF_xorL(void);
extern void IF_true(void);
extern void IF_false(void);
extern void IF_show_stackL(void);
extern void IFD_show_stackL(void);

extern void dump_stackL(int fd);
extern void restore_stackL(int fd);


+ 15
- 1
src/stackN.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -89,6 +89,13 @@ char * L;
printf("\nNBTAB=%d\nNBLIG=%d\n",NBTAB,NBLIG);
}

void IFD_vars(void)
{
_IFD_BEGIN_
IF_vars();
_IFD_END_
}

void IF_REAL(void) { _MODIF_DOUBLE_(1); }
void IF_INTEGER(void) { _MODIF_DOUBLE_(0); }

@@ -452,6 +459,13 @@ char s;
}
}

void IFD_show_stack(void)
{
_IFD_BEGIN_
IF_show_stack();
_IFD_END_
}

void IF_point(void)
{
struct Num *Elt;


+ 3
- 1
src/stackN.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,6 +37,7 @@ extern void printNumber(void * N);
extern void numVarOff(void * N);
extern void * duplicateNum(void * S, int vSoff);
extern void IF_show_stack(void);
extern void IFD_show_stack(void);
extern void IF_ramp(void);
extern void IF_dramp(void);
extern void IF_DEC(void);
@@ -53,6 +54,7 @@ extern void IF_VAROFF(void);
extern void IF_VARUP(void);
extern void IF_VARDOWN(void);
extern void IF_vars(void);
extern void IFD_vars(void);
extern void IF_point(void);
extern void IF_swap(void);
extern void IF_dup(void);


+ 9
- 1
src/stackV.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "nife.h"
#include "mth.h"
#include "err.h"
#include "debug.h"
#include "lib.h"
#include "stackV.h"
#include "stackF.h"
@@ -163,6 +164,13 @@ struct Var * N;
printf("<end of variables stack>\n");
}

void IFD_show_stackV(void)
{
_IFD_BEGIN_
IF_show_stackV();
_IFD_END_
}

static void newVar(char * S)
{
char Lib[LDFLT+1];


+ 2
- 1
src/stackV.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
extern void IF_debVar(void);
extern void IF_debVarCS(void);
extern void IF_show_stackV(void);
extern void IFD_show_stackV(void);
extern void IF_delVar(void);
extern void dump_stackV(int fd);
extern void restore_stackV(int fd);


+ 23
- 5
src/tasks.c View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <signal.h>
@@ -31,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "nife.h"
#include "mth.h"
#include "err.h"
#include "debug.h"
#include "tasks.h"
#include "foncs.h"
#include "histo.h"
@@ -64,15 +66,18 @@ static char * FicCons(int t)

int MakeTask (void * A)
{
int i, pid;
char * NF;
int i, n, pid;
char * NF, buf[50];
i = FctInTask-1;
if ((pid = fork()) == -1) stopErr("IF_NewTask","fork");
if (pid == 0) { /* fils */
ITASK=FctInTask; /* TASK 0 is the interractive */
ITASK=FctInTask; /* TASK 0 is the interractive one */
NF = FicCons(ITASK);
n = i+1;
if ((i=open(NF,O_CREAT|O_RDWR|O_TRUNC,0600)) < 0) perror(NF);
else {
sprintf(buf,"Task #%d console :\n",n);
write(i,buf,strlen(buf));
dup2(i,1);
dup2(i,2);
close(i);
@@ -101,6 +106,13 @@ int i;
printf("<end of tasks list>\n");
}

void IFD_show_Tasks(void)
{
_IFD_BEGIN_
IF_show_Tasks();
_IFD_END_
}

void IF_statusTask(void)
{
long V;
@@ -148,7 +160,7 @@ int i;
}
}

void IF_showCons( void)
void IF_showCons(void)
{
long V;
int i;
@@ -164,4 +176,10 @@ char * NF, comm[30];
}
}

void IFD_showCons(void)
{
_IFD_BEGIN_
IF_showCons();
_IFD_END_
}


+ 3
- 1
src/tasks.h View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2011-2014 Patrick H. E. Foubet - S.E.R.I.A.N.E.
/* Copyright (C) 2011-2015 Patrick H. E. Foubet - S.E.R.I.A.N.E.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,10 +22,12 @@ extern int ITASK;

extern void IF_NewTask(void);
extern void IF_show_Tasks(void);
extern void IFD_show_Tasks(void);
extern void IF_statusTask(void);
extern void IF_stopTask(void);
extern void IF_delTask(void);
extern void IF_showCons(void);
extern void IFD_showCons(void);

extern int MakeTask(void * A);



Loading…
Cancel
Save