[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using Emacs on Win32 systems for Swarm development
From: |
Marcus G. Daniels |
Subject: |
Re: using Emacs on Win32 systems for Swarm development |
Date: |
28 Mar 1998 13:39:49 -0800 |
Oh heck, why not just load everything in to elisp? Then no special
munging is needed to get M-x compile to work.
Instead of generating vars.sh, generate vars.el and load that in
_emacs. The usage of swarm.exe is now "-e" to get elisp assignments,
"-b" to get bourne shell assignments (was "-p"), and with no arguments,
it runs Bash directly.
0. Put things in /Swarm. The new swarm.c is at the end of the message.
$ cd /Swarm
1. Compile swarm.exe
$ gcc -g swarm.c -o swarm.exe
2. Generate the vars.el file
$ ./swarm -e > vars.el
3. Use this _emacs stuff instead of the stuff in the previous message.
(load "/Swarm/vars.el")
(setenv "MACHTYPE" "i386-pc-cygwin32")
(cd (getenv "SWARMROOT"))
(setq win32-quote-process-args t)
(setq shell-command-switch "-c")
(setq binary-process-input t)
4. Use this .bash_login instead of the one in the previous message.
#!/bin/sh
$CYGFS/H-i386-cygwin32/bin/cat $SWARMROOT/Readme
HOME=$SWARMROOT
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define VERSION "1.1"
#define PRINT_FLAG_NONE 0
#define PRINT_FLAG_BOURNE_SYNTAX 1
#define PRINT_FLAG_ELISP_SYNTAX 2
int print_flag = PRINT_FLAG_NONE;
static const char *
convertToElispString (const char *str)
{
char buf[strlen (str) * 2 + 1];
char *ptr = buf;
while (*str)
{
*ptr++ = *str;
if (*str == '\\')
*ptr++ = '\\';
str++;
}
*ptr = '\0';
return strdup (buf);
}
static void
storevar (const char *name, const char *val)
{
if (print_flag == PRINT_FLAG_BOURNE_SYNTAX)
printf ("export %s='%s'\n", name, val);
else if (print_flag == PRINT_FLAG_ELISP_SYNTAX)
printf ("(setenv \"%s\" \"%s\")\n", name, convertToElispString (val));
else
setenv (name, val, 1);
}
static const char *
convertToUnixPath (const char *dosPath)
{
int len = strlen (dosPath);
char *unixPath = malloc (len + 1);
int i;
if (unixPath == NULL)
abort ();
for (i = 0; i < len; i++)
if (dosPath[i] == '\\')
unixPath[i] = '/';
else
unixPath[i] = dosPath[i];
unixPath[i] = '\0';
return unixPath;
}
static const char *
copyValue (char *ptr, int keyLen)
{
char *buf = ptr + keyLen + 1;
char *ret;
int bufLen = strlen (buf) - 1;
if (buf[bufLen] == '\n')
buf[bufLen] = '\0';
ret = malloc (bufLen);
if (ret == NULL)
abort ();
strcpy (ret, buf);
return ret;
}
main (int argc, const char **argv)
{
const char *exec_prefix = "\\H-i386-cygwin32\\lib\\gcc-lib\\";
const char *share_tcl8 = "\\share\\tcl8.0\\";
const char *share_gdbtcl = "/share/gdbtcl";
const char *cyg_path_subdir = "\\H-i386-cygwin32\\bin";
const char *cygRoot = NULL;
const char *swarmRoot = NULL;
const char *unixSwarmRoot;
const char *cygUnixRoot;
int cygRootLen;
int nextarg = 1;
if (argc > 1)
{
if (strcmp (argv[nextarg], "-b") == 0)
{
nextarg++;
print_flag = PRINT_FLAG_BOURNE_SYNTAX;
}
else if (strcmp (argv[nextarg], "-e") == 0)
{
nextarg++;
print_flag = PRINT_FLAG_ELISP_SYNTAX;
}
}
{
FILE *fp;
char buf[80];
char *ptr;
const char *setKey = "SET ";
int setKeyLen = strlen (setKey);
const char *cygRootKey = "CYGROOT";
int cygRootKeyLen = strlen (cygRootKey);
const char *swarmRootKey = "SWARMROOT";
int swarmRootKeyLen = strlen (swarmRootKey);
const char *varsbat = "vars.bat";
if (argc > nextarg)
{
const char *path = argv[nextarg];
char buf[strlen (path) + 1 + strlen (varsbat) + 1];
strcpy (buf, convertToUnixPath (path));
strcat (buf, "/");
strcat (buf, varsbat);
if ((fp = fopen (buf, "r")) == NULL)
abort ();
}
else
if ((fp = fopen (varsbat, "r")) == NULL)
abort ();
while ((ptr = fgets (buf, sizeof (buf), fp)) != NULL)
{
if (strncmp (ptr, setKey, setKeyLen) == 0)
{
ptr += setKeyLen;
if (strncmp (ptr, cygRootKey, cygRootKeyLen) == 0)
cygRoot = copyValue (ptr, cygRootKeyLen);
else if (strncmp (ptr, swarmRootKey, swarmRootKeyLen) == 0)
swarmRoot = copyValue (ptr, swarmRootKeyLen);
}
}
}
if (cygRoot == NULL)
abort ();
if (swarmRoot == NULL)
abort ();
cygUnixRoot = convertToUnixPath (cygRoot);
cygRootLen = strlen (cygRoot);
if (cygUnixRoot[1] == ':')
cygUnixRoot += 2;
storevar ("CYGFS", cygUnixRoot);
storevar ("CYGROOT", cygRoot);
storevar ("CYGREL", "B19");
storevar ("MAKE_MODE", "unix");
{
char buf[cygRootLen + strlen (exec_prefix) + 1];
strcpy (buf, cygRoot);
strcat (buf, exec_prefix);
storevar ("GCC_EXEC_PREFIX", buf);
}
{
char buf[cygRootLen + strlen (share_tcl8) + 1];
strcpy (buf, cygRoot);
strcat (buf, share_tcl8);
storevar ("TCL_LIBRARY", buf);
}
{
char buf[strlen (cygUnixRoot) + strlen (share_gdbtcl) + 1];
strcpy (buf, cygUnixRoot);
strcat (buf, share_gdbtcl);
storevar ("GDBTK_LIBRARY", buf);
}
unixSwarmRoot = convertToUnixPath (swarmRoot);
if (unixSwarmRoot[1] == ':')
unixSwarmRoot += 2;
if (print_flag == PRINT_FLAG_BOURNE_SYNTAX)
printf ("PATH=%s:%s%s:$PATH\n",
unixSwarmRoot,
cygUnixRoot,
convertToUnixPath (cyg_path_subdir));
else if (print_flag == PRINT_FLAG_ELISP_SYNTAX)
{
printf ("(setenv \"PATH\" (concat \"%s;%s%s;\" (getenv \"PATH\")))\n",
convertToElispString (swarmRoot),
convertToElispString (cygRoot),
convertToElispString (cyg_path_subdir));
printf ("(setq explicit-shell-file-name \"%s%s/bash\")\n",
cygUnixRoot, convertToUnixPath (cyg_path_subdir));
printf ("(setq explicit-bash-args '(\"--rcfile\" \"%s/.bash_login\"
\"-i\"))\n", unixSwarmRoot);
}
else
{
const char *path = getenv ("PATH");
char buf[strlen (swarmRoot) + 1 + cygRootLen + strlen (cyg_path_subdir) +
strlen (path) + 2];
strcpy (buf, swarmRoot[1] == ':' ? swarmRoot + 2 : swarmRoot);
strcat (buf, ";");
strcat (buf, cygRoot[1] == ':' ? cygRoot + 2 : cygRoot);
strcat (buf, cyg_path_subdir);
strcat (buf, ";");
strcat (buf, path);
storevar ("PATH", buf);
}
if (print_flag != PRINT_FLAG_ELISP_SYNTAX)
storevar ("HOME", unixSwarmRoot);
storevar ("SWARMROOT", unixSwarmRoot);
storevar ("SWARMSETUP", "SFI-NT");
{
const char *packages_subdir = "/packages";
char pbuf[strlen (unixSwarmRoot) + strlen (packages_subdir) + 1];
strcpy (pbuf, unixSwarmRoot);
strcat (pbuf, packages_subdir);
storevar ("P", pbuf);
{
const char *blt8_subdir = "/blt8.0-unoff/library";
char bltbuf[strlen (pbuf) + strlen (blt8_subdir) + 1];
strcpy (bltbuf, pbuf);
strcat (bltbuf, blt8_subdir);
storevar ("BLT_LIBRARY", bltbuf);
}
}
{
const char *swarm_subdir = "/swarm-" VERSION;
char buf[strlen (unixSwarmRoot) + strlen (swarm_subdir) + 1];
strcpy (buf, unixSwarmRoot);
strcat (buf, swarm_subdir);
storevar ("SWARMHOME", buf);
}
storevar ("PS1", "address@hidden $ ");
if (print_flag == PRINT_FLAG_NONE)
{
const char *bash = "bash";
char buf[strlen (cygRoot) + strlen (cyg_path_subdir) + 1 + strlen (bash)
+ 1];
const char *ubuf;
strcpy (buf, cygRoot);
strcat (buf, cyg_path_subdir);
strcat (buf, "\\");
strcat (buf, "bash");
ubuf = convertToUnixPath (buf);
execlp (ubuf, bash, "--login", NULL);
}
}
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================
- Swarm 1.1 Available, Marcus G. Daniels, 1998/03/21
- Re: Swarm 1.1 Available, Wengui Su, 1998/03/22
- Re: Swarm 1.1 Available, Doug Donalson;, 1998/03/23
- Re: Swarm 1.1 Available, Robert E. Bell, 1998/03/23
- Re: Swarm 1.1 Available, glen e. p. ropella, 1998/03/25
- Message not available
- Re: Swarm 1.1 Available, glen e. p. ropella, 1998/03/25
- using Emacs on Win32 systems for Swarm development, Marcus G. Daniels, 1998/03/28
- Re: using Emacs on Win32 systems for Swarm development,
Marcus G. Daniels <=
- Re: using Emacs on Win32 systems for Swarm development, Doug Donalson, 1998/03/29
- Re: using Emacs on Win32 systems for Swarm development, Barry McMullin, 1998/03/29
- Re: using Emacs on Win32 systems for Swarm development, Barry McMullin, 1998/03/29
- Re: using Emacs on Win32 systems for Swarm development, Barry McMullin, 1998/03/30
- Re: using Emacs on Win32 systems for Swarm development, Marcus G. Daniels, 1998/03/29
Help on Make command, Gek Woo Tan, 1998/03/25