My Project
Macros | Functions
mod2.h File Reference
#include "singularconfig.h"
#include "misc/auxiliary.h"

Go to the source code of this file.

Macros

#define SINGULAR_MAJOR_VERSION   4
 
#define SINGULAR_MINOR_VERSION   2
 
#define SINGULAR_SUB_VERSION   1
 
#define S_ROOT_DIR   ""
 
#define HAVE_GETTIMEOFDAY   1
 
#define TIME_WITH_SYS_TIME   1
 
#define HAVE_SYS_TIME_H   1
 
#define TIMER_RESOLUTION   1
 
#define SIQ   1
 
#define FAST_AND_DIRTY
 
#define HAVE_EIGENVAL   1
 
#define HAVE_GMS   1
 
#define HAVE_SIMPLEIPC   1
 
#define HAVE_PCV   1
 
#define HAVE_UNITS
 
#define HAVE_LIBPARSER
 
#define HAVE_VSPACE   1
 
#define PROFILER
 
#define HAVE_SPECTRUM   1
 
#define SINGULAR_PATCHLEVEL   2
 
#define SINGULAR_VERSION   ((SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION*10)+SINGULAR_PATCHLEVEL)
 
#define YYLPDEBUG   1
 
#define SEEK_END   2
 
#define SEEK_SET   0
 
#define LINKAGE
 
#define NO_INLINE
 
#define MDEBUG   0
 
#define OM_TRACK   4
 
#define OM_CHECK   1
 
#define OM_KEEP   0
 
#define OM_SING_KEEP   1000
 
#define KDEBUG   0
 
#define LDEBUG
 
#define RDEBUG
 
#define TEST
 
#define YYDEBUG   1
 
#define assume_violation(s, f, l)    dReportError("assume violation at %s:%d condition: %s", f,l,s)
 
#define assume(x)   _assume(x, __FILE__, __LINE__)
 
#define r_assume(x)   _r_assume(x, __FILE__, __LINE__)
 
#define _assume(x, f, l)
 
#define _r_assume(x, f, l)
 
#define __attribute__(x)   /*NOTHING*/
 
#define STRINGIFY(name)   #name
 
#define EXPANDED_STRINGIFY(name)   STRINGIFY(name)
 

Functions

void m2_end (int i)
 
static void HALT ()
 
int dReportError (const char *fmt,...)
 
void dErrorBreak ()
 

Macro Definition Documentation

◆ __attribute__

#define __attribute__ (   x)    /*NOTHING*/

Definition at line 427 of file mod2.h.

◆ _assume

#define _assume (   x,
  f,
  l 
)
Value:
do \
{ \
if (! (x)) \
{ \
assume_violation(#x, f, l); \
} \
} \
while (0)
int l
Definition: cfEzgcd.cc:100
Variable x
Definition: cfModGcd.cc:4082
FILE * f
Definition: checklibs.c:9

Definition at line 390 of file mod2.h.

◆ _r_assume

#define _r_assume (   x,
  f,
  l 
)
Value:
do \
{ \
if (! (x)) \
{ \
assume_violation(#x, f, l); \
return 0; \
} \
} \
while (0)

Definition at line 400 of file mod2.h.

◆ assume

#define assume (   x)    _assume(x, __FILE__, __LINE__)

Definition at line 387 of file mod2.h.

◆ assume_violation

#define assume_violation (   s,
  f,
  l 
)     dReportError("assume violation at %s:%d condition: %s", f,l,s)

Definition at line 384 of file mod2.h.

◆ EXPANDED_STRINGIFY

#define EXPANDED_STRINGIFY (   name)    STRINGIFY(name)

Definition at line 431 of file mod2.h.

◆ FAST_AND_DIRTY

#define FAST_AND_DIRTY

Definition at line 40 of file mod2.h.

◆ HAVE_EIGENVAL

#define HAVE_EIGENVAL   1

