[BACK]Return to primitive.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Diff for /OpenXM/src/kan96xx/Kan/primitive.c between version 1.4 and 1.5

version 1.4, 2001/05/04 01:06:25 version 1.5, 2002/11/04 10:53:56
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/Kan/primitive.c,v 1.3 2000/02/24 12:33:47 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/primitive.c,v 1.4 2001/05/04 01:06:25 takayama Exp $ */
 /*   primitive.c */  /*   primitive.c */
 /*  The functions in this module were in stackmachine.c */  /*  The functions in this module were in stackmachine.c */
   
 #include <stdio.h>  #include <stdio.h>
   #include <signal.h>
 #include "datatype.h"  #include "datatype.h"
 #include "stackm.h"  #include "stackm.h"
 #include "extern.h"  #include "extern.h"
Line 120  static char *operatorType(type)
Line 121  static char *operatorType(type)
 #define Ssupmsg2 98  #define Ssupmsg2 98
 #define Scclass 99  #define Scclass 99
 #define Scoeff2 100  #define Scoeff2 100
   #define Stlimit 101
 /***********************************************/  /***********************************************/
 void printObject(ob,nl,fp)  void printObject(ob,nl,fp)
      struct object ob;       struct object ob;
Line 372  void  KdefinePrimitiveFunctions() {
Line 374  void  KdefinePrimitiveFunctions() {
   putPrimitiveFunction("system",Ssystem);    putPrimitiveFunction("system",Ssystem);
   putPrimitiveFunction("system_variable",Ssystem_variable);    putPrimitiveFunction("system_variable",Ssystem_variable);
   putPrimitiveFunction("test",Stest);    putPrimitiveFunction("test",Stest);
     putPrimitiveFunction("tlimit",Stlimit);
   putPrimitiveFunction("map",Smap);    putPrimitiveFunction("map",Smap);
   putPrimitiveFunction("to_records",Sto_records);    putPrimitiveFunction("to_records",Sto_records);
   putPrimitiveFunction("Usage",Susage);    putPrimitiveFunction("Usage",Susage);
Line 1671  int executePrimitive(ob) 
Line 1674  int executePrimitive(ob) 
       }        }
     */      */
     break;      break;
   
     case Stlimit:
       /* {   } time tlimit */
       ob2 = Kpop();
       ob1 = Kpop();
       switch(ob2.tag) {
           case Sinteger: break;
           default: errorStackmachine("Usage:tlimit"); break;
           }
       switch(ob1.tag) {
       case SexecutableArray: break;
       default:
         errorStackmachine("Usage:tlimit");
         break;
       }
       tokenArray = ob1.lc.tokenArray;
       size = ob1.rc.ival;
           n = ob2.lc.ival;
       i = 0;
           if (n > 0) {
             signal(SIGALRM,ctrlC); alarm((unsigned int) n);
             for (i=0; i<size; i++) {
                   token = tokenArray[i];
                   status = executeToken(token);
             }
             cancelAlarm();
           }else{
         before_real = time(&before_real);
         times(&before);
             for (i=0; i<size; i++) {
                   token = tokenArray[i];
                   status = executeToken(token);
             }
         times(&after);
         after_real = time(&after_real);
             ob1 = newObjectArray(3);
             putoa(ob1,0,KpoInteger((int) after.tms_utime - before.tms_utime));
             putoa(ob1,1,KpoInteger((int) after.tms_stime - before.tms_stime));
             putoa(ob1,2,KpoInteger((int) (after_real-before_real)));
             Kpush(ob1);
       }
           break;
   
   
   default:    default:

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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