My Project
Loading...
Searching...
No Matches
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   3
 
#define SINGULAR_SUB_VERSION   2
 
#define SINGULAR_PATCHLEVEL   0
 
#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_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 (void)
 
int dReportError (const char *fmt,...)
 
void dErrorBreak (void)
 

Macro Definition Documentation

◆ __attribute__

#define __attribute__ (   x)    /*NOTHING*/

Definition at line 429 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 392 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 402 of file mod2.h.

◆ assume

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

Definition at line 389 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 386 of file mod2.h.

◆ EXPANDED_STRINGIFY

#define EXPANDED_STRINGIFY (   name)    STRINGIFY(name)

Definition at line 433 of file mod2.h.

◆ FAST_AND_DIRTY

#define FAST_AND_DIRTY

Definition at line 41 of file mod2.h.

◆ HAVE_EIGENVAL

#define HAVE_EIGENVAL   1

Definition at line 44 of file mod2.h.

◆ HAVE_GETTIMEOFDAY

#define HAVE_GETTIMEOFDAY   1

Definition at line 30 of file mod2.h.

◆ HAVE_GMS

#define HAVE_GMS   1

Definition at line 47 of file mod2.h.

◆ HAVE_LIBPARSER

#define HAVE_LIBPARSER

Definition at line 60 of file mod2.h.

◆ HAVE_PCV

#define HAVE_PCV   1

Definition at line 54 of file mod2.h.

◆ HAVE_SIMPLEIPC

#define HAVE_SIMPLEIPC   1

Definition at line 50 of file mod2.h.

◆ HAVE_SPECTRUM

#define HAVE_SPECTRUM   1

Definition at line 80 of file mod2.h.

◆ HAVE_SYS_TIME_H

#define HAVE_SYS_TIME_H   1

Definition at line 32 of file mod2.h.

◆ HAVE_UNITS

#define HAVE_UNITS

Definition at line 57 of file mod2.h.

◆ HAVE_VSPACE

#define HAVE_VSPACE   1

Definition at line 65 of file mod2.h.

◆ KDEBUG

#define KDEBUG   0

Definition at line 304 of file mod2.h.

◆ LDEBUG

#define LDEBUG

Definition at line 307 of file mod2.h.

◆ LINKAGE

#define LINKAGE

Definition at line 140 of file mod2.h.

◆ MDEBUG

#define MDEBUG   0

Definition at line 180 of file mod2.h.

◆ NO_INLINE

#define NO_INLINE

Definition at line 153 of file mod2.h.

◆ OM_CHECK

#define OM_CHECK   1

Definition at line 278 of file mod2.h.

◆ OM_KEEP

#define OM_KEEP   0

Definition at line 284 of file mod2.h.

◆ OM_SING_KEEP

#define OM_SING_KEEP   1000

Definition at line 290 of file mod2.h.

◆ OM_TRACK

#define OM_TRACK   4

Definition at line 274 of file mod2.h.

◆ PROFILER

#define PROFILER

Definition at line 73 of file mod2.h.

◆ r_assume

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

Definition at line 390 of file mod2.h.

◆ RDEBUG

#define RDEBUG

Definition at line 309 of file mod2.h.

◆ S_ROOT_DIR

#define S_ROOT_DIR   ""

Definition at line 23 of file mod2.h.

◆ SEEK_END

#define SEEK_END   2

Definition at line 111 of file mod2.h.

◆ SEEK_SET

#define SEEK_SET   0

Definition at line 115 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   3

Definition at line 20 of file mod2.h.

◆ SINGULAR_PATCHLEVEL

#define SINGULAR_PATCHLEVEL   0

Definition at line 22 of file mod2.h.

◆ SINGULAR_SUB_VERSION

#define SINGULAR_SUB_VERSION   2

Definition at line 21 of file mod2.h.

◆ SINGULAR_VERSION

Definition at line 87 of file mod2.h.

◆ SIQ

#define SIQ   1

Definition at line 38 of file mod2.h.

◆ STRINGIFY

#define STRINGIFY (   name)    #name

Definition at line 432 of file mod2.h.

◆ TEST

#define TEST

Definition at line 311 of file mod2.h.

◆ TIME_WITH_SYS_TIME

