Shop OBEX P1 Docs P2 Docs Learn Events
shell.c -> flexbasic — Parallax Forums

shell.c -> flexbasic

I am trying to use the shell.c commands in a flexbasic program. Using 'dim shell as class using "shell.p2asm" ' , did not get me anywhere. Is there some secret way of using the commands that are in the shell.c program, short of porting C code into a flexbasic program.

Ray

Comments

  • Why did you use "shell.p2asm"? Try dim shell as class using "shell.c" instead.

  • Below a test program, did not compile.

    Ray

    '' test1.bas
    
    ''
    mount "/host", _vfs_open_host()
    
     dim sh01 as class using "shell.c"
    
    print "Hello, there!"
    
    sh01.dir
    
    
    
    "/home/ray/flexprop/bin/flexspin" -2 -l --tabs=8 -D_BAUD=230400 -O1    --charset=utf8 -I "/home/ray/flexprop/include"  "/home/ray/programs/flexbasic/test1_bas/test1.bas"
    Propeller Spin/PASM Compiler 'FlexSpin' (c) 2011-2023 Total Spectrum Software Inc. and contributors
    Version 6.7.2-HEAD-v6.7.2 Compiled on: Dec 17 2023
    /home/ray/programs/flexbasic/test1_bas/shell.c:114: warning: Non-const member variable flash_config cannot be initialized at compile time; assuming variable is shared
    /home/ray/programs/flexbasic/test1_bas/shell.c:125: warning: Non-const member variable ram_config cannot be initialized at compile time; assuming variable is shared
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: unknown identifier dir in class shell_c
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: dir is not a member of shell_c
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: unknown identifier dir in class shell_c
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: dir is not a member of shell_c
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: unknown identifier dir in class shell_c
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: dir is not a member of shell_c
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: unknown identifier dir in class shell_c
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: unknown identifier dir in class shell_c
    /home/ray/programs/flexbasic/test1_bas/test1.bas:10: error: unknown identifier dir in class shell_c
    test1.bas
    |-shell.c
    |-|-psram.spin2
    |-|-|-psram4drv-dualCE.spin2
    child process exited abnormally
    Finished at Tue Dec 19 08:53:23 2023
    
  • Did you look at the code in shell.c? Note that there is indeed no function named "dir". There is one called "do_dir", and it takes a single parameter (the file name of the directory to display, or an empty string for the current directory).

  • The 'dir' command was simple enough to work with. Not sure how to work with 'parse_cmd' to get at the rest of the commands, via flexbasic.

    Thanks
    Ray

Sign In or Register to comment.