2023-07-27 14:04:50 -04:00
|
|
|
# Csope
|
2023-08-11 14:27:20 -04:00
|
|
|
Fork of Cscope version 15.9, with various improvements, because cscope is good and shall not be forgotten.
|
2023-08-05 10:30:21 -04:00
|
|
|
While the original's mainentence seems abandoned and as far as I can tell you need a PhD in autoconf to compile the latest version,
|
2023-08-05 07:38:19 -04:00
|
|
|
Csope is alive and well.
|
2023-07-27 14:04:50 -04:00
|
|
|
|
2023-08-05 07:29:13 -04:00
|
|
|
# Demo
|
2023-09-05 13:05:57 -04:00
|
|
|
![demo](docs/csope.GIF)
|
2023-07-29 09:40:48 -04:00
|
|
|
|
2023-08-05 10:30:21 -04:00
|
|
|
# Before/After
|
2023-08-27 13:56:50 -04:00
|
|
|
## After
|
|
|
|
![after](docs/after.jpg)
|
2023-08-27 14:00:58 -04:00
|
|
|
## Before
|
2023-08-27 13:56:50 -04:00
|
|
|
![after](docs/before.jpg)
|
2023-08-05 10:30:21 -04:00
|
|
|
|
2023-08-09 08:04:13 -04:00
|
|
|
# Features
|
2023-08-09 08:05:03 -04:00
|
|
|
#### Search for
|
2023-09-07 08:26:59 -04:00
|
|
|
+ symbol
|
2023-08-09 08:04:13 -04:00
|
|
|
+ global definition
|
|
|
|
+ assignments to specified symbol
|
|
|
|
+ functions called by specified function
|
|
|
|
+ functions calling specified function
|
|
|
|
+ text string
|
|
|
|
+ egrep pattern
|
|
|
|
+ file
|
|
|
|
+ files #including specified file
|
2023-08-09 08:05:03 -04:00
|
|
|
#### ...and open with your editor.
|
|
|
|
#### Batch change search results **interactively**.
|
|
|
|
#### Save/load/pipe results.
|
2023-09-07 08:26:59 -04:00
|
|
|
#### It fully supports:
|
|
|
|
+ C
|
|
|
|
+ Lex
|
|
|
|
+ Yacc
|
|
|
|
#### Partially supports
|
|
|
|
+ C++
|
|
|
|
+ Java
|
2023-08-09 08:04:13 -04:00
|
|
|
|
2023-07-29 09:40:48 -04:00
|
|
|
# Interface
|
|
|
|
<-- Tab -->
|
2023-08-15 04:56:04 -04:00
|
|
|
+--Version-----------------Case--+ +--------------------------------+
|
2023-08-05 05:30:18 -04:00
|
|
|
A |+--------------+---------------+| |+------------------------------+|
|
|
|
|
| || Input Window | Result window || || ||
|
|
|
|
| |+--------------+ || ? || ||
|
|
|
|
|| Mode Window | || ----> || Help ||
|
|
|
|
% || | || <---- || ||
|
|
|
|
|| | || ... || ||
|
|
|
|
| || | || || ||
|
|
|
|
| || | || || ||
|
|
|
|
V |+--------------+---------------+| |+------------------------------+|
|
2023-08-15 04:56:04 -04:00
|
|
|
+---------------------Tool Tips--+ +--------------------------------+
|
2023-08-05 07:29:13 -04:00
|
|
|
|
2023-08-09 08:05:56 -04:00
|
|
|
# Usacases
|
|
|
|
Csope shines at exploring stranger and obsecure code bases due to its TUI.
|
|
|
|
It sometimes gets mislabeled as a code navigation tool, but the original documentation describes it best as a "code browsing tool".
|
|
|
|
Many tools can jump you to a definition or grep for patterns,
|
|
|
|
but Csope is unqie in that it allows for those and many other functionalities while providing you with a very comprehansible list of all results,
|
|
|
|
ready to fire up your editor at just the spot.
|
|
|
|
An example of its excelence is this project. The Cscope codebase used to be a total mess,
|
|
|
|
fixing it would have been a lost cause, if not for Cscope itself. Well, Csope now.
|
|
|
|
|
2023-08-05 07:29:13 -04:00
|
|
|
# Improvements/Changes
|
|
|
|
## User side
|
2023-08-15 04:56:04 -04:00
|
|
|
+ Renamed the program, because "cscope" is annoying to type
|
|
|
|
+ Improved tui
|
|
|
|
+ GNU Readline/History integration
|
2023-08-05 07:29:13 -04:00
|
|
|
## To the code
|
2023-08-15 04:56:04 -04:00
|
|
|
+ Nuked autoconf, replaced with single Makefile
|
|
|
|
+ Reorganized the control flow
|
|
|
|
+ Encapsulated changes to the TUI into display.c
|
|
|
|
+ Encapsulated searching into find.c
|
|
|
|
+ Removed "scanner.l" which seems to be an anchient version (and redundant copy) of "fscanner.l" forgotten by all
|
|
|
|
+ Removed macro hell put in place to allow compiling on a dead badger
|
|
|
|
+ Use stdbool instead of YES/NO macros
|
|
|
|
+ Saved kilobytes by stripping trailing whitespace
|
|
|
|
+ ...and much more
|
|
|
|
|
|
|
|
# Installation
|
|
|
|
You will have to compile from source.
|
2023-09-05 14:27:22 -04:00
|
|
|
|
2023-08-15 04:56:04 -04:00
|
|
|
After you made sure you have the following (dev) libraries installed:
|
2023-09-05 14:27:22 -04:00
|
|
|
|
2023-08-15 04:56:04 -04:00
|
|
|
ncurses
|
|
|
|
GNU Readline
|
|
|
|
GNU History (should come with Readline)
|
2023-09-05 14:27:22 -04:00
|
|
|
|
2023-08-15 04:56:04 -04:00
|
|
|
Just run:
|
2023-09-05 14:27:22 -04:00
|
|
|
|
2023-08-15 04:56:04 -04:00
|
|
|
make
|
2023-09-05 14:27:22 -04:00
|
|
|
|
2023-09-02 17:08:49 -04:00
|
|
|
This will yield the executable "csope", which you are free to do whatever with.
|
2023-09-05 14:27:22 -04:00
|
|
|
|
2023-09-02 17:08:49 -04:00
|
|
|
Hint:
|
2023-09-05 14:27:22 -04:00
|
|
|
|
2023-09-02 17:08:49 -04:00
|
|
|
cp csope /usr/bin/
|
2023-08-05 07:29:13 -04:00
|
|
|
|
2023-08-15 13:03:32 -04:00
|
|
|
# Configuration
|
|
|
|
## Readline
|
|
|
|
The readline integratoin should be complete -please let us know if not-, except for your prompt being used, which could easily break the TUIs display.
|
|
|
|
|
|
|
|
The rl_readline_name variable will be set to "Csope", so you may have conditional configurations in your .inputrc with the following format:
|
2023-09-06 05:48:51 -04:00
|
|
|
|
2023-08-15 13:03:32 -04:00
|
|
|
$if Csope
|
|
|
|
# <whatever>
|
|
|
|
$endif
|
2023-09-06 05:48:51 -04:00
|
|
|
|
2023-08-15 13:03:32 -04:00
|
|
|
## Colors
|
|
|
|
All can be configured sucklessly under "config/colors.h". Hopefully the comments are self evident.
|
|
|
|
|
2023-08-05 07:29:13 -04:00
|
|
|
# Future features / contributor wishlist
|
|
|
|
+ providing support for other languages by integrating new lexers (e.g. ctag's)
|