csope/README.md

112 lines
5.0 KiB
Markdown
Raw Normal View History

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
TODO: fill in
2023-07-29 09:40:48 -04:00
2023-08-05 10:30:21 -04:00
# Before/After
TODO: fill in
2023-08-09 08:04:13 -04:00
# Features
2023-08-09 08:05:03 -04:00
#### Search for
2023-08-09 08:04:13 -04:00
+ C symbol
+ 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-08-09 08:04:13 -04:00
2023-07-29 09:40:48 -04:00
# Interface
<-- Tab -->
2023-08-05 05:30:18 -04:00
+------------Message-------------+ +--------------------------------+
A |+--------------+---------------+| |+------------------------------+|
| || Input Window | Result window || || ||
| |+--------------+ || ? || ||
|| Mode Window | || ----> || Help ||
% || | || <---- || ||
|| | || ... || ||
| || | || || ||
| || | || || ||
V |+--------------+---------------+| |+------------------------------+|
+-----------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
+ renamed the program, because "cscope" is annoying to type
2023-08-12 10:01:26 -04:00
+ improved gui
2023-08-05 07:29:13 -04:00
+ GNU Readline integration (ie. VI/EMACS mode, command history) /*pending*/
## To the code
+ nuked autoconf, replaced with single Makefile
2023-08-08 14:34:15 -04:00
+ reorganized main()
2023-08-05 07:29:13 -04:00
+ encapsulated changes to the TUI into display.c
2023-08-09 08:04:13 -04:00
+ encapsulated searching into find.c
2023-08-08 14:34:15 -04:00
+ removed "scanner.l" which seems to be an anchient version (and redundant copy) of "fscanner.l" forgotten by all
2023-08-05 07:29:13 -04:00
+ removed macro hell put in place to allow compiling on a dead badger
+ replaced repeated inline #ifdef KEY_\*-s with guaranteed definitions
+ removed random commets giving tips for and refering to specific issues
+ use stdbool instead of YES/NO macros
+ saved kilobytes by stripping trailing whitespace
2023-08-06 07:09:48 -04:00
+ FILE\* refsfound used to be rewind()-ed everytime the reads were not sequencial
2023-08-05 07:29:13 -04:00
2023-08-13 15:21:38 -04:00
# Control flow
...
2023-08-05 10:30:21 -04:00
# Project structure /*probably move to documentation*/
| Component | Purpose |
| :-------: | :-----: |
2023-08-12 10:01:26 -04:00
| main.c | generic init functions, main() and primary event loops (and junk) |
2023-08-05 10:30:21 -04:00
| display.c | all functions directly dealing with NCurses |
| input.c | top layer of functions dealing with user input; migth dispatch to readline |
2023-08-09 08:04:13 -04:00
| find.c | searching functions |
2023-08-05 10:30:21 -04:00
| globals.h | an inherited curse; global var/prototype hell |
| readline.c | all functions directly dealing with GNU Readline; responsible for line editing in *input mode* |
| help.c | all functions dealing with help messages |
2023-08-13 15:21:38 -04:00
# Key Symbols
| Global | Role |
| :----: | :--: |
| int input_mode | Responsible of keeping track how current input should be handled. Not only does the readline handler depend on it, its also used to determine what types of inputs all legal (e.g. swapping to another window). Takes up on of the values of the INPUT_\* macros.
| int window_change | Bit mask type of the CH_\* macros. Keeps track of the windows to be refresed on the next run of display(). Could be better utalized.
2023-08-07 12:24:27 -04:00
# TODO /*move soon*/
+ sort out constants.h
+ scrollbar() uses magic int literals?
+ Ordering function declarations in global.h by alpha order is not smart
+ lineflagafterfile is stupid
+ library.h...; "private library", in a program using 90 globals; ffs
2023-08-10 08:36:16 -04:00
+ sort out the global hell
2023-08-10 09:52:28 -04:00
+ was there really ever a scrollbar?
2023-08-11 17:31:25 -04:00
+ handle resizing
2023-08-13 15:21:38 -04:00
+ a search struct could be great for caching and could easy the global situation
2023-08-08 14:34:15 -04:00
## Original
+ Same capabilities as interactive in non interactive (one shot) mode
+ Provide some how-do-I-use-this-thing doc.
2023-08-07 12:24:27 -04:00
# BUGS
+ Changing text double frees:
free(): double free detected in tcache 2
Aborted
2023-08-08 06:47:02 -04:00
+ Changing text can crash without replacing text and leaving the console ncursed
2023-08-13 15:21:38 -04:00
+ After an attempted change malloc *can* cry and crash
2023-08-07 12:24:27 -04:00
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)