This isn't really a fink-related question, but it is related to
porting UNIX tools to OS X, and it specifically is an OS X related
issue, so I hope it's okay to ask. Don't know where else I would
ask...
I posted here some months ago regarding this same problem. Briefly,
I'm trying to compile a piece of legacy software that was written in C
in 1988 (the PDP neural network simulator, in case that's familiar)
and that ran on UNIX. I had this ported successfully to a Powerbook
G3 under OS X 10.1 Since OS X 10.2 came out it has broken.
In response to my previous post, Fernando Pereira explained:
At 10:20 hrs on Sunday November 3 2002 Fernando Pereira <[EMAIL PROTECTED]> wrote:
> On 11/2/02 11:26 PM, "Prahlad Gupta" <[EMAIL PROTECTED]> wrote:
> > Since upgrading to 10.2 on the Powerbook, the software gives the
> > following error message when I try to run it (the program I'm trying
> > to run is named "bp"):
> >
> > dyld: bp Undefined symbols:
> > bp undefined reference to _stdscr expected to be defined in
> > /usr/lib/libSystem.B.dylib
> > Trace/BPT Trap
> [...]
> >
> > Does the error message on the G3 ring a bell?
> Yes, the problem is that Apple repartitioned some dynamically linked
> libraries from 10.1 to 10.2, including curses, which defines the symbol
> stdscr. Your old binary is trying to find that symbol in the library file
> that defined it in 10.1, but in 10.2 it's in /usr/lib/libcurses.dylib.
>
> You should be able to recompile your program and run it without problems,
> except that there are some other peculiarities with terminal configurations
> for 10.2 that other people reported (I've not seen that problem in a while,
> maybe it went away with 10.2.1?). There were discussions of the issue
> (apropos Emacs) in this list during August and September, you might want to
> look in the archives.
>
> -- F
I have now recompiled the program, it compiles successfully, but when
it tries to write to the screen it hangs. I've tried to fix the
TERMCAP settings as per the emacs-related suggestions from fink-users
in Aug/Sept, but that hasn't helped.
So, I plan to use some code fragments in the C program that were
intended to make it possible to use on systems that don't have a
curses library at all (eg MS-DOS).
Here are a couple of these code fragment functions:
io_clear() {
if (start_up) return;
print(CLEARSCREEN);
}
io_standout() {
if (start_up) return;
print(STANDOUT);
}
io_standend() {
if (start_up) return;
print(STANDEND);
}
which emulates the corresponding functionality from curses. So if I can use these
functions
and then just compile without the -lcurses flag, that should work.
Now, the string CLEARSCREEN (and other similar strings) need to be
defined for the specific system.
Here are the defines that are in the C program that would be appropriate for MSDOS and
h19
(whatever that is)
#ifdef MSDOS
#define CLEARSCREEN "\033[2J"/* <ESC>[2J */
#define MOVECURSOR "\033[" /* <ESC>[%+;%+f */
#define CLEARTOEOL "\033[K"/* <ESC>[K */
#define STANDOUT "\033[7m"/* <ESC>[7m */
#define STANDEND "\033[0m"/* <ESC>[0m */
#else
#ifdef h19
#define print(x) printf(x)
#define io_printw(f,a) if (!start_up) printf(f,a)
#define CLEARSCREEN "\033E" /* <ESC>E */
#define MOVECURSOR "\033Y" /* <ESC>Y%+ %+ */
#define CLEARTOEOL "\033K" /* <ESC>K */
#define STANDOUT "\033p" /* <ESC>p */
#define STANDEND "\033q" /* <ESC>q */
#else
#define CURSES 1
#endif
#endif
now, what I need to do is setup defines for CLEARSCREEN etc that
correspond to my terminal type. From digging around, I figured out I
need to include the termcap strings.
The termcap for my system, with the relevant strings
extracted, is as follows. My problem is, I am not sure how to convert from the
specifications given below to the "\033E" kinds of strings to plug
into the above defines.
# Apple_Terminal
vt100-color:\
:pa#64:Co#8:Sf=\E[3%dm:Sb=\E[4%dm:op=\E[m:AF=\E[3%dm:AB=\E[4%dm:\
:do=^J:co#80:li#24:cl=\E[;H\E[2J:sf=2*\ED:\
:le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
:ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
:md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:\
:rf=/usr/share/tabset/vt100:\
:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[;r\E[0m\E(B\E)B\E[2J:\
:ks=\E[?1h\E=:ke=\E[?1l\E>:\
:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
:ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=2*\EM:vt#3:xn:\
:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:
cl=\E[;H\E[2J
cm=5\E[%i%d;%dH
ce=3\E[K
so=2\E[7m
se=2\E[m
Does anyone have any ideas on this? i.e., how should I define CLEARSCREEN so that it
corresponds to cl=\E[;H\E[2J ....?
Thanks in advance. Sorry for this long message --
-- Prahlad
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Fink-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-users