source: git/Singular/mpsr_Put.h @ 6f2edc

spielwiese
Last change on this file since 6f2edc was feaddd, checked in by Olaf Bachmann <obachman@…>, 27 years ago
Thu Apr 10 11:59:41 1997 Olaf Bachmann <obachman@ratchwum.mathematik.uni-kl.de (Olaf Bachmann)> * remote quit is now arranged using MP_CopMpQuit * Updated mpsr_* files for new naming convention of MP v:1.1.2 git-svn-id: file:///usr/local/Singular/svn/trunk@146 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.6 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: mpsr_Put.h,v 1.3 1997-04-10 13:08:38 obachman Exp $ */
5/***************************************************************
6 *
7 * File:       mpsr_Put.h
8 * Purpose:    declarations for put routines for MP connection to Singular
9 * Author:     Olaf Bachmann (10/95)
10 *
11 * Change History (most recent first):
12 *  o 1/97 obachman
13 *    Updated putting routines to MP and MPP v1.1
14 *
15 ***************************************************************/
16
17#ifndef __MPSR_PUT__
18#define __MPSR_PUT__
19
20#include"mod2.h"
21
22#include"mpsr.h"
23
24#include"structs.h"
25#include"febase.h"
26#include"tok.h"
27#include"ipid.h"
28
29#include"MP_BasicDict.h"
30#include"MP_MatrixDict.h"
31#include"MP_PolyDict.h"
32#include"MP_NumberDict.h"
33#include"MP_ProtoDict.h"
34#include"MP_MpDict.h"
35
36
37/***************************************************************
38 * 1.) Some handy macros
39 *
40 ***************************************************************/
41// some often used flags settings for annotations
42#define MP_AnnotReqValTree 0x07
43#define MP_AnnotReqValNode 0x06
44
45/***************************************************************
46 *
47 * There are 4 different layers on which things are put:
48 * 1.) Singular Top-level Data (chains of leftv's)
49 * 2.) Leftv Data
50 * 3.) Plain Singular data
51 * 4.) MP primitive polynomial data
52 *
53 ***************************************************************/
54
55/***************************************************************
56 * 4.) Low-level polynomial data -- they should only be used internally
57 *
58 ***************************************************************/
59extern mpsr_Status_t mpsr_PutPolyData(MP_Link_pt link, poly p, ring cring);
60extern mpsr_Status_t mpsr_PutPolyVectorData(MP_Link_pt link, poly p,ring cring);
61extern int          mpsr_GetNumOfRingAnnots(ring cring, BOOLEAN mv);
62extern mpsr_Status_t mpsr_PutRingAnnots(MP_Link_pt link, ring cring,BOOLEAN mv);
63
64/***************************************************************
65 * 3.) Routines for Putting Plain Singular data
66 *
67 ***************************************************************/
68// First, ring-independent data
69inline mpsr_Status_t mpsr_PutInt(MP_Link_pt link, int i)
70{
71  mp_return(MP_PutSint32Packet(link, (MP_Sint32_t) i, 0));
72}
73extern mpsr_Status_t mpsr_PutIntVec(MP_Link_pt link, intvec *iv);
74extern mpsr_Status_t mpsr_PutIntMat(MP_Link_pt link, intvec *iv);
75inline mpsr_Status_t mpsr_PutString(MP_Link_pt link, char *str)
76{
77  if (strcmp(str, MPSR_QUIT_STRING) == 0)
78    mp_return(MP_PutCommonOperatorPacket(link,
79                                         MP_MpDict,
80                                         MP_CopMpEndSession,
81                                         0, 0));
82  else
83    mp_return(MP_PutStringPacket(link, str, 0));
84}
85extern mpsr_Status_t mpsr_PutRing(MP_Link_pt link, ring r);
86extern mpsr_Status_t mpsr_PutProc(MP_Link_pt link,  char *pname, char* proc);
87inline mpsr_Status_t mpsr_PutDef(MP_Link_pt link, char *name)
88{
89  mp_return(MP_PutIdentifierPacket(link, MP_SingularDict, name, 0));
90}
91// next, ring-dependent data
92extern mpsr_Status_t mpsr_PutList(MP_Link_pt link, lists l, ring cring);
93extern mpsr_Status_t mpsr_PutCopCommand(MP_Link_pt link, command c, ring cring);
94extern mpsr_Status_t mpsr_PutOpCommand(MP_Link_pt link, command c, ring cring);
95extern mpsr_Status_t mpsr_PutNumber(MP_Link_pt link,number n,ring cring);
96extern mpsr_Status_t mpsr_PutPoly(MP_Link_pt link,poly p,ring cring);
97extern mpsr_Status_t mpsr_PutPolyVector(MP_Link_pt link,poly p,ring cring);
98extern mpsr_Status_t mpsr_PutIdeal(MP_Link_pt link, ideal id, ring cring);
99extern mpsr_Status_t mpsr_PutModule(MP_Link_pt link, ideal id, ring cring);
100extern mpsr_Status_t mpsr_PutMatrix(MP_Link_pt link, ideal id, ring cring);
101extern mpsr_Status_t mpsr_PutMap(MP_Link_pt link, map m, ring cring);
102
103
104
105/***************************************************************
106 * 2.) Routines for Putting Singular Leftv's
107 *
108 *
109 ***************************************************************/
110// The "Master routine, which takes any leftv, and calls the respective
111// Put routine
112extern mpsr_Status_t mpsr_PutLeftv(MP_Link_pt link, leftv v, ring cring);
113
114// A handy macro which checks for the type of leftvs
115#ifdef MPSR_DEBUG
116#define typecheck(v,type)                           \
117do if ((v)->Typ() != (type))                        \
118{                                                   \
119  return mpsr_SetError(mpsr_WrongLeftvType);        \
120}                                                   \
121while (0)
122#else
123#define typecheck(v,type)   ((void) 0)
124#endif
125
126// First, ring-independent data
127inline mpsr_Status_t mpsr_PutIntLeftv(MP_Link_pt link, leftv v)
128{
129  typecheck(v, INT_CMD);
130  mp_return(MP_PutSint32Packet(link, (MP_Sint32_t) v->Data(), 0));
131}
132inline mpsr_Status_t mpsr_PutIntVecLeftv(MP_Link_pt link, leftv v)
133{
134  typecheck(v, INTVEC_CMD);
135  return mpsr_PutIntVec(link, (intvec *) v->Data());
136}
137inline mpsr_Status_t mpsr_PutIntMatLeftv(MP_Link_pt link, leftv v)
138{
139  typecheck(v, INTMAT_CMD);
140  return mpsr_PutIntMat(link, (intvec *) v->Data());
141}
142inline mpsr_Status_t mpsr_PutStringLeftv(MP_Link_pt link, leftv v)
143{
144  typecheck(v, STRING_CMD);
145  return   mpsr_PutString(link, (char *) v->Data());
146}
147inline mpsr_Status_t mpsr_PutRingLeftv(MP_Link_pt link, leftv v)
148{
149  typecheck(v, RING_CMD);
150  return mpsr_PutRing(link, (ring) v->Data());
151}
152inline mpsr_Status_t mpsr_PutQRingLeftv(MP_Link_pt link, leftv v)
153{
154  typecheck(v, QRING_CMD);
155  return mpsr_PutRing(link, (ring) v->Data());
156}
157inline mpsr_Status_t mpsr_PutProcLeftv(MP_Link_pt link, leftv v)
158{
159  typecheck(v, PROC_CMD);
160  return mpsr_PutProc(link, v->name, (char *) v->Data());
161}
162inline mpsr_Status_t mpsr_PutDefLeftv(MP_Link_pt link, leftv v)
163{
164  typecheck(v, DEF_CMD);
165  return mpsr_PutDef(link, (char *) v->name);
166}
167// now the ring-dependent leftv's
168inline mpsr_Status_t mpsr_PutListLeftv(MP_Link_pt link, leftv v, ring cring)
169{
170  typecheck(v, LIST_CMD);
171  return mpsr_PutList(link, (lists) v->Data(), cring);
172}
173inline mpsr_Status_t mpsr_PutCommandLeftv(MP_Link_pt link, leftv v, ring cring)
174{
175  command cmd = (command) v->Data();
176 
177  typecheck(v, COMMAND);
178  if (cmd->op == PROC_CMD)
179    return mpsr_PutOpCommand(link, cmd, cring);
180  else
181    return mpsr_PutCopCommand(link, cmd , cring);
182}
183inline mpsr_Status_t mpsr_PutNumberLeftv(MP_Link_pt link, leftv v, ring cring)
184{
185  typecheck(v, NUMBER_CMD);
186  return mpsr_PutNumber(link, (number) v->Data(), cring);
187}
188inline mpsr_Status_t mpsr_PutPolyLeftv(MP_Link_pt link, leftv v, ring cring)
189{
190  typecheck(v, POLY_CMD);
191  return mpsr_PutPoly(link, (poly) v->Data(), cring);
192}
193inline mpsr_Status_t mpsr_PutIdealLeftv(MP_Link_pt link, leftv v, ring cring)
194{
195  typecheck(v, IDEAL_CMD);
196  return mpsr_PutIdeal(link, (ideal) v->Data(), cring);
197}
198inline mpsr_Status_t mpsr_PutVectorLeftv(MP_Link_pt link, leftv v, ring cring)
199{
200  typecheck(v, VECTOR_CMD);
201  return mpsr_PutPolyVector(link, (poly) v->Data(), cring);
202}
203inline mpsr_Status_t mpsr_PutMatrixLeftv(MP_Link_pt link, leftv v, ring cring)
204{
205  typecheck(v, MATRIX_CMD);
206  return mpsr_PutMatrix(link, (ideal) v->Data(), cring);
207}
208inline mpsr_Status_t mpsr_PutModuleLeftv(MP_Link_pt link, leftv v, ring cring)
209{
210  typecheck(v, MODUL_CMD);
211  return mpsr_PutModule(link, (ideal) v->Data(), cring);
212}
213inline mpsr_Status_t mpsr_PutMapLeftv(MP_Link_pt link, leftv v, ring cring)
214{
215  typecheck(v, MAP_CMD);
216  return mpsr_PutMap(link, (map) v->Data(), cring);
217}
218
219/***************************************************************
220 * 1.)  Singular Top-level Data (chains of leftv's)
221 *      They are send as on MP mesg
222 *
223 ***************************************************************/
224extern mpsr_Status_t mpsr_PutMsg(MP_Link_pt l, leftv v);
225
226#endif
Note: See TracBrowser for help on using the repository browser.