#define TIME_WITH_SYS_TIME   1

Definition at line 31 of file mod2.h.

◆ TIMER_RESOLUTION

#define TIMER_RESOLUTION   1

Definition at line 35 of file mod2.h.

◆ YYDEBUG

#define YYDEBUG   1

Definition at line 316 of file mod2.h.

◆ YYLPDEBUG

#define YYLPDEBUG   1

Definition at line 95 of file mod2.h.

Function Documentation

◆ dErrorBreak()

void dErrorBreak ( void  )

◆ dReportError()

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

Definition at line 44 of file dError.cc.

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

◆ HALT()

static void HALT ( void  )
inlinestatic

Definition at line 126 of file mod2.h.

126{ 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 {
1102 EXTERN_VAR FILE* File_Log;
1105 if (File_Log!=NULL)
1106 {
1107 fclose(File_Log);
1108 File_Log=NULL;
1109 if (File_Log_written==FALSE) // remove empty logs
1110 {
1111 int pid=getpid();
1112 char buf[20];
1113 sprintf(buf,"/tmp/sing_log.%d",pid);
1114 remove(buf);
1115 }
1116 }
1118#ifdef HAVE_SIMPLEIPC
1119 for (int j = SIPC_MAX_SEMAPHORES-1; j >= 0; j--)
1120 {
1121 if (semaphore[j] != NULL)
1122 {
1123 while (sem_acquired[j] > 0)
1124 {
1125#if PORTABLE_SEMAPHORES
1126 sem_post(semaphore[j]->sig);
1127#else
1128 sem_post(semaphore[j]);
1129#endif
1130 sem_acquired[j]--;
1131 }
1132 }
1133 }
1134#endif // HAVE_SIMPLEIPC
1135 monitor(NULL,0);
1136#ifdef PAGE_TEST
1137 mmEndStat();
1138#endif
1141 {
1143 while(hh!=NULL)
1144 {
1145 //Print("close %s\n",hh->l->name);
1146 slPrepClose(hh->l);
1147 hh=(link_list)hh->next;
1148 }
1150
1151 idhdl h = currPack->idroot;
1152 while(h != NULL)
1153 {
1154 if(IDTYP(h) == LINK_CMD)
1155 {
1156 idhdl hh=h->next;
1157 //Print("kill %s\n",IDID(h));
1158 killhdl(h, currPack);
1159 h = hh;
1160 }
1161 else
1162 {
1163 h = h->next;
1164 }
1165 }
1166 hh=ssiToBeClosed;
1167 while(hh!=NULL)
1168 {
1169 //Print("close %s\n",hh->l->name);
1170 slClose(hh->l);
1171 hh=ssiToBeClosed;
1172 }
1173 }
1175 {
1176 if (i<=0)
1177 {
1178 //extern long all_farey;
1179 //extern long farey_cnt;
1180 //if (all_farey!=0L) printf("farey:%ld, cnt=%ld\n",all_farey,farey_cnt);
1181 if (TEST_V_QUIET)
1182 {
1183 if (i==0)
1184 printf("Auf Wiedersehen.\n");
1185 else
1186 printf("\n$Bye.\n");
1187 }
1188 //#ifdef sun
1189 // #ifndef __svr4__
1190 // _cleanup();
1191 // _exit(0);
1192 // #endif
1193 //#endif
1194 i=0;
1195 }
1196 else
1197 {
1198 printf("\nhalt %d\n",i);
1199 }
1200 }
1201 exit(i);
1202 }
1203}
int BOOLEAN
Definition: auxiliary.h:87
#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:831
VAR FILE * File_Profiling
Definition: fevoices.cc:32
VAR BOOLEAN File_Log_written
Definition: fevoices.cc:34
VAR FILE * File_Log
Definition: fevoices.cc:33
#define EXTERN_VAR
Definition: globaldefs.h:6
VAR package currPack
Definition: ipid.cc:57
void killhdl(idhdl h, package proot)
Definition: ipid.cc:414
#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:135
VAR sipc_sem_t * semaphore[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:24
VAR int sem_acquired[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:25
int status int void * buf
Definition: si_signals.h:59
#define SIPC_MAX_SEMAPHORES
Definition: simpleipc.h:10
@ LINK_CMD
Definition: tok.h:117