1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
Description: upstream: enhance: plugins: maple: informative banner
This patch furnishes to the `tm_maple` interface an _informative banner_.
The implemented banner gives details about the OpenMaple/Maple version:
the maple release version, the maple kernel build id, the platform,
the maple kernel build date, the maple copyright year. These data are
extracted from the maple command `kernelopts(version)`, more specifically,
from its OpenMaple equivalent `MapleKernelOptions`
(see `$MAPLE/extern/include/maplec.h`).
Origin: vendor, Debian
Forwarded: https://github.com/texmacs/texmacs/pull/93
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2024-08-11
--- a/plugins/maple/src.9/tm_maple_9.c
+++ b/plugins/maple/src.9/tm_maple_9.c
@@ -106,6 +106,31 @@
}
/******************************************************************************
+* Banner
+******************************************************************************/
+
+static void banner(MKernelVector kv) {
+ const char* kversion=MapleToString(kv,MapleKernelOptions(kv,"version",NULL));
+ char* kversionv=strdup(kversion);
+ char* kplatform=strchr(kversionv,','); *kplatform='\0'; do ++kplatform; while (*kplatform == ' ');
+ char* krelease=strrchr(kversionv,' '); while (*krelease == ' ') ++krelease;
+ char* kdate=strchr(kplatform,','); *kdate='\0'; do ++kdate; while (*kdate == ' ');
+ char* kvbid=strchr(kdate,','); *kvbid='\0'; do ++kvbid; while (*kvbid == ' ');
+ char* kyear=strrchr(kdate,' '); while (*kyear == ' ') ++kyear;
+ char* kbid=strrchr(kvbid,' '); while (*kbid == ' ') ++kbid;
+
+ printf(" |\\^/| OpenMaple/Maple %s+b%s (%s) %s\n",krelease,kbid,kplatform,kdate);
+ printf("._|\\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. %s\n",kyear);
+ printf(" \\OPENMAPLE/ All rights reserved. Maple and OpenMaple are trademarks of\n");
+ printf(" <____ ____> Waterloo Maple Inc.\n");
+ printf(" | Type ? for help.\n");
+ printf("\nTeXmacs interface by Joris van der Hoeven\n");
+
+ krelease=kplatform=kdate=kvbid=kyear=kbid=NULL;
+ free(kversionv); kversionv=NULL;
+}
+
+/******************************************************************************
* Launching maple
******************************************************************************/
@@ -141,13 +166,6 @@
}
signal(SIGINT,catch_intr);
- printf("\2verbatim:");
- printf(" |\\^/| Maple\n");
- printf("._|\\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2004\n");
- printf(" \\OPENMAPLE/ All rights reserved. Maple and OpenMaple are trademarks of\n");
- printf(" <____ ____> Waterloo Maple Inc.\n");
- printf(" | Type ? for help.\n");
- printf("\nTeXmacs interface by Joris van der Hoeven\n");
/* initialize Maple */
if( (kv=StartMaple(argc,argv,&cb,(void *)in,NULL,err)) == NULL) {
@@ -155,6 +173,10 @@
return( 1 );
}
+ /* show banner */
+ printf("\2verbatim:");
+ banner(kv);
+
r= EvalMapleStatement (kv, "tmmaple:=9:protect('tmmaple'):");
snprintf(in,sizeof(in),"read(`%s`);",tmmplinit);
r= EvalMapleStatement (kv, in);
|