home *** CD-ROM | disk | FTP | other *** search
- Path: pravda.aa.msen.com!not-for-mail
- From: crandall@mail.msen.com (Chad Randall)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Visual E - New E Developer Tool - vedev.gif (0/1)
- Date: 27 Mar 1996 13:35:58 GMT
- Organization: Msen, Inc. -- Ann Arbor, MI.
- Message-ID: <4jbg7u$hf0@pravda.aa.msen.com>
- References: <68772090@0humpty.tomate.tng.oche.de> <Dou4u8.2H1@cix.compulink.co.uk> <315906f0.9219429@news.hik.se>
- NNTP-Posting-Host: conch.aa.msen.com
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Andreas Johansson (td93aj@te.hik.se) wrote:
- : E versus C/C++ (+ quest. How do I make a library in E?)
- :
- : >A Visual E may be a good toy for amateur programmers to play with, but
- : >anything based around E cannot be a professional development system, IMHO.
- :
- : Good arguments to use C/C++
- : ---------------------------
- : 1) This expressions works in C but not in E, and it sucks without
- : them:
- :
- : -------------------------------------------
- : Accessing the pointer to a member variable:
- : -------------------------------------------
- : C/C++
- : &(test->myptr)=10;
- :
- : E (should be, but doesn't work)
- : {test.tjoho}:=10
-
- I'm not sure what you are trying to do here. {variable}
- returns the *address* of a member variable. Why are
- you trying to change the address of a variable?
-
- Of course, is some instances you need to pass the address
- of a variable to a .library routine (gadtools fe).
- In that case, you do need to hack a bit, and pass a dummy
- variable, then copy the value into the structure.
-
-
- : -----------------------------------
- : Case statment on a member variable:
- : -----------------------------------
- : C/C++
- : switch(test->myvar)
- : {
- : .....
- : }
- :
- : E (should be, but doesn't work)
- : SELECT test.myvar
- : .....
- : ENDSELECT
-
- Yes. This is a bit annoying. But it can be worked around.
-
-
- : --------------------------------------------------------------
- : A hole structure in a functionheader:
- : (I got that problem when i tried to write a BOOPSI class in E,
- : please do anyone have a solution for this?)
- : --------------------------------------------------------------
- : C/C++
- : void *dispatcher(Class *class, Object *object, Msg msg) //(or
- : something like that)
- : {
- : .....
- : }
- :
- : E
- : PROC dispathcer(class:PTR TO iclass, object:PTR TO object, msg:PTR TO
- : msg)
- : ......
- : ENDPROC
- : ----------------------------------------------------------------
-
- I've written several BOOPSI classes in (.library) form. The source
- was included in Iconian 2.96 archive. It was removed from the 2.97
- release, tho, as it was getting a bit big. Here's a recap:
-
- PROC init_gaugeiclass()
- DEF cl:PTR TO iclass
- IF cl:=MakeClass('gaugeiclass','imageclass',NIL,SIZEOF gaugeidata,0)
- installhook(cl.dispatcher,{gaugei_dispatcher})
- ENDIF
- ENDPROC cl
-
- PROC gaugei_dispatcher(cl:PTR TO iclass,obj:PTR TO object,msg:PTR TO msg)
- ...
- ENDPROC
-
- PROC installhook(hook,func)
- MOVE.L hook,A0
- MOVE.L func,12(A0)
- LEA hookentry(PC),A1
- MOVE.L A1,8(A0)
- MOVE.L A4,16(A0)
- MOVE.L A0,D0
- ENDPROC D0
-
- hookentry:
- MOVEM.L D2-D7/A2-A6,-(A7)
- MOVE.L 16(A0),A4
- MOVE.L A0,-(A7)
- MOVE.L A2,-(A7)
- MOVE.L A1,-(A7)
- MOVE.L 12(A0),A0
- JSR (A0)
- LEA 12(A7),A7
- MOVEM.L (A7)+,D2-D7/A2-A6
- RTS
-
- You have to remember that E requires that A4 contain a pointer to
- the global variable space.
-
-
- : 2) In some ways more advanced linker and header files
- : ------------------------------------------------------
- :
- : In C++ you can have then a class header in a .h file. And the code
- : for the functions in .o files.
- :
- : .h file:
- : class test
- : {
- : void tjoho();
- : };
- :
- : .o file before compiled:
- : void test::tjoho()
- : {
- : }
- :
- : In E you must have the code and the object header in the same file.
- :
- : OBJECT test
- : ENDOBJECT
- :
- : PROC tjoho() OF test
- : ENDPROC
- : --------------------------------------------------------
-
- BZZT! Wrong. Just export the class. I'm currently
- building a gadget layout system in E OOP. The base class
- in it's own module. And children are in other modules.
- There is a problem with the E cache system, tho. And
- you should always use flushcache when working with
- modules, or use the build command to rebuild all dependent
- modules.
-
-
- : Now some good arguments for E:
- : -------------------------------
- : There are only one E compiler, no strange variations. No
- : troubleshoothing with different kinds of .lib files or anything.
- :
- : More integrated with the inline assembler. In C there are some strange
- : variations how to write the inline assembler, because it's not a part
- : of any C standard.
- :
- : More Amiga feeling in E, because of it's so close to assembler.
- :
- : Compacter code in most cases.
-
- I don't know about this one. My code always seems very bloated...
- but this may be because of the way I write code. I have slowly
- learned by experimentation what things I can do to reduce size...
- but I still have lots of code left over from the "old" days.
-
- : A lot of C-compilers do not have precompiled headerfiles, but E have
- : the module system, and a module is always compiled.
- :
- : Not so strong typechecking. I know that you can use void * and long in
- : C almost like E, but you always have to write typeconversions and that
- : makes the code not look so good.
- :
- : I haven't lookt so much on the LISP alike functions in E, but there
- : are nothing like that in C.
- :
- : VERY FAST COMPILNG
- :
- : YOU CAN COMPILE A PROGRAM WITHOUT THAT 10 MB THAT YOU DIDN'T AFFORD.
- : ---------------------------------------------------------------------
- :
- :
- : 3) And how do I make a E modules that looks like below when I run
- : ShowModule on it?
- :
- : LIBRARY blabla
- : Test(A0)
- : ENDLIBRARY
-
- LIBRARY 'blabla.library',1,1,'blabla.library 1.1 (1/1/78)' IS
- test
-
- PROC test(dummy) IS EMPTY
-
- Compile this, and you will get 2 files:
- "blabla.library" and "blabla.m"
- Delete the "blabla.library" file and keep the "blabla.m" file
- as your module. You can also go a different route, and
- use the "pragma2module" program, and write a .pragma
- file... or write a clib file, convert it to a pragma, then
- to a module. ;)
-