Assembled 2
A column based text editor
Loading...
Searching...
No Matches
Functions
editor.c File Reference
#include <editor/buffer/buffer.h>
#include <editor/config.h>
#include <editor/buffer/editor.h>
#include <global.h>
#include <stdio.h>
#include <includes.h>

Functions

void load_file_content (struct AS_TextFile *text_file)
 
struct AS_TextFileload_file (char *name)
 
void reload_file (struct AS_TextFile *file)
 
void reload_all ()
 
void save_file (struct AS_TextFile *file)
 
void save_all ()
 
void destroy_file (struct AS_TextFile *file)
 
void destroy_all ()
 
struct AS_CfgTokconfigure_editor (struct AS_CfgTok *token)
 

Detailed Description

Author
awewsomegamer awews.nosp@m.omeg.nosp@m.amer@.nosp@m.gmai.nosp@m.l.com

LICENSE

Assembled - Column based text editor Copyright (C) 2023-2024 awewsomegamer

This file is apart of Assembled.

Assembled is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

DESCRIPTION

Handles files.

Function Documentation

◆ configure_editor()

struct AS_CfgTok * configure_editor ( struct AS_CfgTok * token)

Function to configure the editor.

This function is invoked by config.c's interpret_token_stream function. The current element is passed, which should be of type AS_CFG_TOKEN_KEY and of value AS_CFG_LOOKUP_COLUMNS.

This function will initialize the user's columns into as_ctx.col_descs.

Parameters
structAS_CfgTok *token - Pointer to starting token of the editor's configuration.
Returns
A pointer to the last element of the set, caller must invoke NEXT_TOKEN to be placed at the beginning of the next set.

◆ destroy_all()

void destroy_all ( )

Wrapper of destroy_file to destroy all files in the list as_ctx.text_file_head.

◆ destroy_file()

void destroy_file ( struct AS_TextFile * file)

Destroy the given file

Free the memory of the given file.
This does not save the contents of the file in memory to the file on disk.

Parameters
structAS_TextFile *file - The file to destroy.

◆ load_file()

struct AS_TextFile * load_file ( char * name)

Load a file into a struct AS_TextFile.

Loads the file from the given file path into the internal struct AS_TextBuf and as struct AS_TextFile representations.

Parameters
char*name - Path to the file.
Returns
A pointer to the internal structure describing the file.

◆ load_file_content()

void load_file_content ( struct AS_TextFile * text_file)

Load the content of a file in the format of struct AS_TextBuf.

Parameters
structAS_TextFile *text_file - The text file who's content needs to be loaded

◆ reload_all()

void reload_all ( )

Wrapper of reload_file to reload all files in the list as_ctx.text_file_head.

◆ reload_file()

void reload_file ( struct AS_TextFile * file)

Reloads the given file.

Parameters
structAS_TextFile *file - The file to reload.

◆ save_all()

void save_all ( )

Wrapper of save_file to save all files in the list as_ctx.text_file_head.

◆ save_file()

void save_file ( struct AS_TextFile * file)

Save the given file.

Parameters
structAS_TextFile * - The file to save.