Definition at line 43 of file mod2.h.

◆ HAVE_GETTIMEOFDAY

#define HAVE_GETTIMEOFDAY   1

Definition at line 29 of file mod2.h.

◆ HAVE_GMS

#define HAVE_GMS   1

Definition at line 46 of file mod2.h.

◆ HAVE_LIBPARSER

#define HAVE_LIBPARSER

Definition at line 59 of file mod2.h.

◆ HAVE_PCV

#define HAVE_PCV   1

Definition at line 53 of file mod2.h.

◆ HAVE_SIMPLEIPC

#define HAVE_SIMPLEIPC   1

Definition at line 49 of file mod2.h.

◆ HAVE_SPECTRUM

#define HAVE_SPECTRUM   1

Definition at line 77 of file mod2.h.

◆ HAVE_SYS_TIME_H

#define HAVE_SYS_TIME_H   1

Definition at line 31 of file mod2.h.

◆ HAVE_UNITS

#define HAVE_UNITS

Definition at line 56 of file mod2.h.

◆ HAVE_VSPACE

#define HAVE_VSPACE   1

Definition at line 63 of file mod2.h.

◆ KDEBUG

#define KDEBUG   0

Definition at line 302 of file mod2.h.

◆ LDEBUG

#define LDEBUG

Definition at line 305 of file mod2.h.

◆ LINKAGE

#define LINKAGE

Definition at line 138 of file mod2.h.

◆ MDEBUG

#define MDEBUG   0

Definition at line 178 of file mod2.h.

◆ NO_INLINE

#define NO_INLINE

Definition at line 151 of file mod2.h.

◆ OM_CHECK

#define OM_CHECK   1

Definition at line 276 of file mod2.h.

◆ OM_KEEP

#define OM_KEEP   0

Definition at line 282 of file mod2.h.

◆ OM_SING_KEEP

#define OM_SING_KEEP   1000

Definition at line 288 of file mod2.h.

◆ OM_TRACK

#define OM_TRACK   4

Definition at line 272 of file mod2.h.

◆ PROFILER

#define PROFILER

Definition at line 70 of file mod2.h.

◆ r_assume

#define r_assume (   x)    _r_assume(x, __FILE__, __LINE__)

Definition at line 388 of file mod2.h.

◆ RDEBUG

#define RDEBUG

Definition at line 307 of file mod2.h.

◆ S_ROOT_DIR

#define S_ROOT_DIR   ""

Definition at line 22 of file mod2.h.

◆ SEEK_END

#define SEEK_END   2

Definition at line 109 of file mod2.h.

◆ SEEK_SET

#define SEEK_SET   0

Definition at line 113 of file mod2.h.

◆ SINGULAR_MAJOR_VERSION

#define SINGULAR_MAJOR_VERSION   4

Definition at line 19 of file mod2.h.

◆ SINGULAR_MINOR_VERSION

#define SINGULAR_MINOR_VERSION   2

Definition at line 20 of file mod2.h.

◆ SINGULAR_PATCHLEVEL

#define SINGULAR_PATCHLEVEL   2

Definition at line 84 of file mod2.h.

◆ SINGULAR_SUB_VERSION

#define SINGULAR_SUB_VERSION   1

Definition at line 21 of file mod2.h.

◆ SINGULAR_VERSION

Definition at line 85 of file mod2.h.

◆ SIQ

#define SIQ   1

Definition at line 37 of file mod2.h.

◆ STRINGIFY

#define STRINGIFY (   name)    #name

Definition at line 430 of file mod2.h.

◆ TEST

#define TEST

Definition at line 309 of file mod2.h.

◆ TIME_WITH_SYS_TIME

#define TIME_WITH_SYS_TIME   1

Definition at line 30 of file mod2.h.

◆ TIMER_RESOLUTION

#define TIMER_RESOLUTION   1

Definition at line 34 of file mod2.h.

◆ YYDEBUG

