tcledit: Fix some compile issues. Still undefined things at link time.
This commit is contained in:
parent
b1fea5ec10
commit
9885b5c9b3
@ -55,10 +55,10 @@
|
||||
* Private Variables
|
||||
***************************************************************************/
|
||||
|
||||
static Tcl_Interp *astInterp;
|
||||
static const char *astInFileName;
|
||||
static const char *astOutFileName;
|
||||
static const char astDefaultFileName[] = "planes.pll";
|
||||
static Tcl_Interp *g_tcledit_interp;
|
||||
static const char *g_in_filename;
|
||||
static const char *g_out_filename;
|
||||
static const char g_default_filename[] = "planes.pll";
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
@ -134,7 +134,7 @@ rect_data_t editRect;
|
||||
|
||||
/* Called when any change is made to the display while in POS mode */
|
||||
|
||||
static void astUpdatePOSModeDisplay(void)
|
||||
static void tcledit_update_posmode_display(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -151,7 +151,7 @@ static void astUpdatePOSModeDisplay(void)
|
||||
|
||||
/* Called when any change is made to the display while in NEW mode */
|
||||
|
||||
static void astUpdateNEWModeDisplay(void)
|
||||
static void tcledit_update_newmode_display(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -169,8 +169,8 @@ static void astUpdateNEWModeDisplay(void)
|
||||
* current edit mode
|
||||
*/
|
||||
|
||||
static int astSetEditMode(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
static int tcledit_setmode(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
{
|
||||
ginfo("Processing command: %s\n", argv[0]);
|
||||
|
||||
@ -183,7 +183,7 @@ static int astSetEditMode(ClientData clientData,
|
||||
{
|
||||
ginfo("Entering POS mode\n");
|
||||
editMode = EDITMODE_POS;
|
||||
astUpdatePOSModeDisplay();
|
||||
tcledit_update_posmode_display();
|
||||
}
|
||||
|
||||
else if (strcmp(argv[1], "NEW") == 0)
|
||||
@ -225,7 +225,8 @@ static int astSetEditMode(ClientData clientData,
|
||||
wld_fatal_error("%s: Unrecognized NEW plane: %s\n",
|
||||
__FUNCTION__, argv[2]);
|
||||
}
|
||||
astUpdateNEWModeDisplay();
|
||||
|
||||
tcledit_update_newmode_display();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -237,8 +238,8 @@ static int astSetEditMode(ClientData clientData,
|
||||
|
||||
/* Called in response to the "ast_position" Tcl command */
|
||||
|
||||
static int astNewPosition(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
static int tcledit_new_position(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
{
|
||||
ginfo("Processing command: %s\n", argv[0]);
|
||||
|
||||
@ -255,14 +256,14 @@ static int astNewPosition(ClientData clientData,
|
||||
ginfo("New plane positions: {%d,%d,%d}\n",
|
||||
planePosition[0], planePosition[1], planePosition[2]);
|
||||
|
||||
astUpdatePOSModeDisplay();
|
||||
tcledit_update_posmode_display();
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/* Called in response to the "ast_zoom" Tcl command */
|
||||
|
||||
static int astNewZoom(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
static int tcledit_new_zoom(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
{
|
||||
ginfo("Processing command: %s\n", argv[0]);
|
||||
|
||||
@ -320,19 +321,19 @@ static int astNewZoom(ClientData clientData,
|
||||
|
||||
if (editMode == EDITMODE_POS)
|
||||
{
|
||||
astUpdatePOSModeDisplay();
|
||||
tcledit_update_posmode_display();
|
||||
}
|
||||
else
|
||||
{
|
||||
astUpdateNEWModeDisplay();
|
||||
tcledit_update_newmode_display();
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/* Called in response to the "ast_edit" Tcl command */
|
||||
|
||||
static int astNewEdit(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
static int tcledit_new_edit(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
@ -438,15 +439,16 @@ static int astNewEdit(ClientData clientData,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
astUpdateNEWModeDisplay();
|
||||
tcledit_update_newmode_display();
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/* Called in response to the "ast_attribute" Tcl command */
|
||||
|
||||
static int astNewAttributes(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
static int tcledit_new_attributes(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
{
|
||||
const char *attributes;
|
||||
int tmp;
|
||||
@ -526,8 +528,8 @@ static int astNewAttributes(ClientData clientData,
|
||||
|
||||
/* Called in response to the "ast_addrectangle" Tcl command */
|
||||
|
||||
static int astAddRectangle(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
static int tcledit_add_rectangle(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
{
|
||||
|
||||
ginfo("Processing command: %s\n", argv[0]);
|
||||
@ -567,13 +569,14 @@ static int astAddRectangle(ClientData clientData,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/* Called in response to the "ast_save" Tcl command */
|
||||
|
||||
static int astSaveRectangles(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
static int tcledit_save_rectangles(ClientData clientData,
|
||||
Tcl_Interp * interp, int argc, const char *argv[])
|
||||
{
|
||||
|
||||
ginfo("Processing command: %s\n", argv[0]);
|
||||
@ -584,7 +587,7 @@ static int astSaveRectangles(ClientData clientData,
|
||||
__FUNCTION__, argc);
|
||||
}
|
||||
|
||||
wld_save_planes(astOutFileName);
|
||||
wld_save_planes(g_out_filename);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@ -604,14 +607,14 @@ int main(int argc, char **argv, char **envp)
|
||||
|
||||
/* Parse command line options */
|
||||
|
||||
astOutFileName = astDefaultFileName;
|
||||
g_out_filename = g_default_filename;
|
||||
|
||||
while ((option = getopt(argc, argv, "o:")) != EOF)
|
||||
{
|
||||
switch (option)
|
||||
{
|
||||
case 'o':
|
||||
astOutFileName = optarg;
|
||||
g_out_filename = optarg;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unrecognized option: %c\n", option);
|
||||
@ -628,12 +631,12 @@ int main(int argc, char **argv, char **envp)
|
||||
show_usage(argv[0]);
|
||||
}
|
||||
|
||||
astInFileName = argv[optind];
|
||||
g_in_filename = argv[optind];
|
||||
|
||||
/* Read the plane file now so that we can be certain that it is a valid
|
||||
* plaine file. */
|
||||
|
||||
if (wld_load_planefile(astInFileName) != PLANE_SUCCESS)
|
||||
if (wld_load_planefile(g_in_filename) != PLANE_SUCCESS)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
@ -651,7 +654,7 @@ int main(int argc, char **argv, char **envp)
|
||||
|
||||
int do_tcl_action(const char *script)
|
||||
{
|
||||
return Tcl_Eval(astInterp, script);
|
||||
return Tcl_Eval(g_tcledit_interp, script);
|
||||
}
|
||||
|
||||
/* Tcl_AppInit is called from Tcl_Main() after the Tcl interpreter has
|
||||
@ -665,7 +668,7 @@ int Tcl_AppInit(Tcl_Interp * interp)
|
||||
|
||||
/* Save the interpreter for later */
|
||||
|
||||
astInterp = interp;
|
||||
g_tcledit_interp = interp;
|
||||
|
||||
/* Initialize the edit windows before starting the Tcl parser */
|
||||
|
||||
@ -688,27 +691,27 @@ int Tcl_AppInit(Tcl_Interp * interp)
|
||||
|
||||
/* Define application-specific commands */
|
||||
|
||||
Tcl_CreateCommand(astInterp, "ast_seteditmode", astSetEditMode,
|
||||
Tcl_CreateCommand(g_tcledit_interp, "ast_seteditmode", tcledit_setmode,
|
||||
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(astInterp, "ast_position", astNewPosition,
|
||||
Tcl_CreateCommand(g_tcledit_interp, "ast_position", tcledit_new_position,
|
||||
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(astInterp, "ast_zoom", astNewZoom,
|
||||
Tcl_CreateCommand(g_tcledit_interp, "ast_zoom", tcledit_new_zoom,
|
||||
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(astInterp, "ast_edit", astNewEdit,
|
||||
Tcl_CreateCommand(g_tcledit_interp, "ast_edit", tcledit_new_edit,
|
||||
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(astInterp, "ast_attributes", astNewAttributes,
|
||||
Tcl_CreateCommand(g_tcledit_interp, "ast_attributes", tcledit_new_attributes,
|
||||
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(astInterp, "ast_addrectangle", astAddRectangle,
|
||||
Tcl_CreateCommand(g_tcledit_interp, "ast_addrectangle", tcledit_add_rectangle,
|
||||
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(astInterp, "ast_save", astSaveRectangles,
|
||||
Tcl_CreateCommand(g_tcledit_interp, "ast_save", tcledit_save_rectangles,
|
||||
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
|
||||
|
||||
/* Initialize the Tcl parser */
|
||||
|
||||
if (Tcl_EvalFile(astInterp, "tcledit.tk") != TCL_OK)
|
||||
if (Tcl_EvalFile(g_tcledit_interp, "tcledit.tk") != TCL_OK)
|
||||
{
|
||||
fprintf(stderr, "%s\n", Tcl_GetVar(astInterp, "errorCode", 0));
|
||||
fprintf(stderr, "%s\n", Tcl_GetVar(astInterp, "errorInfo", 0));
|
||||
fprintf(stderr, "%s\n", Tcl_GetVar(g_tcledit_interp, "errorCode", 0));
|
||||
fprintf(stderr, "%s\n", Tcl_GetVar(g_tcledit_interp, "errorInfo", 0));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ proc minimenu {w text variable} {
|
||||
proc newattribute { } {
|
||||
global shaded transparent door
|
||||
global scaleno texture
|
||||
ast_attributes $shaded$transparent$door $texture $scaleno
|
||||
tcl_attributes $shaded$transparent$door $texture $scaleno
|
||||
}
|
||||
|
||||
# Handle edit mode settings
|
||||
@ -140,7 +140,7 @@ proc seteditmode {mode plane} {
|
||||
global shaded transparent door
|
||||
global scaleno scaling texture
|
||||
set editmode $mode; set editplane $plane
|
||||
ast_seteditmode $mode $plane
|
||||
tcl_seteditmode $mode $plane
|
||||
if {($editmode == "NEW") || ($editmode == "EDIT")} {
|
||||
set xpt1 $xpos; set xpt2 $xpos; set xpt3 $xpos; set xpt4 $xpos
|
||||
set ypt1 $ypos; set ypt2 $ypos; set ypt3 $ypos; set ypt4 $ypos
|
||||
@ -149,9 +149,9 @@ proc seteditmode {mode plane} {
|
||||
set editwidth 0; set editheight 0
|
||||
set shaded 0; set transparent 0; set door 0
|
||||
set scaleno 0; set scaling 1x; set texture 0
|
||||
ast_edit "x" $xpos 0
|
||||
ast_edit "y" $ypos 0
|
||||
ast_edit "z" $zpos 0
|
||||
tcl_edit "x" $xpos 0
|
||||
tcl_edit "y" $ypos 0
|
||||
tcl_edit "z" $zpos 0
|
||||
newattribute
|
||||
}
|
||||
|
||||
@ -202,12 +202,12 @@ proc neweditx { xvalue } {
|
||||
set xpt4 $xvalue
|
||||
}
|
||||
set editwidth [expr $xpt2 - $xpt1]
|
||||
ast_edit "x" $xpt1 $editwidth
|
||||
tcl_edit "x" $xpt1 $editwidth
|
||||
} else {
|
||||
if {$editmode == "POS"} {
|
||||
global xpos ypos zpos
|
||||
set xpos $xvalue
|
||||
ast_position $xpos $ypos $zpos
|
||||
tcl_position $xpos $ypos $zpos
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -272,7 +272,7 @@ proc newedity { yvalue } {
|
||||
set ypt4 $yvalue
|
||||
}
|
||||
set editwidth [expr $ypt2 - $ypt1]
|
||||
ast_edit "y" $ypt1 $editwidth
|
||||
tcl_edit "y" $ypt1 $editwidth
|
||||
} else {
|
||||
if {$editpoint == "1"} {
|
||||
if {$yvalue > $ypt3} {
|
||||
@ -290,13 +290,13 @@ proc newedity { yvalue } {
|
||||
set ypt4 $yvalue
|
||||
}
|
||||
set editheight [expr $ypt3 - $ypt1]
|
||||
ast_edit "y" $ypt1 $editheight
|
||||
tcl_edit "y" $ypt1 $editheight
|
||||
}
|
||||
} else {
|
||||
if {$editmode == "POS"} {
|
||||
global xpos ypos zpos
|
||||
set ypos $yvalue
|
||||
ast_position $xpos $ypos $zpos
|
||||
tcl_position $xpos $ypos $zpos
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -360,12 +360,12 @@ proc neweditz { zvalue } {
|
||||
set zpt4 $zvalue
|
||||
}
|
||||
set editheight [expr $zpt3 - $zpt1]
|
||||
ast_edit "z" $zpt1 $editheight
|
||||
tcl_edit "z" $zpt1 $editheight
|
||||
} else {
|
||||
if {$editmode == "POS"} {
|
||||
global xpos ypos zpos
|
||||
set zpos $zvalue
|
||||
ast_position $xpos $ypos $zpos
|
||||
tcl_position $xpos $ypos $zpos
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -405,7 +405,7 @@ proc newwidth { width } {
|
||||
if {$editpoint == "2"} {
|
||||
setyscale $ypt2
|
||||
}
|
||||
ast_edit "y" $ypt1 $editwidth
|
||||
tcl_edit "y" $ypt1 $editwidth
|
||||
}
|
||||
default {
|
||||
set xpt2 [expr $xpt1 + $width]
|
||||
@ -418,7 +418,7 @@ proc newwidth { width } {
|
||||
if {$editpoint == "2"} {
|
||||
setxscale $xpt2
|
||||
}
|
||||
ast_edit "x" $xpt1 $editwidth
|
||||
tcl_edit "x" $xpt1 $editwidth
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -446,7 +446,7 @@ proc newheight { height } {
|
||||
if {$editpoint == "3"} {
|
||||
setyscale $ypt3
|
||||
}
|
||||
ast_edit "y" $ypt1 $editheight
|
||||
tcl_edit "y" $ypt1 $editheight
|
||||
}
|
||||
default {
|
||||
set zpt3 [expr $zpt1 + $height]
|
||||
@ -459,7 +459,7 @@ proc newheight { height } {
|
||||
if {$editpoint == "3"} {
|
||||
setzscale $zpt3
|
||||
}
|
||||
ast_edit "z" $zpt1 $editheight
|
||||
tcl_edit "z" $zpt1 $editheight
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -523,7 +523,7 @@ proc newzoom { newzoom } {
|
||||
setxscale $tmpxscale
|
||||
setyscale $tmpyscale
|
||||
setzscale $tmpzscale
|
||||
ast_zoom $screenwidth $xmin $ymin $zmin
|
||||
tcl_zoom $screenwidth $xmin $ymin $zmin
|
||||
}
|
||||
|
||||
# Set slider variables
|
||||
@ -600,7 +600,7 @@ proc selectedit {} {
|
||||
|
||||
# Add the current plane
|
||||
proc selectadd {} {
|
||||
ast_addrectangle
|
||||
tcl_addrectangle
|
||||
selectpos
|
||||
}
|
||||
|
||||
@ -698,7 +698,7 @@ proc edit2 { w } {
|
||||
button $w.newx -width 8 -text "NEWX" -relief raised -command "selectnew x"
|
||||
button $w.newy -width 8 -text "NEWY" -relief raised -command "selectnew y"
|
||||
button $w.newz -width 8 -text "NEWZ" -relief raised -command "selectnew z"
|
||||
button $w.save -width 8 -text "SAVE" -relief raised -command ast_save
|
||||
button $w.save -width 8 -text "SAVE" -relief raised -command tcl_save
|
||||
pack $w.newx -anchor w -side top -fill y
|
||||
pack $w.newy -anchor w -side top -fill y
|
||||
pack $w.newz -anchor w -side top -fill y
|
||||
|
@ -37,6 +37,7 @@
|
||||
* Included Files
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -53,6 +54,7 @@
|
||||
#include "trv_types.h"
|
||||
#include "trv_graphics.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "wld_mem.h"
|
||||
#include "wld_bitmaps.h"
|
||||
#include "wld_plane.h"
|
||||
@ -94,8 +96,8 @@ static void x11_unmap_all_sharedmemory(void);
|
||||
static void x11_create_window(tcl_window_t * w)
|
||||
{
|
||||
XGCValues gcValues;
|
||||
char *argv[2] = { "xast", NULL };
|
||||
char *iconName = "xast";
|
||||
char *argv[2] = { "tcledit", NULL };
|
||||
char *iconName = "tcledit";
|
||||
XTextProperty wNameProp, iNameProp;
|
||||
XSizeHints sizeHints;
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "wld_color.h"
|
||||
#include "trv_graphics.h"
|
||||
#include "wld_bitmaps.h"
|
||||
#include "wld_plane.h"
|
||||
@ -130,17 +131,17 @@ enum editPlaneEnum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *title; /* Title on window */
|
||||
enum editPlaneEnum plane; /* Identifies plane of window */
|
||||
int width; /* Width of window */
|
||||
int height; /* Height of window */
|
||||
int ncolors; /* Number of colors allocated (PALETTE_SIZE) */
|
||||
Display *display; /* X stuff */
|
||||
Window win;
|
||||
XImage *image;
|
||||
int screen;
|
||||
dev_pixel_t *frameBuffer; /* Pointer to framebuffer */
|
||||
RGBColor palette[PALETTE_SIZE]; /* Colors requested */
|
||||
char *title; /* Title on window */
|
||||
enum editPlaneEnum plane; /* Identifies plane of window */
|
||||
int width; /* Width of window */
|
||||
int height; /* Height of window */
|
||||
int ncolors; /* Number of colors allocated (PALETTE_SIZE) */
|
||||
Display *display; /* X stuff */
|
||||
Window win;
|
||||
XImage *image;
|
||||
int screen;
|
||||
dev_pixel_t *frameBuffer; /* Pointer to framebuffer */
|
||||
color_rgb_t palette[PALETTE_SIZE]; /* Colors requested */
|
||||
unsigned long colorLookup[PALETTE_SIZE]; /* Color values to use */
|
||||
} tcl_window_t;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user