Changeset feaddd in git
- Timestamp:
- Apr 10, 1997, 3:08:40 PM (26 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 91882f721049d2a9b2c3a5acda3db060a136600a
- Parents:
- 6ae4f5a3079ec71b3f884bb50eb22a3919c9f9fb
- Location:
- Singular
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ChangeLog
r6ae4f5 rfeaddd 1 Thu Apr 10 11:59:41 1997 Olaf Bachmann <obachman@ratchwum.mathematik.uni-kl.de (Olaf Bachmann)> 2 3 * remote quit is now arranged using MP_CopMpQuit 4 5 * Updated mpsr_* files for new naming convention of MP v:1.1.2 6 7 Tue Apr 8 10:43:48 1997 Olaf Bachmann <obachman@ratchwum.mathematik.uni-kl.de (Olaf Bachmann)> 8 9 * Reimplemented link structures. Cleaned it up. Introduced assignment 10 link = link. Fixed some bugs in asciidump. Made proc's work for MP links. 11 1 12 Sat Mar 29 16:01:39 1997 Olaf Bachmann <obachman@ratchwum.mathematik.uni-kl.de (Olaf Bachmann)> 2 13 -
Singular/mpsr.h
r6ae4f5 rfeaddd 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpsr.h,v 1. 4 1997-04-09 12:20:01 SingularExp $ */4 /* $Id: mpsr.h,v 1.5 1997-04-10 13:08:35 obachman Exp $ */ 5 5 /*************************************************************** 6 6 * … … 121 121 #define MP_AnnotSingularGalois 1 122 122 // String used to indicate the end of a communication 123 #define MPSR_QUIT_STRING "MPSR::Quit" 124 #define MPSR_DEFAULT_DUMP_FILE "mpsr_dump.mp" 123 #define MPSR_QUIT_STRING "MPtcp:quit" 125 124 126 125 // some handy Macros for error handlings -
Singular/mpsr_Get.cc
r6ae4f5 rfeaddd 3 3 ****************************************/ 4 4 5 /* $Id: mpsr_Get.cc,v 1. 7 1997-04-08 08:43:24obachman Exp $ */5 /* $Id: mpsr_Get.cc,v 1.8 1997-04-10 13:08:36 obachman Exp $ */ 6 6 /*************************************************************** 7 7 * … … 35 35 #include "MP_BasicDict.h" 36 36 #include "MP_ProtoDict.h" 37 #include "MP_MpDict.h" 37 38 38 39 #include <limits.h> … … 82 83 MPT_Tree_pt tree = MPT_GetProtoTypespec(node); 83 84 return tree != NULL && NodeCheck(tree->node, MP_CommonMetaType, 84 MP_ProtoDict, MP_CmtProto Sint32);85 MP_ProtoDict, MP_CmtProtoIMP_Sint32); 85 86 } 86 87 … … 91 92 MPT_Tree_pt tree = MPT_GetProtoTypespec(node); 92 93 return tree != NULL && NodeCheck(tree->node, MP_CommonMetaType, 93 MP_ProtoDict, MP_CmtProto Sint32);94 MP_ProtoDict, MP_CmtProtoIMP_Sint32); 94 95 } 95 96 … … 160 161 } 161 162 163 inline BOOLEAN IsQuitNode(MPT_Node_pt node) 164 { 165 return NodeCheck(node, MP_MpDict, MP_CopMpEndSession); 166 } 167 162 168 // 163 169 // Init*Leftv functions … … 279 285 } 280 286 287 inline mpsr_Status_t GetQuitLeftv(mpsr_leftv mlv) 288 { 289 mlv->lv = mpsr_InitLeftv(STRING_CMD, (void *) mstrdup(MPSR_QUIT_STRING)); 290 return mpsr_Success; 291 } 292 281 293 /*************************************************************** 282 294 * … … 293 305 mlv1.r = NULL; 294 306 295 MP_SkipMsg(link);296 297 if ( ! MP_TestEofMsg(link))307 status = (MP_InitMsg(link) == MP_Success ? mpsr_Success : mpsr_MP_Failure); 308 309 if (status == mpsr_Success && ! MP_TestEofMsg(link)) 298 310 status = mpsr_GetLeftv(link, &mlv, 0); 299 311 else 300 312 { 301 313 lv = mpsr_InitLeftv(NONE, NULL); 302 return mpsr_Success; 303 } 304 314 return status; 315 } 305 316 306 317 // handle more than one leftv (ie. chains of leftv's) … … 329 340 lv = mlv.lv; 330 341 } 331 else lv = NULL;342 else lv = mpsr_InitLeftv(NONE, NULL); 332 343 333 344 return status; … … 429 440 else if (IsMatrixNode(node, mlv->r)) 430 441 return GetMatrixLeftv(link, node, mlv); 442 else if (IsQuitNode(node)) 443 return GetQuitLeftv(mlv); 431 444 // Map 432 445 else … … 754 767 } 755 768 769 756 770 /*************************************************************** 757 771 * -
Singular/mpsr_GetPoly.cc
r6ae4f5 rfeaddd 3 3 ****************************************/ 4 4 5 /* $Id: mpsr_GetPoly.cc,v 1. 4 1997-04-02 15:07:39 SingularExp $ */5 /* $Id: mpsr_GetPoly.cc,v 1.5 1997-04-10 13:08:37 obachman Exp $ */ 6 6 7 7 /*************************************************************** … … 16 16 17 17 #ifdef HAVE_MPSR 18 #include "limits.h" 18 19 19 20 #include "mpsr_Get.h" … … 38 39 #include "MP_ProtoDict.h" 39 40 40 #include "limits.h"41 41 42 42 #ifdef PARI_BIGINT_TEST … … 176 176 MP_Boolean_t req = 0; 177 177 178 mp_failr(IMP_GetNodeHeader(link,&node,& cvalue,&dict, &num_annots,178 mp_failr(IMP_GetNodeHeader(link,&node,&dict, &cvalue, &num_annots, 179 179 &num_child)); 180 180 … … 226 226 MP_Boolean_t req; 227 227 228 mp_failr(IMP_GetNodeHeader(link,&node,&cvalue,&dict, &num_annots, &num_child)); 228 mp_failr(IMP_GetNodeHeader(link,&node,&dict, &cvalue, &num_annots, 229 &num_child)); 229 230 230 231 // start with the most frequent cases … … 630 631 631 632 node = val->node; 632 falser(NodeCheck(node, MP_CommonMetaType, MP_ProtoDict, MP_CmtProto Sint32));633 falser(NodeCheck(node, MP_CommonMetaType, MP_ProtoDict, MP_CmtProtoIMP_Sint32)); 633 634 634 635 // consider the first arg -- which specify the coeffs … … 638 639 { 639 640 // char 0 640 if (MP_COMMON_T(node->nvalue) == MP_CmtNumber Rational &&641 if (MP_COMMON_T(node->nvalue) == MP_CmtNumberMP_Rational && 641 642 node->dict == MP_NumberDict) 642 643 { … … 644 645 // Hmm ... we should check for the normalized annot 645 646 } 646 else if (MP_COMMON_T(node->nvalue) == MP_CmtProto Uint32 &&647 else if (MP_COMMON_T(node->nvalue) == MP_CmtProtoIMP_Uint32 && 647 648 node->dict == MP_ProtoDict && 648 649 (annot = MPT_FindAnnot(node,MP_NumberDict,MP_AnnotNumberModulos)) … … 667 668 } 668 669 } 669 else if (MP_COMMON_T(node->nvalue) == MP_CmtProto Real32 &&670 else if (MP_COMMON_T(node->nvalue) == MP_CmtProtoIMP_Real32 && 670 671 node->dict == MP_ProtoDict) 671 672 { … … 727 728 if (val != NULL && 728 729 NodeCheck(val->node, MP_CommonMetaType, MP_ProtoDict, 729 MP_CmtProtoI dentifier))730 MP_CmtProtoIMP_Identifier)) 730 731 { 731 732 MPT_Arg_pt arg_pt = annot->value->args; … … 886 887 if (annot2 == NULL || 887 888 ! NodeCheck(annot2->value->node, MP_CommonMetaType, MP_ProtoDict, 888 MP_CmtProto Sint32))889 MP_CmtProtoIMP_Sint32)) 889 890 return mpsr_Failure; 890 891 -
Singular/mpsr_Put.cc
r6ae4f5 rfeaddd 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpsr_Put.cc,v 1. 5 1997-04-02 15:07:40 SingularExp $ */4 /* $Id: mpsr_Put.cc,v 1.6 1997-04-10 13:08:37 obachman Exp $ */ 5 5 6 6 … … 101 101 return mpsr_PutDefLeftv(link, v); 102 102 103 // now potentially ring-dependent types103 // now potentially ring-dependent types 104 104 case LIST_CMD: 105 105 return mpsr_PutListLeftv(link,v, cring); … … 147 147 // Put the Vector Operator 148 148 mp_failr(MP_PutCommonOperatorPacket(link, 149 MP_CopMatrixDenseVector,150 MP_MatrixDict,151 1,152 length));149 MP_MatrixDict, 150 MP_CopMatrixDenseVector, 151 1, 152 length)); 153 153 // Prototype Annot 154 154 mp_failr(MP_PutAnnotationPacket(link, 155 MP_ProtoDict, 155 156 MP_AnnotProtoPrototype, 156 MP_ProtoDict, 157 MP_AnnotReqValNode)); 158 // Together with the CommonMetaPacket specifying that each element of 157 MP_AnnotReqValNode)); 158 // Together with the CommonMetaTypePacket specifying that each element of 159 159 // the vector is an Sint32 160 mp_failr(MP_PutCommonMetaPacket(link, MP_CmtProtoSint32, 161 MP_ProtoDict, 0)); 160 mp_failr(MP_PutCommonMetaTypePacket(link, 161 MP_ProtoDict, 162 MP_CmtProtoIMP_Sint32, 163 0)); 162 164 163 165 // Now we finally put the data … … 172 174 // First, we put the Matrix operator 173 175 mp_failr(MP_PutCommonOperatorPacket(link, 174 MP_CopMatrixDenseMatrix,175 MP_MatrixDict,176 2,177 length));176 MP_MatrixDict, 177 MP_CopMatrixDenseMatrix, 178 2, 179 length)); 178 180 // Put the two annotations 179 181 // First, the prototype annot 180 182 mp_failr(MP_PutAnnotationPacket(link, 181 MP_AnnotProtoPrototype, 182 MP_ProtoDict, 183 MP_AnnotReqValNode)); 184 mp_failr(MP_PutCommonMetaPacket(link, MP_CmtProtoSint32, MP_ProtoDict, 0)); 183 MP_ProtoDict, 184 MP_AnnotProtoPrototype, 185 MP_AnnotReqValNode)); 186 mp_failr(MP_PutCommonMetaTypePacket(link, 187 MP_ProtoDict, 188 MP_CmtProtoIMP_Sint32, 189 0)); 185 190 // And second, the dimension annot 186 191 mp_failr(MP_PutAnnotationPacket(link, 187 MP_AnnotMatrixDimension,188 MP_MatrixDict,189 MP_AnnotReqValNode));192 MP_MatrixDict, 193 MP_AnnotMatrixDimension, 194 MP_AnnotReqValNode)); 190 195 // which specifies the dimesnion of the matrix 191 196 mp_failr(MP_PutCommonOperatorPacket(link, 192 MP_CopBasicList, 193 MP_BasicDict, 194 0, 2)); 197 MP_BasicDict, 198 MP_CopBasicList, 199 0, 200 2)); 195 201 mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) r, 0)); 196 202 mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) c, 0)); … … 204 210 { 205 211 mp_failr(MP_PutCommonOperatorPacket(link, 206 MP_CopPolyRing,207 MP_PolyDict,208 mpsr_GetNumOfRingAnnots(cring, 1),209 0));212 MP_PolyDict, 213 MP_CopPolyRing, 214 mpsr_GetNumOfRingAnnots(cring, 1), 215 0)); 210 216 return mpsr_PutRingAnnots(link, cring, 1); 211 217 } … … 220 226 // A Singular- procedure is sent as a cop with the string as arg 221 227 mp_failr(MP_PutCommonOperatorPacket(link, 222 cop, 223 dict, 224 0, 225 2)); 226 mp_failr(MP_PutIdentifierPacket(link, pname, MP_BasicDict, 1)); 227 mp_failr(MP_PutAnnotationPacket(link, MP_AnnotSingularProcDef, 228 MP_SingularDict, 0)); 228 dict, 229 cop, 230 0, 231 2)); 232 mp_failr(MP_PutIdentifierPacket(link, MP_SingularDict, pname,1)); 233 mp_failr(MP_PutAnnotationPacket(link, 234 MP_SingularDict, 235 MP_AnnotSingularProcDef, 236 0)); 229 237 mp_return(MP_PutStringPacket(link, proc, 0)); 230 238 } … … 251 259 252 260 mp_failr(MP_PutCommonOperatorPacket(link, 253 MP_CopBasicList,254 MP_BasicDict,255 0,256 nl));261 MP_BasicDict, 262 MP_CopBasicList, 263 0, 264 nl)); 257 265 for (i=0; i<nl; i++) 258 266 failr(mpsr_PutLeftv(link, &(l->m[i]), cring)); … … 273 281 274 282 // and put the common operator 275 mp_failr(MP_PutCommonOperatorPacket(link, cop, dict, 0, nc));283 mp_failr(MP_PutCommonOperatorPacket(link, dict, cop, 0, nc)); 276 284 277 285 // now we Put the arguments … … 298 306 { 299 307 mp_failr(MP_PutOperatorPacket(link, 300 (char *) (cmd->arg1.Data()),301 MP_SingularDict,302 0,303 (cmd->argc <= 1 ? 0 :(cmd->arg2).listLength())));308 MP_SingularDict, 309 (char *) (cmd->arg1.Data()), 310 0, 311 (cmd->argc <= 1 ? 0 :(cmd->arg2).listLength()))); 304 312 if (cmd->argc > 1) 305 313 return PutLeftvChain(link, &(cmd->arg2), cring); … … 337 345 { 338 346 mp_failr(MP_PutCommonOperatorPacket(link, 339 MP_CopPolyDenseDistPoly,340 MP_PolyDict,341 mpsr_GetNumOfRingAnnots(cring, 0),342 pLength(p)));347 MP_PolyDict, 348 MP_CopPolyDenseDistPoly, 349 mpsr_GetNumOfRingAnnots(cring, 0), 350 pLength(p))); 343 351 failr(mpsr_PutRingAnnots(link, cring, 0)); 344 352 return mpsr_PutPolyData(link, p, cring); … … 349 357 { 350 358 mp_failr(MP_PutCommonOperatorPacket(link, 351 MP_CopPolyDenseDistPoly,352 MP_PolyDict,353 mpsr_GetNumOfRingAnnots(cring,1),354 pLength(p)));359 MP_PolyDict, 360 MP_CopPolyDenseDistPoly, 361 mpsr_GetNumOfRingAnnots(cring,1), 362 pLength(p))); 355 363 failr(mpsr_PutRingAnnots(link, cring, 1)); 356 364 return mpsr_PutPolyVectorData(link, p, cring); … … 363 371 364 372 mp_failr(MP_PutCommonOperatorPacket(link, 365 MP_CopPolyIdeal,366 MP_PolyDict,367 1,368 idn));369 mp_failr(MP_PutAnnotationPacket(link, 370 MP_AnnotProtoPrototype,371 MP_ProtoDict,372 MP_AnnotReqValNode));373 MP_PolyDict, 374 MP_CopPolyIdeal, 375 1, 376 idn)); 377 mp_failr(MP_PutAnnotationPacket(link, 378 MP_ProtoDict, 379 MP_AnnotProtoPrototype, 380 MP_AnnotReqValNode)); 373 381 mp_failr(MP_PutCommonMetaOperatorPacket(link, 374 MP_CopPolyDenseDistPoly,375 MP_PolyDict,376 mpsr_GetNumOfRingAnnots(cring, 0),377 0));382 MP_PolyDict, 383 MP_CopPolyDenseDistPoly, 384 mpsr_GetNumOfRingAnnots(cring, 0), 385 0)); 378 386 failr(mpsr_PutRingAnnots(link, cring, 0)); 379 387 … … 391 399 392 400 mp_failr(MP_PutCommonOperatorPacket(link, 393 MP_CopPolyModule,394 MP_PolyDict,395 1,396 idn));397 mp_failr(MP_PutAnnotationPacket(link, 398 MP_AnnotProtoPrototype,399 MP_ProtoDict,400 MP_AnnotReqValNode));401 MP_PolyDict, 402 MP_CopPolyModule, 403 1, 404 idn)); 405 mp_failr(MP_PutAnnotationPacket(link, 406 MP_ProtoDict, 407 MP_AnnotProtoPrototype, 408 MP_AnnotReqValNode)); 401 409 mp_failr(MP_PutCommonMetaOperatorPacket(link, 402 MP_CopPolyDenseDistPoly,403 MP_PolyDict,404 mpsr_GetNumOfRingAnnots(cring, 1),405 0));410 MP_PolyDict, 411 MP_CopPolyDenseDistPoly, 412 mpsr_GetNumOfRingAnnots(cring, 1), 413 0)); 406 414 failr(mpsr_PutRingAnnots(link, cring, 1)); 407 415 … … 421 429 // First, we put the Matrix operator 422 430 mp_failr(MP_PutCommonOperatorPacket(link, 423 MP_CopMatrixDenseMatrix,424 MP_MatrixDict,425 2,426 n));431 MP_MatrixDict, 432 MP_CopMatrixDenseMatrix, 433 2, 434 n)); 427 435 // Put the two annotations 428 436 // First, the prototype annot 429 437 mp_failr(MP_PutAnnotationPacket(link, 430 MP_AnnotProtoPrototype,431 MP_ProtoDict,432 MP_AnnotReqValNode));438 MP_ProtoDict, 439 MP_AnnotProtoPrototype, 440 MP_AnnotReqValNode)); 433 441 mp_failr(MP_PutCommonMetaOperatorPacket(link, 434 MP_CopPolyDenseDistPoly,435 MP_PolyDict,436 mpsr_GetNumOfRingAnnots(cring, 0),437 0));442 MP_PolyDict, 443 MP_CopPolyDenseDistPoly, 444 mpsr_GetNumOfRingAnnots(cring, 0), 445 0)); 438 446 failr(mpsr_PutRingAnnots(link, cring, 0)); 439 447 440 448 // second, the matrix dim annot 441 449 mp_failr(MP_PutAnnotationPacket(link, 442 MP_AnnotMatrixDimension,443 MP_MatrixDict,444 MP_AnnotReqValNode));450 MP_MatrixDict, 451 MP_AnnotMatrixDimension, 452 MP_AnnotReqValNode)); 445 453 // which specifies the dimesnion of the matrix 446 454 mp_failr(MP_PutCommonOperatorPacket(link, 447 MP_CopBasicList,448 MP_BasicDict,449 0, 2));455 MP_BasicDict, 456 MP_CopBasicList, 457 0, 2)); 450 458 mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) nrows, 0)); 451 459 mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) ncols, 0)); … … 472 480 473 481 mp_failr(MP_PutCommonOperatorPacket(link, 474 cop,475 dict,476 0,477 3));482 dict, 483 cop, 484 0, 485 3)); 478 486 // First, is the ring 479 487 failr(mpsr_PutRingLeftv(link, (leftv) idroot->get(m->preimage, 1))); … … 539 547 if (mpsr_PutLeftv(link, lv, r) != mpsr_Success) break; 540 548 #ifdef MPSR_DEBUG 541 Print("Dumped %s\n", IDID(h2));549 Print("Dumped %s\n", IDID(h2)); 542 550 #endif 543 551 h2 = h2->next; -
Singular/mpsr_Put.h
r6ae4f5 rfeaddd 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpsr_Put.h,v 1. 2 1997-04-09 12:20:03 SingularExp $ */4 /* $Id: mpsr_Put.h,v 1.3 1997-04-10 13:08:38 obachman Exp $ */ 5 5 /*************************************************************** 6 6 * … … 32 32 #include"MP_NumberDict.h" 33 33 #include"MP_ProtoDict.h" 34 34 #include"MP_MpDict.h" 35 35 36 36 … … 75 75 inline mpsr_Status_t mpsr_PutString(MP_Link_pt link, char *str) 76 76 { 77 mp_return(MP_PutStringPacket(link, str, 0)); 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)); 78 84 } 79 85 extern mpsr_Status_t mpsr_PutRing(MP_Link_pt link, ring r); … … 81 87 inline mpsr_Status_t mpsr_PutDef(MP_Link_pt link, char *name) 82 88 { 83 mp_return(MP_PutIdentifierPacket(link, name, 0, 0));89 mp_return(MP_PutIdentifierPacket(link, MP_SingularDict, name, 0)); 84 90 } 85 91 // next, ring-dependent data -
Singular/mpsr_PutPoly.cc
r6ae4f5 rfeaddd 3 3 ****************************************/ 4 4 5 /* $Id: mpsr_PutPoly.cc,v 1. 4 1997-04-02 15:07:41 SingularExp $ */5 /* $Id: mpsr_PutPoly.cc,v 1.5 1997-04-10 13:08:39 obachman Exp $ */ 6 6 7 7 /*************************************************************** … … 165 165 // send number itself 166 166 mp_failr(MP_PutCommonOperatorPacket(link, 167 MP_CopBasicDiv,168 MP_BasicDict,169 0,170 2));171 167 MP_BasicDict, 168 MP_CopBasicDiv, 169 0, 170 2)); 171 // and now sent nominator and denominator 172 172 mp_failr(MP_MyPutApIntPacket(link, (MP_ApInt_t) &(a->z), 0)); 173 173 mp_return(MP_MyPutApIntPacket(link, (MP_ApInt_t) &(a->n), 0)); … … 251 251 252 252 if (cring != CurrPutRing) 253 253 SetPutFuncs(cring); 254 254 255 255 #ifdef MPSR_DEBUG … … 339 339 if (mv) 340 340 mp_failr(MP_PutAnnotationPacket(link, 341 MP_AnnotPolyModuleVector,342 MP_PolyDict,343 MP_AnnotRequired));341 MP_PolyDict, 342 MP_AnnotPolyModuleVector, 343 MP_AnnotRequired)); 344 344 // Hmm .. this is not according to a "proper" Singular ring, 345 345 // but to be used in a recursive call of mpsr_PutRingAnnots … … 354 354 355 355 static mpsr_Status_t PutProtoTypeAnnot(MP_Link_pt link, ring r, 356 BOOLEAN mv)356 BOOLEAN mv) 357 357 { 358 358 // each element of the poly is a 359 359 mp_failr(MP_PutAnnotationPacket(link, 360 MP_AnnotProtoPrototype,361 MP_ProtoDict,362 MP_AnnotReqValNode));360 MP_ProtoDict, 361 MP_AnnotProtoPrototype, 362 MP_AnnotReqValNode)); 363 363 // Monom represented as a struct of 2 elements 364 364 mp_failr(MP_PutCommonOperatorPacket(link, 365 MP_CopProtoStruct,366 MP_ProtoDict,367 0,368 2));365 MP_ProtoDict, 366 MP_CopProtoStruct, 367 0, 368 2)); 369 369 370 370 // First element is the coefficient … … 372 372 { 373 373 // rational numbers 374 mp_failr(MP_PutCommonMeta Packet(link,375 MP_CmtNumberRational,376 MP_NumberDict,377 1));374 mp_failr(MP_PutCommonMetaTypePacket(link, 375 MP_NumberDict, 376 MP_CmtNumberMP_Rational, 377 1)); 378 378 // are always normalized (and made that way, if necessary) 379 379 mp_failr(MP_PutAnnotationPacket(link, 380 MP_AnnotNumberIsNormalized,381 MP_NumberDict,382 0));380 MP_NumberDict, 381 MP_AnnotNumberIsNormalized, 382 0)); 383 383 } 384 384 else if ((r->ch) > 1) … … 386 386 // modulo p numbers 387 387 // are communicated as IMP_Uint32's 388 mp_failr(MP_PutCommonMeta Packet(link,389 MP_CmtProtoUint32,390 MP_ProtoDict,391 1));388 mp_failr(MP_PutCommonMetaTypePacket(link, 389 MP_ProtoDict, 390 MP_CmtProtoIMP_Uint32, 391 1)); 392 392 // but are taken as modulo numbers 393 393 mp_failr(MP_PutAnnotationPacket(link, 394 MP_AnnotNumberModulos,395 MP_NumberDict,396 MP_AnnotValuated));394 MP_NumberDict, 395 MP_AnnotNumberModulos, 396 MP_AnnotValuated)); 397 397 // with Modulo 398 398 mp_failr(MP_PutUint32Packet(link, r->ch, 1)); … … 401 401 // which is (in our case) always a prime number 402 402 mp_failr(MP_PutAnnotationPacket(link, 403 MP_AnnotNumberIsPrime,404 MP_NumberDict,405 0));403 MP_NumberDict, 404 MP_AnnotNumberIsPrime, 405 0)); 406 406 } 407 407 else 408 408 { 409 409 mp_failr(MP_PutAnnotationPacket(link, 410 MP_AnnotSingularGalois,411 129,412 MP_AnnotValuated));410 MP_SingularDict, 411 MP_AnnotSingularGalois, 412 MP_AnnotValuated)); 413 413 mp_failr(MP_PutStringPacket(link, r->parameter[0], 0)); 414 414 } … … 417 417 { 418 418 // floats 419 mp_failr(MP_PutCommonMeta Packet(link,420 MP_CmtProtoReal32,421 MP_ProtoDict,422 0));419 mp_failr(MP_PutCommonMetaTypePacket(link, 420 MP_ProtoDict, 421 MP_CmtProtoIMP_Real32, 422 0)); 423 423 } 424 424 else … … 440 440 // a fraction of two Dense Dist Polys 441 441 mp_failr(MP_PutCommonMetaOperatorPacket(link, 442 MP_CopPolyDenseDistPolyFrac,443 MP_PolyDict,444 mpsr_GetNumOfRingAnnots(alg_r,0),445 0));442 MP_PolyDict, 443 MP_CopPolyDenseDistPolyFrac, 444 mpsr_GetNumOfRingAnnots(alg_r,0), 445 0)); 446 446 failr(mpsr_PutRingAnnots(link, alg_r, 0)); 447 447 … … 453 453 // second element is the exponent vector 454 454 mp_failr(MP_PutCommonMetaOperatorPacket(link, 455 MP_CopProtoArray,456 MP_ProtoDict,457 1,458 (mv ? r->N + 1 : r->N)));459 mp_failr(MP_PutAnnotationPacket(link, 460 MP_AnnotProtoPrototype,461 MP_ProtoDict,462 MP_AnnotReqValNode));463 mp_return(MP_PutCommonMeta Packet(link,464 MP_CmtProtoSint32,465 MP_ProtoDict,466 0));455 MP_ProtoDict, 456 MP_CopProtoArray, 457 1, 458 (mv ? r->N + 1 : r->N))); 459 mp_failr(MP_PutAnnotationPacket(link, 460 MP_ProtoDict, 461 MP_AnnotProtoPrototype, 462 MP_AnnotReqValNode)); 463 mp_return(MP_PutCommonMetaTypePacket(link, 464 MP_ProtoDict, 465 MP_CmtProtoIMP_Sint32, 466 0)); 467 467 } 468 468 … … 472 472 // first, we put the annot packet, with flags (1, 0, 1, 0) 473 473 mp_failr(MP_PutAnnotationPacket(link, 474 MP_AnnotPolyVarNames,475 MP_PolyDict,476 MP_AnnotValuated));474 MP_PolyDict, 475 MP_AnnotPolyVarNames, 476 MP_AnnotValuated)); 477 477 // now, the varnames follow 478 478 if ((r->N) == 1) 479 479 { 480 480 // only 1 varname 481 mp_return(MP_PutIdentifierPacket(link, *(r->names), 0, 0));481 mp_return(MP_PutIdentifierPacket(link, MP_SingularDict, *(r->names), 0)); 482 482 } 483 483 else … … 488 488 489 489 mp_failr(MP_PutCommonOperatorPacket(link, 490 MP_CopProtoArray,491 MP_ProtoDict,492 1,493 r->N));490 MP_ProtoDict, 491 MP_CopProtoArray, 492 1, 493 r->N)); 494 494 mp_failr(MP_PutAnnotationPacket(link, 495 MP_AnnotProtoPrototype,496 MP_ProtoDict,497 MP_AnnotReqValNode));495 MP_ProtoDict, 496 MP_AnnotProtoPrototype, 497 MP_AnnotReqValNode)); 498 498 499 mp_failr(MP_PutCommonMeta Packet(link,500 MP_CmtProtoIdentifier,501 MP_ProtoDict,502 0));499 mp_failr(MP_PutCommonMetaTypePacket(link, 500 MP_ProtoDict, 501 MP_CmtProtoIMP_Identifier, 502 0)); 503 503 for (i=0; i<n; i++) 504 504 mp_failr(IMP_PutString(link, names[i])); … … 511 511 { 512 512 mp_failr(MP_PutAnnotationPacket(link, 513 MP_AnnotPolyVarNumber,514 MP_PolyDict,515 MP_AnnotValuated));513 MP_PolyDict, 514 MP_AnnotPolyVarNumber, 515 MP_AnnotValuated)); 516 516 mp_return(MP_PutUint32Packet(link, (mv ? r->N + 1 : r->N), 0)); 517 517 } … … 524 524 525 525 mp_failr(MP_PutAnnotationPacket(link, 526 MP_AnnotPolyOrdering,527 MP_PolyDict,528 MP_AnnotValuated));526 MP_PolyDict, 527 MP_AnnotPolyOrdering, 528 MP_AnnotValuated)); 529 529 530 530 // let's see whether we have a simple ordering to sent … … 545 545 // the vector ordering 546 546 mp_failr(MP_PutCommonOperatorPacket(link, 547 MP_CopBasicList,548 MP_BasicDict,549 0,550 (mv ? nblocks : nblocks - 1)));547 MP_BasicDict, 548 MP_CopBasicList, 549 0, 550 (mv ? nblocks : nblocks - 1))); 551 551 552 552 for (index = 0; index < nblocks; index ++) … … 557 557 // a product ordering is sent as triple 558 558 mp_failr(MP_PutCommonOperatorPacket(link, 559 MP_CopBasicList,560 MP_BasicDict,561 0,562 3));559 MP_BasicDict, 560 MP_CopBasicList, 561 0, 562 3)); 563 563 // first element is the simple ordering 564 564 failr(PutSimpleOrdering(link, r, index)); … … 581 581 582 582 mp_failr(MP_PutCommonConstantPacket(link, 583 mpsr_ord2mp(r->order[index]),584 MP_PolyDict,585 (vlength == 0 ? 0 : 1)));583 MP_PolyDict, 584 mpsr_ord2mp(r->order[index]), 585 (vlength == 0 ? 0 : 1))); 586 586 587 587 if (vlength == 0) return mpsr_Success; … … 589 589 // deal with the weights 590 590 mp_failr(MP_PutAnnotationPacket(link, 591 MP_AnnotPolyWeights,592 MP_PolyDict,593 MP_AnnotValuated));591 MP_PolyDict, 592 MP_AnnotPolyWeights, 593 MP_AnnotValuated)); 594 594 if (r->order[index] == ringorder_M) 595 595 { 596 596 // put the matrix header 597 597 mp_failr(MP_PutCommonOperatorPacket(link, 598 MP_CopMatrixDenseMatrix,599 MP_MatrixDict,600 2,601 vlength*vlength));598 MP_MatrixDict, 599 MP_CopMatrixDenseMatrix, 600 2, 601 vlength*vlength)); 602 602 mp_failr(MP_PutAnnotationPacket(link, 603 MP_AnnotProtoPrototype, 604 MP_ProtoDict, 605 MP_AnnotReqValNode)); 606 mp_failr(MP_PutCommonMetaPacket(link, MP_CmtProtoSint32, MP_ProtoDict, 0)); 603 MP_ProtoDict, 604 MP_AnnotProtoPrototype, 605 MP_AnnotReqValNode)); 606 mp_failr(MP_PutCommonMetaTypePacket(link, 607 MP_ProtoDict, 608 MP_CmtProtoIMP_Sint32, 609 0)); 607 610 mp_failr(MP_PutAnnotationPacket(link, 608 MP_AnnotMatrixDimension,609 MP_MatrixDict,610 MP_AnnotReqValNode));611 MP_MatrixDict, 612 MP_AnnotMatrixDimension, 613 MP_AnnotReqValNode)); 611 614 mp_failr(MP_PutCommonOperatorPacket(link, 612 MP_CopBasicList,613 MP_BasicDict,614 0, 2));615 MP_BasicDict, 616 MP_CopBasicList, 617 0, 2)); 615 618 mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) vlength, 0)); 616 619 mp_failr(MP_PutUint32Packet(link, (MP_Uint32_t) vlength, 0)); … … 621 624 // vector header 622 625 mp_failr(MP_PutCommonOperatorPacket(link, 623 MP_CopMatrixDenseVector,624 MP_MatrixDict,625 1,626 vlength));626 MP_MatrixDict, 627 MP_CopMatrixDenseVector, 628 1, 629 vlength)); 627 630 mp_failr(MP_PutAnnotationPacket(link, 628 MP_AnnotProtoPrototype, 629 MP_ProtoDict, 630 MP_AnnotReqValNode)); 631 mp_failr(MP_PutCommonMetaPacket(link, MP_CmtProtoSint32, MP_ProtoDict, 0)); 631 MP_ProtoDict, 632 MP_AnnotProtoPrototype, 633 MP_AnnotReqValNode)); 634 mp_failr(MP_PutCommonMetaTypePacket(link, 635 MP_ProtoDict, 636 MP_CmtProtoIMP_Sint32, 637 0)); 632 638 } 633 639 … … 647 653 648 654 mp_failr(MP_PutAnnotationPacket(link, 649 MP_AnnotPolyDefRel,650 MP_PolyDict,651 MP_AnnotValuated));655 MP_PolyDict, 656 MP_AnnotPolyDefRel, 657 MP_AnnotValuated)); 652 658 mp_failr(MP_PutCommonOperatorPacket(link, 653 MP_CopPolyDenseDistPoly,654 MP_PolyDict,655 5,656 GetPlength( ((lnumber) minpoly)->z)));659 MP_PolyDict, 660 MP_CopPolyDenseDistPoly, 661 5, 662 GetPlength( ((lnumber) minpoly)->z))); 657 663 failr(PutProtoTypeAnnot(link, r, 0)); 658 664 failr(PutVarNamesAnnot(link, r)); … … 660 666 failr(PutOrderingAnnot(link, r, 0)); 661 667 mp_failr(MP_PutAnnotationPacket(link, 662 MP_AnnotPolyIrreducible,663 MP_PolyDict,664 0));668 MP_PolyDict, 669 MP_AnnotPolyIrreducible, 670 0)); 665 671 666 672 // need to set PutAlgAlgnumber and gNalgVars … … 686 692 687 693 mp_failr(MP_PutAnnotationPacket(link, 688 MP_AnnotPolyDefRel,689 MP_PolyDict,690 MP_AnnotValuated));694 MP_PolyDict, 695 MP_AnnotPolyDefRel, 696 MP_AnnotValuated)); 691 697 failr(mpsr_PutIdeal(link, id, r)); 692 698 r->qideal = id; -
Singular/mptest.sr
r6ae4f5 rfeaddd 1 proc asciidump2 {3 list l = names();4 list lr;5 int ll = size(l);6 int llr;7 int i;8 int j;9 def el;10 def elr;11 12 for (i=1; i<= ll; i++)13 {14 el = l[i];15 el;16 " = ";17 if (typeof(`el`) == "proc")18 {19 string(`el`);20 }21 else22 {23 `el`;24 }25 " ";26 if (typeof(`el`) == "ring")27 {28 lr = names(`el`);29 llr = size(lr);30 j;31 32 setring(`el`);33 for (j=1; j<llr; j++)34 {35 elr = lr[j];36 elr;37 " = ";38 `elr`;39 " ";40 }41 }42 }43 return();44 }45 46 47 1 proc mptest (lv) 48 2 { 49 3 print(lv); 50 write(" t.mp MP:file", lv);51 return(lv == read(" t.mp MP:file"));4 write("MPfile:w /tmp/t.mp", lv); 5 return(lv == read("MPfile: /tmp/t.mp")); 52 6 }; 53 7 … … 55 9 { 56 10 lv; 57 write(" t.mp MP:file", lv);58 def r = read(" t.mp MP:file");11 write("MPfile:w /tmp/t.mp", lv); 12 def r = read("MPfile: /tmp/t.mp"); 59 13 r; 60 14 }; … … 114 68 poly p13 = p12^4; 115 69 70 ring rtm = 32003, (x,y,z,t), dp; 71 ideal ex = t3y7z4 + 9x8 + 5t2x4y2 + 2t2xy2z3, 72 2t2x5y4+7txy6+9y8 + 2t2x2yz3, 3t4x2y3z2 + 9z8, 3x2y9 + 73 y9 + 5x4; 74 75 ring rt0 = 0, (x,y,z,t), dp; 76 ideal ex = t3y7z4 + 9x8 + 5t2x4y2 + 2t2xy2z3, 77 2t2x5y4+7txy6+9y8 + 2t2x2yz3, 3t4x2y3z2 + 9z8, 3x2y9 + 78 y9 + 5x4; 116 79 117 80 -
Singular/sing_mp.cc
r6ae4f5 rfeaddd 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: sing_mp.cc,v 1. 8 1997-04-09 12:20:10 SingularExp $ */4 /* $Id: sing_mp.cc,v 1.9 1997-04-10 13:08:40 obachman Exp $ */ 5 5 6 6 /* … … 270 270 BOOLEAN slWriteMP(si_link l, leftv v) 271 271 { 272 leftv next = (v != NULL ? v->next : NULL); 272 273 mpsr_ClearError(); 274 275 // writing is done with one leftv at a time 276 if (v != NULL) v->next = NULL; // hence, we need to set next to NULL 273 277 if (mpsr_PutMsg((MP_Link_pt) l->data, v) != mpsr_Success) 274 278 { 275 279 mpsr_PrintError((MP_Link_pt) l->data); 276 return TRUE; 277 } 278 else 279 return FALSE; 280 if (v != NULL) v->next = next; 281 return TRUE; 282 } 283 284 // take care of the remaining leftv's 285 while (next != NULL) 286 { 287 v->next = next; 288 v = next; 289 next = v->next; 290 if (mpsr_PutMsg((MP_Link_pt) l->data, v) != mpsr_Success) 291 { 292 mpsr_PrintError((MP_Link_pt) l->data); 293 v->next = next; 294 return TRUE; 295 } 296 } 297 return FALSE; 280 298 } 281 299 … … 298 316 299 317 v->rtyp = STRING_CMD; 300 v->data = "MP:Quit";318 v->data = MPSR_QUIT_STRING; 301 319 slWriteMP(l, v); 302 320 Free(v, sizeof(sleftv)); … … 425 443 426 444 // no need to evaluate -- it is done in the read 427 if (v->Typ() == STRING_CMD && (strcmp((char *)v->Data(), "MP:Quit") == 0)) 445 if (v->Typ() == STRING_CMD && 446 (strcmp((char *)v->Data(), MPSR_QUIT_STRING) == 0)) 428 447 { 429 448 slKill(silink);
Note: See TracChangeset
for help on using the changeset viewer.