#define YYDEBUG   1

Definition at line 314 of file mod2.h.

◆ YYLPDEBUG

#define YYLPDEBUG   1

Definition at line 93 of file mod2.h.

Function Documentation

◆ dErrorBreak()

void dErrorBreak ( )

Definition at line 139 of file dError.cc.

140 {}

◆ dReportError()

int dReportError ( const char *  fmt,
  ... 
)

Definition at line 43 of file dError.cc.

44 {
45 #if 0
46 #ifdef HAVE_EXECINFO_H
47 #define SIZE 50
48  void *buffer[SIZE+1]; int ret;
49 #endif
50 #endif
51 
52  va_list ap;
53  va_start(ap, fmt);
54 #ifndef MAKE_DISTRIBUTION
55  fprintf(stderr, "\n// ***dError: ");
56  vfprintf(stderr, fmt, ap);
57 #if !defined(OM_NDEBUG)
58  #ifdef omPrintCurrentBackTraceMax
59  fprintf(stderr, " occurred at: \n");
60  omPrintCurrentBackTraceMax(stderr, 8);
61  #endif
62 #endif
63 
64 #if 0
65 #ifdef HAVE_EXECINFO_H
66  ret = backtrace( buffer, SIZE ); // execinfo.h
67  fprintf(stderr, "\nExecinfo backtrace (with %zd stack frames): \n", ret);
68 
69 #ifndef HAVE_GCC_ABI_DEMANGLE
70  backtrace_symbols_fd(buffer, ret, STDERR_FILENO); // execinfo.h
71 #else
72  char **ptr = backtrace_symbols( buffer, ret ); // execinfo.h
73 
74  int status;
75  char *demangledName;
76  char *s;
77  char *ss;
78  for (int i = 0; i < ret; i++)
79  {
80  status = -1;
81 
82  s = ptr[i];
83 // fprintf (stderr, " #%02d: %s\n", i, s);
84 
85  ss = index(s, '(');
86  ss[0] = 0;
87  fprintf (stderr, " #%02d: '%s': ", i, s);
88  ss[0] = '('; s = ss + 1;
89 
90  ss = index(s, '+');
91 
92  if ( ss != NULL )
93  {
94  ss[0] = 0;
95  demangledName = abi::__cxa_demangle( s, NULL, NULL, &status ); // cxxabi.h!
96  if( status == 0 && demangledName != NULL )
97  fprintf (stderr, " '%s'", (demangledName[0] != 0)? demangledName: s);
98  else
99  fprintf (stderr, " '%s'", s);
100 
101  malloc_free( demangledName );
102  ss[0] = '+';
103  s = ss + 1;
104  }
105 
106  ss = index(s, ')');
107  if( s != ss)
108  {
109  ss[0] = 0;
110  fprintf (stderr, " + %s", s);
111  ss[0] = ')';
112  }
113 
114  fprintf (stderr, " %s\n", ss + 2);
115  }
116  malloc_free (ptr);
117 #endif
118 #endif
119 
120 #undef SIZE
121 #endif
122 
123  dErrorBreak();
124 #else
125  fprintf(stderr, "\n// !!! YOU HAVE FOUND A BUG IN SINGULAR.");
126  fprintf(stderr, "// !!! Please, email the input\n// and the following error message to singular@mathematik.uni-kl.de")
127  vfprintf(stderr, fmt, ap);
128 #endif
129  return 0;
130 }
int i
Definition: cfEzgcd.cc:132
static void malloc_free(void *ptr)
Definition: dError.cc:22
void dErrorBreak()
Definition: dError.cc:139
const CanonicalForm int s
Definition: facAbsFact.cc:51
Definition: ap.h:40
#define NULL
Definition: omList.c:12
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
int * status
Definition: si_signals.h:51
#define omPrintCurrentBackTraceMax(A, B)
Definition: xalloc.h:319

◆ HALT()

static void HALT ( )
inlinestatic

