Fixed up the hardcode audoio.mp3
This commit is contained in:
parent
88debd9475
commit
18f45619ad
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@ -6,6 +6,7 @@
|
||||
"type": "gdb",
|
||||
"preLaunchTask": "Build All",
|
||||
"request": "launch",
|
||||
"arguments": "audio.mp3",
|
||||
"cobcargs": ["-free", "-x", "-g","-debug", "-Wall", "-O0"] ,
|
||||
"group": ["id3cobol.cbl"],
|
||||
"env": {
|
||||
|
47
README.md
47
README.md
@ -19,6 +19,7 @@ This project is a COBOL-based MP3 ID3 tag reader that parses and displays metada
|
||||
- `id3cobol.cbl`: Main COBOL program for reading and parsing MP3 ID3 tags.
|
||||
- `zero-ord.cbl`: COBOL module for zero-based ordinal conversion.
|
||||
- `Makefile`: Build automation file for compiling and cleaning the project.
|
||||
- `audio.mp3`: Sample MP3 file for testing (required for the program to run).
|
||||
- `.gitignore`: Specifies files and directories to be ignored by Git.
|
||||
|
||||
## Build Instructions
|
||||
@ -43,14 +44,52 @@ This project is a COBOL-based MP3 ID3 tag reader that parses and displays metada
|
||||
make distclean
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Environment Variables
|
||||
|
||||
Run the compiled `id3cobol` program to parse the `audio.mp3` file:
|
||||
The following environment variables are important for proper execution:
|
||||
|
||||
- **COB_LIBRARY_PATH**: Tells COBOL where to find modules
|
||||
```bash
|
||||
./id3cobol
|
||||
export COB_LIBRARY_PATH=/path/to/workspace:$COB_LIBRARY_PATH
|
||||
```
|
||||
|
||||
> **Note**: Ensure you have an `audio.mp3` file in the same directory as the program. This file is required for the program to function.
|
||||
- **COB_PRE_LOAD**: Tells COBOL to preload the zero-ord module
|
||||
```bash
|
||||
export COB_PRE_LOAD=zero-ord
|
||||
```
|
||||
|
||||
- **LD_LIBRARY_PATH**: Helps the Linux dynamic linker find the module
|
||||
```bash
|
||||
export LD_LIBRARY_PATH=/path/to/workspace:$LD_LIBRARY_PATH
|
||||
```
|
||||
|
||||
These variables are automatically set when using the VS Code debugger.
|
||||
|
||||
## Usage
|
||||
|
||||
Run the compiled `id3cobol` program to parse an MP3 file:
|
||||
|
||||
```bash
|
||||
# Using default audio.mp3 file:
|
||||
./id3cobol
|
||||
|
||||
# Using a specific MP3 file:
|
||||
./id3cobol path/to/your/music.mp3
|
||||
```
|
||||
|
||||
> **Note**: Ensure you have an MP3 file with ID3 tags. If no argument is provided, the program will look for `audio.mp3` in the current directory.
|
||||
|
||||
## VS Code Integration
|
||||
|
||||
This project includes VS Code configuration files:
|
||||
|
||||
- **launch.json**: Configures debugging with proper environment variables
|
||||
- **tasks.json**: Defines build tasks for compiling the project
|
||||
|
||||
To debug in VS Code:
|
||||
1. Press F5 or select "Run and Debug" from the left sidebar
|
||||
2. Select "COBOL debugger" configuration
|
||||
3. The debugger will automatically build and launch the program with audio.mp3
|
||||
|
||||
## Debugging
|
||||
|
||||
|
27
id3cobol.cbl
27
id3cobol.cbl
@ -16,6 +16,7 @@ IDENTIFICATION DIVISION.
|
||||
*> Debug flag to enable/disable debug prints
|
||||
01 WS-DEBUG-MODE PIC 9 VALUE 1.
|
||||
|
||||
*> Default filename that can be overridden with command-line argument
|
||||
01 WS-FILENAME PIC X(255) VALUE "audio.mp3".
|
||||
01 WS-EOF-FLAG PIC 9 VALUE 0.
|
||||
88 WS-EOF VALUE 1.
|
||||
@ -24,6 +25,11 @@ IDENTIFICATION DIVISION.
|
||||
01 STOP-READING-FLAG PIC 9 VALUE 0.
|
||||
88 STOP-READING VALUE 1.
|
||||
|
||||
*> Command line argument handling
|
||||
01 CMD-ARGS.
|
||||
05 CMD-ARG-COUNT PIC 9(2) COMP-5.
|
||||
05 CMD-ARG-VALUES PIC X(255) OCCURS 1 TO 10 DEPENDING ON CMD-ARG-COUNT.
|
||||
|
||||
*> ID3v2 Header Structure
|
||||
01 ID3-HEADER.
|
||||
05 ID3-TAG PIC X(3). *> Should be "ID3"
|
||||
@ -82,6 +88,11 @@ IDENTIFICATION DIVISION.
|
||||
MAIN-PARA.
|
||||
DISPLAY "Starting MP3-ID3-INFO program".
|
||||
|
||||
*> Process command-line arguments
|
||||
PERFORM PROCESS-COMMAND-LINE
|
||||
|
||||
DISPLAY "Analyzing file: " FUNCTION TRIM(WS-FILENAME)
|
||||
|
||||
PERFORM OPEN-FILE.
|
||||
|
||||
IF WS-EOF-FLAG = 0
|
||||
@ -298,3 +309,19 @@ IDENTIFICATION DIVISION.
|
||||
END-READ
|
||||
MOVE WS-TEMP-BYTE TO BYTES-BUFFER(WS-I:1)
|
||||
END-PERFORM.
|
||||
|
||||
*> Process command-line arguments to get the filename
|
||||
PROCESS-COMMAND-LINE.
|
||||
*> Get argument count and values
|
||||
ACCEPT CMD-ARG-COUNT FROM ARGUMENT-NUMBER
|
||||
|
||||
*> Check if at least one argument was provided
|
||||
IF CMD-ARG-COUNT > 0
|
||||
*> Get the first argument (the filename)
|
||||
ACCEPT CMD-ARG-VALUES(1) FROM ARGUMENT-VALUE
|
||||
|
||||
*> If argument isn't empty, use it as filename
|
||||
IF CMD-ARG-VALUES(1) NOT = SPACES
|
||||
MOVE CMD-ARG-VALUES(1) TO WS-FILENAME
|
||||
END-IF
|
||||
END-IF.
|
||||
|
Loading…
x
Reference in New Issue
Block a user