Assembled 2
A column based text editor
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions
config.h File Reference
#include <includes.h>

Go to the source code of this file.

Classes

struct  AS_CfgTok
 

Macros

#define AS_CFG_TOKEN_EOF   0
 Empty character, considered EOF.
 
#define AS_CFG_TOKEN_COL   1
 Colon character.
 
#define AS_CFG_TOKEN_STR   2
 A string of alphanumeric characters.
 
#define AS_CFG_TOKEN_INT   3
 An integer of any base.
 
#define AS_CFG_TOKEN_COM   4
 A comma character.
 
#define AS_CFG_TOKEN_KEY   5
 A keyword in the list AS.
 
#define AS_CFG_TOKEN_SQR   6
 
#define AS_NEXT_TOKEN   token = token->next;
 
#define AS_EXPECT_TOKEN(__type__, __msg__)
 
#define AS_EXPECT_VALUE(__value__, __msg__)
 

Enumerations

enum  AS_LEXSTRLOOKUP_IDXS {
  AS_CFG_LOOKUP_UP , AS_CFG_LOOKUP_DOWN , AS_CFG_LOOKUP_LEFT , AS_CFG_LOOKUP_RIGHT ,
  AS_CFG_LOOKUP_ENTER , AS_CFG_LOOKUP_BUFFER_LEFT , AS_CFG_LOOKUP_BUFFER_RIGHT , AS_CFG_LOOKUP_WINDOW_LEFT ,
  AS_CFG_LOOKUP_WINDOW_RIGHT , AS_CFG_LOOKUP_FILE_SAVE , AS_CFG_LOOKUP_FILE_SAVE_ALL , AS_CFG_LOOKUP_FILE_LOAD ,
  AS_CFG_LOOKUP_SELECTION , AS_CFG_LOOKUP_MOVE_LN_UP , AS_CFG_LOOKUP_MOVE_LN_DOWN , AS_CFG_LOOKUP_COLDESC_LEFT ,
  AS_CFG_LOOKUP_COLDESC_RIGHT , AS_CFG_LOOKUP_KEYBOARD , AS_CFG_LOOKUP_START_SCR , AS_CFG_LOOKUP_THEMES ,
  AS_CFG_LOOKUP_USE , AS_CFG_LOOKUP_BG_DISABLE , AS_CFG_LOOKUP_KEYSEQ , AS_CFG_LOOKUP_LOGO_BMP ,
  AS_CFG_LOOKUP_COLUMNS , AS_CFG_LOOKUP_DEFAULT , AS_CFG_LOOKUP_DEFINE , AS_CFG_LOOKUP_INCLUDE ,
  AS_CFG_LOOKUP_FOREGROUND , AS_CFG_LOOKUP_BACKGROUND
}
 

Functions

struct AS_CfgTokcfg_lex (FILE *file)
 
int read_config ()
 

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

Responsible for reading .cfg files.

Macro Definition Documentation

◆ AS_EXPECT_TOKEN

#define AS_EXPECT_TOKEN ( __type__,
__msg__ )
Value:
if (token->type != __type__) { \
printf("Error on line %d, %d: %s\n", token->line, token->column, __msg__); \
AS_DEBUG_MSG("Error on line %d, %d: %s\n", token->line, token->column, __msg__); \
exit(1); \
}

◆ AS_EXPECT_VALUE

#define AS_EXPECT_VALUE ( __value__,
__msg__ )
Value:
if (token->value != __value__) { \
printf("Error on line %d, %d: %s\n", token->line, token->column, __msg__); \
AS_DEBUG_MSG("Error on line %d, %d: %s\n", token->line, token->column, __msg__); \
exit(1); \
}

Enumeration Type Documentation

◆ AS_LEXSTRLOOKUP_IDXS

Enum which dictates keyword content placement

The following are used indices into the As_LexStrLookup list. The first group of indices are shared between the configuration language and the function member of AS_KeySeq structures.

The separation is visible in source code (src/include/editor/config.h:73).

Function Documentation

◆ cfg_lex()

struct AS_CfgTok * cfg_lex ( FILE * file)

General lex function that can be used for .cfg files.

Parameters
FILE*file - The file to lex.
Returns
A pointer to the head of a struct AS_CfgTok linked list, the list is owned by the caller.

◆ read_config()

int read_config ( )

Specific to read ~/.config/assembled/config.cfg

This functions reads the first main configuration file at ~/.config/assembled/config.cfg, which may point to other configuration files.

Returns
An integer to determine success (0: success)