Definition at line 124 of file mod2.h.

124 { m2_end(2);}
void m2_end(int i)
Definition: misc_ip.cc:1097

◆ m2_end()

void m2_end ( int  i)

Definition at line 1097 of file misc_ip.cc.

1098 {
1099  if (!m2_end_called)
1100  {
1101  EXTERN_VAR FILE* File_Profiling;
1103  m2_end_called = TRUE;
1104 #ifdef HAVE_SIMPLEIPC
1105  for (int j = SIPC_MAX_SEMAPHORES-1; j >= 0; j--)
1106  {
1107  if (semaphore[j] != NULL)
1108  {
1109  while (sem_acquired[j] > 0)
1110  {
1111 #if PORTABLE_SEMAPHORES
1112  sem_post(semaphore[j]->sig);
1113 #else
1114  sem_post(semaphore[j]);
1115 #endif
1116  sem_acquired[j]--;
1117  }
1118  }
1119  }
1120 #endif // HAVE_SIMPLEIPC
1122  monitor(NULL,0);
1123 #ifdef PAGE_TEST
1124  mmEndStat();
1125 #endif
1128  {
1130  while(hh!=NULL)
1131  {
1132  //Print("close %s\n",hh->l->name);
1133  slPrepClose(hh->l);
1134  hh=(link_list)hh->next;
1135  }
1137 
1138  idhdl h = currPack->idroot;
1139  while(h != NULL)
1140  {
1141  if(IDTYP(h) == LINK_CMD)
1142  {
1143  idhdl hh=h->next;
1144  //Print("kill %s\n",IDID(h));
1145  killhdl(h, currPack);
1146  h = hh;
1147  }
1148  else
1149  {
1150  h = h->next;
1151  }
1152  }
1153  hh=ssiToBeClosed;
1154  while(hh!=NULL)
1155  {
1156  //Print("close %s\n",hh->l->name);
1157  slClose(hh->l);
1158  hh=ssiToBeClosed;
1159  }
1160  }
1161  if (!singular_in_batchmode)
1162  {
1163  if (i<=0)
1164  {
1165  //extern long all_farey;
1166  //extern long farey_cnt;
1167  //if (all_farey!=0L) printf("farey:%ld, cnt=%ld\n",all_farey,farey_cnt);
1168  if (TEST_V_QUIET)
1169  {
1170  if (i==0)
1171  printf("Auf Wiedersehen.\n");
1172  else
1173  printf("\n$Bye.\n");
1174  }
1175  //#ifdef sun
1176  // #ifndef __svr4__
1177  // _cleanup();
1178  // _exit(0);
1179  // #endif
1180  //#endif
1181  i=0;
1182  }
1183  else
1184  {
1185  printf("\nhalt %d\n",i);
1186  }
1187  }
1188  exit(i);
1189  }
1190 }
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
Definition: idrec.h:35
VAR BOOLEAN singular_in_batchmode
Definition: cntrlc.cc:62
int j
Definition: facHensel.cc:110
void monitor(void *F, int mode)
Definition: febase.cc:68
void fe_reset_input_mode()
Definition: fereadl.c:827
VAR FILE * File_Profiling
Definition: fevoices.cc:32
#define EXTERN_VAR
Definition: globaldefs.h:6
VAR package currPack
Definition: ipid.cc:57
void killhdl(idhdl h, package proot)
Definition: ipid.cc:407
#define IDTYP(a)
Definition: ipid.h:119
STATIC_VAR Poly * h
Definition: janet.cc:971
volatile BOOLEAN m2_end_called
Definition: misc_ip.cc:1095
#define TEST_V_QUIET
Definition: options.h:134
VAR sipc_sem_t * semaphore[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:24
VAR int sem_acquired[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:25
#define SIPC_MAX_SEMAPHORES
Definition: simpleipc.h:10
@ LINK_CMD
Definition: tok.h:117