home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Top 1
/
os2_top1.zip
/
os2_top1
/
DEMO
/
RIM22
/
MACROS
/
LANG.RM
< prev
next >
Wrap
Text File
|
1994-02-01
|
3KB
|
89 lines
/*
** Macro module: lang.c - Basic language specific editing functions
**
** Copyright (C) 1993 Brian L. Smith
** Copyright (C) 1993 RimStar Technology, Inc.
** All rights reserved internationally.
** Unlicensed use is a violation of applicable laws.
**
** This source code is provided to licensed users of RimStar's products
** for the purpose of allowing the user to customize and/or enhance RimStar's
** products. The source code remains the property of the copyright holders
** with all rights reserved internationally.
** Any modifications to the source code are considered derivative works and
** all rights thereto are reserved to the copyright holders except
** that the purchaser may use the derivitive work in the same manner
** as permitted by the license governing the unmodified product.
** Distribution in any manner of any part of the original source code,
** whether in source or object form, is expressly prohibited without the
** express written permission of the copyright holders.
**
*/
#include "macro.h"
void
_init(void) {
LibAutoload("c_indent", "_c_init","_h_init","_cpp_init","_hpp_init",
"_cxx_init","_hxx_init", "_inl_init",
"_rm_init","_asm_init");
} /* end _init() */
/* DefaultExtensionInit V2.0.55 - New
** When no special extension macro has been defined
** LangInit() will call this function, which by default
** does nothing.
*/
void
DefaultExtensionInit() {
#if 0
_c_init();
#endif
} /* end DefaultExtensionInit() */
/* LangInit
** This is an event handler that is called whenever
** a buffer is created. It sets up for language (extension)
** specific custom editing routines like smart indenting &
** template editing.
*/
SHORT
LangInit(short event, HBUFFER hb) {
char *pathname;
char *func;
HBUFFER origBuffer;
char ext[_MAX_EXT];
/* Determine file extension of current buffer */
pathname = BufQueryFilename(hb);
if ( !pathname && (BufQueryFlags(hb) & BUFFER_TYPE) == BUFTYPE_NORMAL ) {
/* an untitled buffer */
DefaultExtensionInit();
return 0;
}
/* Build function name from file extension */
splitpath(pathname, NULL, NULL, NULL, ext);
func = malloc(32);
ext[0] = '_';
strcpy(func, ext);
strlwr(func);
strcat(func, "_init");
origBuffer = BufSwitchBuffer(hb);
if ( LibQueryFunction(func) )
ExecFunction(func);
else
DefaultExtensionInit();
BufSwitchBuffer(origBuffer);
free(func);
return 0;
} /* end LangInit() */
/*
** End module: lang.c
*/