*ERROR* problem

Discussion in 'AutoCAD' started by crrussell3, Apr 22, 2004.

  1. crrussell3

    crrussell3 Guest

    I am having a problem with my *ERROR* Function. If I go into VLISP and "Check Text in Editor", if comes up saying:

    [CHECKING TEXT TEST.LSP loading...]
    ...
    ; warning: too few arguments: (*ERROR*)
    ..............................
    ; Check done.

    Now it works just fine if I don't compile my code into VLX. But when I do, I get errors on the command line saying it is rejecting variable setting attreq for instance.

    Here is what my *ERROR* function looks like:

    (VL-DOC-EXPORT '*ERROR*)
    (DEFUN *ERROR* (MSG)
    (SETVAR "attreq" old_attreq)
    (SETVAR "attdia" old_attdia)
    (SETVAR "cmdecho" old_cmdecho)
    (SETVAR "clayer" old_clayer)
    (PROMPT "\nResetting System Variables")
    ) ;_ end of defun

    Can someone tell me where I am going wrong?
    TIA,
    Craig
     
    crrussell3, Apr 22, 2004
    #1
  2. crrussell3

    Tom Smith Guest

    ; warning: too few arguments: (*ERROR*)

    Is your error function being called without the msg argument?
     
    Tom Smith, Apr 22, 2004
    #2
  3. crrussell3

    Tom Smith Guest

    what do you mean by that?

    As Bob says, the "rejected setting" is what you will get when the error
    function is triggered without having previously set values for old_attreq
    etc. I'd guess that something else is causing an error, and the error
    handler is blowing up.

    The "too few arguments" would apply if the error function is called
    incorrectly. You've defined *error* as taking one argument, msg. If you call
    the function in the form of (*error* "mistake") it's legal, but if you call
    (*error*) you'll get "too few arguments."

    Try commenting out your error handler altogether and compiling running the
    program -- see what Acad's built-in error handler reports. Yours is not
    doing anything with the msg argument, meaning it's suppressing reports of
    what is the real error.
     
    Tom Smith, Apr 22, 2004
    #3
  4. crrussell3

    crrussell3 Guest

    Ok, I went through and rewrote my error based on www.afralisp.com tutorial on error trapping, and changed the variables to suit my own.

    Now, it works just fine, whenever I run it as a *.lsp file. BUT, when I run it compiled (with no errors on compiling), I get this:

    TEST ; error: bad argument type: stringp nil

    Here is what my error trapping routine looks like:

    (VL-DOC-EXPORT 'INITERR)
    (DEFUN INITERR ()
    (SETQ old_attreq (GETVAR "attreq")
    old_attdia (GETVAR "attdia")
    old_cmdecho (GETVAR "cmdecho")
    old_clayer (GETVAR "clayer")
    ) ;_ end of SETQ
    (SETQ temperr *error*)
    (SETQ *error* trap)
    (PRINC)
    ) ;_ end of defun
    ;;*************************************************************************
    (VL-DOC-EXPORT 'TRAP)
    (DEFUN TRAP (errmsg)
    (IF (NOT (MEMBER errmsg '("Console Break" "Function Cancelled"))
    ) ;_ end of not
    (PRINC (STRCAT "\nError: " errmsg))
    ) ;_ end of if
    (SETVAR "attreq" old_attreq)
    (SETVAR "attdia" old_attdia)
    (SETVAR "cmdecho" old_cmdecho)
    (SETVAR "clayer" old_clayer)
    (PRINC "\nError Resetting Enviroment ")
    (TERPRI)
    (SETQ *error* temperr)
    (PRINC)
    ) ;_ end of defun
    ;;*************************************************************************
    (VL-DOC-EXPORT 'RESET)
    (DEFUN RESET ()
    (SETQ *error* temperr)
    (SETVAR "attreq" old_attreq)
    (SETVAR "attdia" old_attdia)
    (SETVAR "cmdecho" old_cmdecho)
    (SETVAR "clayer" old_clayer)
    (PRINC)
    ) ;_ end of defun
     
    crrussell3, Apr 22, 2004
    #4
  5. crrussell3

    Tom Smith Guest

    Sounds like there's an error in the test routine. Why not post the whole
    routine here or in customer files?
     
    Tom Smith, Apr 22, 2004
    #5
  6. OT: You *do* know you can localize the *ERROR* symbol, and not jump thru the
    "save-old-function-redefine-function-restore-old-function" song-and-dance,
    right?

    P.S. How do you spell environment? <vbg>


    --
    R. Robert Bell


    Ok, I went through and rewrote my error based on www.afralisp.com tutorial
    on error trapping, and changed the variables to suit my own.

    Now, it works just fine, whenever I run it as a *.lsp file. BUT, when I run
    it compiled (with no errors on compiling), I get this:

    TEST ; error: bad argument type: stringp nil

    Here is what my error trapping routine looks like:

    (VL-DOC-EXPORT 'INITERR)
    (DEFUN INITERR ()
    (SETQ old_attreq (GETVAR "attreq")
    old_attdia (GETVAR "attdia")
    old_cmdecho (GETVAR "cmdecho")
    old_clayer (GETVAR "clayer")
    ) ;_ end of SETQ
    (SETQ temperr *error*)
    (SETQ *error* trap)
    (PRINC)
    ) ;_ end of defun
    ;;*************************************************************************
    (VL-DOC-EXPORT 'TRAP)
    (DEFUN TRAP (errmsg)
    (IF (NOT (MEMBER errmsg '("Console Break" "Function Cancelled"))
    ) ;_ end of not
    (PRINC (STRCAT "\nError: " errmsg))
    ) ;_ end of if
    (SETVAR "attreq" old_attreq)
    (SETVAR "attdia" old_attdia)
    (SETVAR "cmdecho" old_cmdecho)
    (SETVAR "clayer" old_clayer)
    (PRINC "\nError Resetting Enviroment ")
    (TERPRI)
    (SETQ *error* temperr)
    (PRINC)
    ) ;_ end of defun
    ;;*************************************************************************
    (VL-DOC-EXPORT 'RESET)
    (DEFUN RESET ()
    (SETQ *error* temperr)
    (SETVAR "attreq" old_attreq)
    (SETVAR "attdia" old_attdia)
    (SETVAR "cmdecho" old_cmdecho)
    (SETVAR "clayer" old_clayer)
    (PRINC)
    ) ;_ end of defun
     
    R. Robert Bell, Apr 22, 2004
    #6
  7. crrussell3

    crrussell3 Guest

    Ok, I have commented out all of my error handling, recompiled with no errors during compiling, and I still get that error when trying to run the VLX file. If I run the FAS or LSP file, they work just fine.

    What could be causing this? I have exported everything with (VL-DOC-EXPORT 'functionname). The program won't even run, so im guessing it has something to do with the initialization, but can't pin point it.
     
    crrussell3, Apr 22, 2004
    #7
  8. crrussell3

    Tom Smith Guest

    Here is the Program....

    Way too much for me to try to analyze, sorry. Maybe someone else will help
    debug. If the error routine is in doubt, try writing a short program which
    does nothing but test that.

    But since you get the same thing with or without the custom error handler, I
    suspect an error in the larger routine. The stringp nil implies that a
    function which expects a string isn't getting one. (atoi 7) will generate
    this error. As to why the error appears only after compilation, sorry, no
    clue, I've never seen that. Maybe it's some interaction with the dcl file --
    but that's only a wild guess.
     
    Tom Smith, Apr 22, 2004
    #8
  9. crrussell3

    crrussell3 Guest

    does anyone know what would cause when I load the program I get this:

    TEST v1.0 is now loaded.
    Type TEST to run program.nil

    why would it have "nil" at the end? And once again, its only on the VLX, and not the LSP?????

    I have at least partially figured it out in VLX format, so it loads, and gets up to picking an insertion point, but then Autocad always crashes there.

    So time for 1000 more hrs of debugging.
     
    crrussell3, Apr 22, 2004
    #9
  10. There is nothing you can do about the "nil" echo from the vlx. Sorry.

    --
    R. Robert Bell


    does anyone know what would cause when I load the program I get this:

    TEST v1.0 is now loaded.
    Type TEST to run program.nil

    why would it have "nil" at the end? And once again, its only on the VLX,
    and not the LSP?????

    I have at least partially figured it out in VLX format, so it loads, and
    gets up to picking an insertion point, but then Autocad always crashes
    there.

    So time for 1000 more hrs of debugging.
     
    R. Robert Bell, Apr 22, 2004
    #10
  11. crrussell3

    Daron Denton Guest

    a (princ) at the end won't get it?
    daron
     
    Daron Denton, Apr 23, 2004
    #11
  12. Nope.

    --
    R. Robert Bell


    "Daron Denton" <ask, and i'll give it to you> wrote in message
    a (princ) at the end won't get it?
    daron
     
    R. Robert Bell, Apr 23, 2004
    #12
  13. crrussell3

    Tom Smith Guest

    The vlx runs for me without an error message.
     
    Tom Smith, Apr 23, 2004
    #13
  14. crrussell3

    crrussell3 Guest

    Your joking right? How is that possible? OK, so whats your secret?

    I am running ADT 3.3, WinXP Pro.

    For support path I have it mapped to the main DIFF folder.

    Did you do anything different?
     
    crrussell3, Apr 23, 2004
    #14
  15. crrussell3

    Tom Smith Guest

    I am on vanilla 2004, NT. I dropped the whole thing in the first folder on
    my search path, and loaded and ran the vlx. I did get the nil on the loading
    message, and it reported not being able to find the block on my first
    attempt. Looking at the code, you're prefixing a DWG/ on the block name, and
    I don't have that path. But once I had manually inserted the block in my
    drawing, to make it available, the program ran without any error message.

    I might recommend using findfile to locate the block, rather than hard
    coding the DWG/ path, for more flexibility. Sorry I can't shed any light on
    your error message.
     
    Tom Smith, Apr 23, 2004
    #15
  16. crrussell3

    crrussell3 Guest

    ya, if you use the extract part of the winzip, it will extract the zip file with the proper hierarchy/folder structure. there will be a dwg and sld folder inside of it.

    now, just to double check, I did this myself. downloaded the zip file I posted to my desktop, unzipped, mapped a support path to it.

    then, I do it all three ways, I load the vlx at the command prompt, drag n' drop, and appload it. the program runs just fine. now, if I take a remove the lsp and fas files from the folder, even reload the vlx, close autocad and load the vlx, etc, it won't work. if I leave the lsp/fas in there, it works just fine. did you remove the lsp and fas files before running?
     
    crrussell3, Apr 23, 2004
    #16
  17. crrussell3

    Tom Smith Guest

    did you remove the lsp and fas files before running?

    No I didn't. After removing the lsp and fas I got the stringp nil error on
    loading the vlx. I don't understand why having those files present would
    make any difference, but it did!

    I don't understand what is happening on compilation. I think the stringp
    error would not occur unless something is actually executing when the vlx
    loaded. I've never seen anything like this.
     
    Tom Smith, Apr 23, 2004
    #17
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.